Strange behavior for analog pins (AIN[[5]) in SAMR21

Discussions around product based on ARM Cortex M0+ core.

Moderator: nferre

Posts: 12
Joined: Sat Mar 28, 2015 6:49 am

Strange behavior for analog pins (AIN[[5]) in SAMR21

Sat Apr 09, 2016 2:51 am

Hello All:

I'm using the ADC in the SAMR21, specifically the AIN[5] (alternate function B in PA05) but it seems it works no matter if I enable the PMUXEN for that pin or not, and even if I enable the multiplexing function but I use any other function than B... So, as long as I initialize the ADC module and trigger a conversion via software, it works even when the pad is selected as GPIO (as a digital port).

This is kind of weird to me as I would expect the pad not be connected to the AIN input, unless it's appropriately configured. My main concern is it's not fully working as it should or there is something else not completely correct.

Did someone experience this behavior? Is it normal or expected?

Thanks in advance

Location: USA
Posts: 1507
Joined: Thu Apr 19, 2007 10:15 pm

Re: Strange behavior for analog pins (AIN[[5]) in SAMR21

Sat Apr 09, 2016 3:09 am

IIRC the input of a pin/pad is wired to all of its peripherals, i.e. there's no gating in the diagrams I've looked at.
For sure the logic value of a pin is always readable.

Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: Strange behavior for analog pins (AIN[[5]) in SAMR21

Wed Apr 13, 2016 9:10 am

Hi there

GPIO pins in the M0+ series are very versatile. As blue_z points out, the multiplexing is rich, to the point that you can configure things to *always* allow a read. Initialising the analog read will enable that function. Just be careful that you don't disable it mid-read by re-configuring and setting a digital output value.

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 2 guests