lisa wrote:
> I should have been more specific. The ADC channels themselves are
> working, the pins are just being driven by something else (they have a
> standing voltage which overpowers any signal coming from a peripheral,
> but work just fine when using a power supply or something with more
> current).
>
> I've tried configuring the pins as inputs prior to enabling the channel,
> but that doesn't work either.
>
> Any insight would be greatly appreciated.
>
> Thanks again!
>
Refer to section 36.4.3, it states "By default, after reset, the PIO
line is configured as input with its pull-up enabled and the ADC input
is connected to the GND.". It is not explicitly stated that when
configuring as an ADC the pull-up is removed, so you have to assume that
it is not. Section 28.5.1 states "Control of the pull-up resistor is
possible regardless of the configuration of the I/O line", which kind of
implies that the pull-up remains enabled. Set the associated bits in
PIO_PUSR to 1 to disable the pull-up. I suspect that this will do the
trick if you have a weak drive. You should also take a look at section
37.7 with respect the maximum output impedence you can use to drive the
ADC, which is a function of the sample & hold time and the resolution
mode (8 or 10 bit).
None of this is of course a compiler or toolchain issue; but hope this
helps nonetheless.
There are plenty of gotchas in the hardware due to multiplexing of I/O
pins. It pays to be very familiar with the device user manual. As a rule
when you want a pin for a particular function, it pays to read the
sections related to the alternate functions as well - especially when
the function is not the reset default.
Clifford