cancel
Showing results for 
Search instead for 
Did you mean: 

STM32VLDISCOVERY - ADC: unexpected behavior

msfassarella
Associate II
Posted on June 29, 2013 at 13:24

Is it possible to use ADC without configure GPIO for AIN?

For example, if the lines below are commented in the program, can ADC still work?

//       GPIO_InitStructure.GPIO_Mode = GPIO_Mode_AIN;

//       GPIO_InitStructure.GPIO_Pin = GPIO_Pin_1;  

//       GPIO_InitStructure.GPIO_Speed  = GPIO_Speed_50MHz;

//       GPIO_Init(GPIOC, &GPIO_InitStructure);

at really, I put the pin with the mode IN_FLOATING and the ADC work normally.

3 REPLIES 3
Posted on June 29, 2013 at 14:47

AIN turns off all the digital circuitry on the pin, including the Schmitt trigger IN_FLOATING has enabled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
re.wolff9
Senior
Posted on July 01, 2013 at 08:31

The reason for this is that the circuitry starts with an Nmos and Pmos transistor pair. With the input at 0V the P conducts and the Nmos doesn't. With the input at VCC the Nmos conducts and the Pmos doesn't. But inbetween there might be a moment that both conduct.

In the input-circuit of a chip this will cost you a couple of mA of extra current if the signal lingers in the middle. (depending on the process parameters, more than about 0.8V from either supply). That means that if you're running at 1.8V, there is not much drawback. The current will be small and the dangerous region small.

msfassarella
Associate II
Posted on July 04, 2013 at 22:06

Looking at reference manual (RM0041) I notice that Analog input is connected before the Schmmit and without flux control. I did a simple experience putting the pin in output mode and after I tried to read the value with the ADC. In this case I could read the right values for output in high or low level.