cancel
Showing results for 
Search instead for 
Did you mean: 

Need help reading BOTH temperature and reference voltage

Jim Seymour
Senior
Posted on May 20, 2016 at 01:17

Using Cube-generated code...

I'm a little confused about the HAL_ADC functions to read the temperature and reference voltage channels. I can read the temperature with this simple code:

HAL_ADC_Start(&hadc);
HAL_ADC_PollForConversion(&hadc, 10);
cpuTemp = HAL_ADC_GetValue(&hadc);

However, it's not clear to me how to read the reference voltage, as well. The same ''hadc'' handle is set up to read both channels. Is it as simple as calling _PollForConversion again? Or do I need to actually set up a DMA operation with a 2-field buffer. If anybody has some sample code that does this, I'd really appreciate it. Thanks! #no-hablo-hal
2 REPLIES 2
Posted on May 20, 2016 at 01:31

Or do I need to actually set up a DMA operation with a 2-field buffer.

On most STM32 that's usually the procedure.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
Walid FTITI_O
Senior II
Posted on May 20, 2016 at 11:11

Hi seymour.jim,

You can refer to example in HAL library , like ''ADC_RegularConversion_DMA'' in

http://www.st.com/content/st_com/en/products/embedded-software/mcus-embedded-software/stm32-embedded-software/stm32cube-embedded-software/stm32cubef4.html

at this path: STM32Cube_FW_F4_V1.11.0\Projects\STM324xG_EVAL\Examples\ADC\ADC_RegularConversion_DMA

-Hannibal-