8 years, 2 months ago.

Basic question about the digital/analog pins (Nucleo f091RC)

I am using PA0/1/4 as analog inputs and PC1 as a digital input with interrupt.

Question about Analog: My analog pins have 1.5v on them, which I believe is not normal as they are inputs, I get AN1=30247 AN2=30615 AN3=27334 as analog readings (16bit). I put 3.3v on them and readings change to 65535 which I believe is the full range and when I ground it, the readings goto 0 which is as expected. But why there is 1.5v on them?

Question about Digital: PC_1is attached to an interrupt which toggles the led on the rising edge of the pin. Whenever I pull this pin low, I have to wait a few seconds before I pull it low for the led to operate. It seems like there is an inbuilt capacitor which discharges when I pull the pin low and takes time to charge again which is normally normal of the digital inputs.

Can someone shed some light on this please. Thanks

1 Answer

8 years, 2 months ago.

Analog inputs are high impedance, so the pins will float around a bit if left unconnected. Usually, you would drive these inputs with some low impedance amplifier.

Similarly with the digital input, it is still high impedance and must be driven. If you leave a digital input floating sometimes the pin will drift to a rail or sometimes the pin will oscillate. once again, the input needs to be driven with low impedance.

Usually with a digital input, you would have a pullup to 3V3 with a 100k or 10k resistor, You can use a 1k if you want the fast rise times, but at 3V the 1k will use 3mA of current, this affects your power budget if you have many inputs, So we usually use a 10k pullup.

Accepted Answer