SAM D21 Pull Down .. to Ground?

Discussions around product based on ARM Cortex M0+ core.

Moderator: nferre

erudisill
Posts: 5
Joined: Fri Mar 13, 2015 11:13 pm

SAM D21 Pull Down .. to Ground?

Thu Oct 29, 2015 11:18 pm

Reading the documentation for the SAM D21, I'm under the impression that I can set a pin to be input with pull-down. When doing so, I would expect that pin to go to ground. However, in practice, it is hovering around 0.4V. I'm using the following code on a pin that is electrically connected to nothing at the moment.

Code: Select all

	
        config_port.input_pull = PORT_PIN_PULL_DOWN;
	config_port.direction = PORT_PIN_DIR_INPUT;
	config_port.powersave = false;
	port_pin_set_config(PIN_PA25, &config_port);
Am I misunderstanding the behavior of the pull-down functionality of the D21? I place a logic probe on the pin, and at 400mV, it won't show GND, but it isn't high enough to show a logic 1 either.

My intention is to use this pin to control a reset line on a peripheral chip which requires a drop to GND to assert.

Thanks!
-Eric
sarlacii
Posts: 68
Joined: Mon Jan 26, 2015 2:33 pm

Re: SAM D21 Pull Down .. to Ground?

Mon Nov 23, 2015 9:20 am

Hi Eric. You are looking at two totally different scenarios. You are measuring on an input, without any external connections (except your high-impedance meter) and yet you want to use the line to drive a reset line, which is an output. Spot the contradiction? :)

Have a read of the datasheet, under "Electrical Characteristics", sub-section "I/O Pin Characteristics". You may also want to read up on hardware implementations of IC I/O to see how exactly they manage to achieve all the S/W-selectable variations.

The silicon hardware is different for an input vs. output. To make the input work as expected, you must have an external connection to match the logic level you are trying to read. With whatever pull-up or pull-down resistance you have selected (which the datasheet says is anything between 20-60kE) the device will read a logic low on an unconnected pin.

When you drive the pin as an output logic low, however, the FET is driven full on, giving you an output level that is maximum 0.2*Vdd.

Go well.

**edited to correct error - said output when I meant input!
erudisill
Posts: 5
Joined: Fri Mar 13, 2015 11:13 pm

Re: SAM D21 Pull Down .. to Ground?

Mon Nov 23, 2015 5:42 pm

Thanks for the reply. In the end, it all turned out to be a flaky ground on the MCU. After fixing the ground, I configured the pin as output and set output level to 0, and it works fine. When I'm not holding the peripheral in reset, I configure the pin as input with no pull. This works as I expected it to.

I guess the part I got hung up on was the mention of the pull-down on the input. I expected to see a ground connection there when measuring, but due to the bad ground on the MCU, that was not the case. That sent me into a cycle of confusion where I started doubting everything, including the datasheet!

Thanks for the reply!

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

Re: SAM D21 Pull Down .. to Ground?

Wed Nov 25, 2015 4:03 pm

Ah, cool beans. Go well.

Return to “SAM D20 Cortex-M0+ MCU”

Who is online

Users browsing this forum: No registered users and 1 guest