Skip to main content
William Huang
Associate II
February 25, 2017
Solved

STM32F303: GPIO configured with PP affect ADC readings

  • February 25, 2017
  • 2 replies
  • 859 views
Posted on February 25, 2017 at 04:22

Hi,

I'm using a STM32F303 (landing page:

http://www.st.com/en/microcontrollers/stm32f303k8.html

) for one of my project. I have PA0 configured as a GPIO output with push pull used to turn ON/OFF a BJT. I also have PA3 configured to use the ADC1 channel 4 module.

When I set PA0 high, the ADC readings increase by about 1.8V. When it is low, the readings are correct. Why does this happen? Externally, these two pins aren't connected directly to each other.

    This topic has been closed for replies.
    Best answer by S.Ma
    Posted on February 25, 2017 at 09:17

    Check if the analog supply VSSA/VDDA (if present in chosen package) are well polarized and have decoupling capacitors.

    Make sure these supplies are connected somewhere to VSS/VDD

    Make sure that all the GPIO which can be connected to ADC/DAC are not used at 5V tolerant IO.

    Also make sure the analog input has low impedence.

    You could also try instead of push pull ouput high/low to manually select digital input and activate/deactivate the pull-up and pull-down to see its effect on the ADC input pin. Some HW debug seems needed. You might also compare the behaviour with a nucleo/discovery board to make progress in the debug. good luck!

    2 replies

    S.Ma
    S.MaBest answer
    Principal
    February 25, 2017
    Posted on February 25, 2017 at 09:17

    Check if the analog supply VSSA/VDDA (if present in chosen package) are well polarized and have decoupling capacitors.

    Make sure these supplies are connected somewhere to VSS/VDD

    Make sure that all the GPIO which can be connected to ADC/DAC are not used at 5V tolerant IO.

    Also make sure the analog input has low impedence.

    You could also try instead of push pull ouput high/low to manually select digital input and activate/deactivate the pull-up and pull-down to see its effect on the ADC input pin. Some HW debug seems needed. You might also compare the behaviour with a nucleo/discovery board to make progress in the debug. good luck!

    William Huang
    Associate II
    February 26, 2017
    Posted on February 26, 2017 at 01:23

    Thank you, it seems like the reason is because my VDDA is not within specifications as outlined in the datasheet. I have it as 2.048V at the moment. I've re-uploaded my code onto the nucleo-f303 development board which uses the same chip. It has VDDA as 3.3V, and the readings are measuring fine.