EmbDev.net

Forum: ARM programming with GCC/GNU tools newbie ADC question


Author: lisa (Guest)
Posted on:

Rate this post
0 useful
not useful
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.

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
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/...), section
36.4.2 (page 474), the ADC function is enabled automatically when the
channel is enabled in the ADC_CHER register.

Clifford

Author: lisa (Guest)
Posted on:

Rate this post
0 useful
not useful
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/...), section
> 36.4.2 (page 474), the ADC function is enabled automatically when the
> channel is enabled in the ADC_CHER register.
>
> Clifford

Author: Clifford Slocombe (clifford)
Posted on:

Rate this post
0 useful
not useful
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

Reply

Entering an e-mail address is optional. If you want to receive reply notifications by e-mail, please log in.

Rules — please read before posting

  • Post long source code as attachment, not in the text
  • Posting advertisements is forbidden.

Formatting options

  • [c]C code[/c]
  • [avrasm]AVR assembler code[/avrasm]
  • [code]code in other languages, ASCII drawings[/code]
  • [math]formula (LaTeX syntax)[/math]




Bild automatisch verkleinern, falls nötig
Note: the original post is older than 6 months. Please don't ask any new questions in this thread, but start a new one.