Hi, I'm trying to use the ADC0-4 pins on my at91sam7s-ek board, but they are either driven high or at 2.5 volts. Is there a way to set the pins (since they have double functionality) to be inputs to the ADC? Thanks.
lisa wrote: > Hi, > > I'm trying to use the ADC0-4 pins on my at91sam7s-ek board, but they are > either driven high or at 2.5 volts. Is there a way to set the pins > (since they have double functionality) to be inputs to the ADC? > > Thanks. According ot the user manual (http://www.atmel.org/dyn/resources/prod_documents/doc6175.pdf), section 36.4.2 (page 474), the ADC function is enabled automatically when the channel is enabled in the ADC_CHER register. Clifford
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! Clifford Slocombe wrote: > lisa wrote: >> Hi, >> >> I'm trying to use the ADC0-4 pins on my at91sam7s-ek board, but they are >> either driven high or at 2.5 volts. Is there a way to set the pins >> (since they have double functionality) to be inputs to the ADC? >> >> Thanks. > > According ot the user manual > (http://www.atmel.org/dyn/resources/prod_documents/doc6175.pdf), section > 36.4.2 (page 474), the ADC function is enabled automatically when the > channel is enabled in the ADC_CHER register. > > Clifford
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
Please log in before posting. Registration is free and takes only a minute.
Existing account
Do you have a Google/GoogleMail account? No registration required!
Log in with Google account
Log in with Google account
No account? Register here.