Skip to main content
msfassarella
Associate
June 29, 2013
Question

STM32VLDISCOVERY - ADC: unexpected behavior

  • June 29, 2013
  • 3 replies
  • 697 views
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.

    This topic has been closed for replies.

    3 replies

    Tesla DeLorean
    Guru
    June 29, 2013
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    re.wolff9
    Senior
    July 1, 2013
    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
    July 4, 2013
    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.