cancel
Showing results for 
Search instead for 
Did you mean: 

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

sal92
Associate

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

1 ACCEPTED SOLUTION

Accepted Solutions
sal92
Associate

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?

View solution in original post

5 REPLIES 5

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...

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.
TDK
Guru

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

If you feel a post has answered your question, please click "Accept as Solution".
Billy OWEN
ST Employee

Hi @sal92 

 

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

 

Regards,

Billy

sal92
Associate

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?


@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.

A complex system that works is invariably found to have evolved from a simple system that worked.
A complex system designed from scratch never works and cannot be patched up to make it work.