Skip to main content
Graduate
April 10, 2025
Solved

How to use analogue pins (not ADC) to read voltage?

  • April 10, 2025
  • 4 replies
  • 654 views

hi all,

 

I am using STM32F733xx and i want to read the Vout i will be monitoring is between 1-5v, to read that i have used analogue pins PG13, PH3 ,PH2,PG14, PE2,PE3, PE6, PE4,PE5,PF1,PF0,PF2

I already have the PCB so i cant change the design can anyone suggest any solution to this?

Looking for some firmware based solution to this problem.

 

Thanks in advance,

Regards,

Sal

    This topic has been closed for replies.
    Best answer by sal92

    Thanks everyone i ended up changing the pin outs and modified the hardware.

     

    Also for the voltage level my input is up to 5v which IC i should use in between in order to change the voltage level but to get the accurate voltage and current reading?

    4 replies

    Super User
    April 10, 2025

    Welcome to the forum.

    For best results, please see: How to write your question to maximize your chances to find a solution.

     


    @sal92 wrote:

    i have used analogue pins PG13, PH3 ,PH2,PG14, PE2,PE3, PE6, PE4,PE5,PF1,PF0,PF2


    None of those pins has any analogue function:

    PG13 TRACED0, LPTIM1_OUT,USART6_CTS, FMC_A24,EVENTOUT
    PH3  QUADSPI_BK2_IO1,SAI2_MCK_B, FMC_SDNE0,EVENTOUT
    PH2  LPTIM1_IN2, QUADSPI_BK2_IO0, SAI2_SCK_B, FMC_SDCKE0, EVENTOUT
    PG14 TRACED1, LPTIM1_ETR,USART6_TX,QUADSPI_BK2_IO3, FMC_A25,EVENTOUT
    PE2  TRACECLK, SPI4_SCK, SAI1_MCLK_A, QUADSPI_BK1_IO2, FMC_A23, EVENTOUT
    PE3  TRACED0, SAI1_SD_B, FMC_A19, EVENTOUT
    PE6  TRACED3, TIM1_BKIN2,TIM9_CH2, SPI4_MOSI,SAI1_SD_A, SAI2_MCK_B,FMC_A22, EVENTOUT
    PE4  TRACED1, SPI4_NSS,SAI1_FS_A, FMC_A20,EVENTOUT 
    PE5  TRACED2, TIM9_CH1,SPI4_MISO, SAI1_SCK_A,FMC_A21, EVENTOUT 
    PF1  I2C2_SCL, FMC_A1, EVENTOUT
    PF0  I2C2_SDA, FMC_A0, EVENTOUT
    PF2  I2C2_SMBA, FMC_A2, EVENTOUT

     

    Please show your schematic - that would be easier to follow.

     

    An ADC is the only way you're going to directly read an analogue voltage as a digital value.

    Otherwise, you're going to have to "synthesise" an ADC; eg, use a DAC to generate a "reference", and a comparator to compare.

    Whatever you do, it's going to need hardware changes...

    Super User
    April 11, 2025

    Even if they were wired to the correct pins, the ADC isn't going to be able to measure 5 V.

    ST Employee
    April 16, 2025

    Hi @sal92 

     

    This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

     

    Regards,

    Billy

    sal92AuthorAnswer
    Graduate
    April 17, 2025

    Thanks everyone i ended up changing the pin outs and modified the hardware.

     

    Also for the voltage level my input is up to 5v which IC i should use in between in order to change the voltage level but to get the accurate voltage and current reading?

    Super User
    April 17, 2025

    @sal92 wrote:

    Thanks everyone i ended up changing the pin outs and modified the hardware.


    That's good - please mark the solution:

    https://community.st.com/t5/community-guidelines/help-others-to-solve-their-issues/ta-p/575256

     


    @sal92 wrote:

    Also for the voltage level my input is up to 5v which IC i should use in between in order to change the voltage level but to get the accurate voltage and current reading?


    That's a separate question - please start a new thread for that.