AnsweredAssumed Answered

how to read multi channel ADC ?

Question asked by patil.kalpesh on Dec 30, 2016
Latest reply on Apr 15, 2017 by Jinhui Lin

hi , i am using STM32fo with cube mx and keil mdk5. in my project i have to read muti channel ADC value . For this when i used DMA  , DMA has its interrupt and in my project i already used timer interrupt so these two get conflict. i didn't used DMA function.

when i used below function  in my project than the channel1 and channel 2 value swapping with each other . i didn't get channel1 value to channel1 and channel2 value to channel2.

 

while(1){ HAL_ADC_Start(&hadc);

while(HAL_ADC_PollForConversion(&hadc,0) != HAL_OK);

channel_1 = HAL_ADC_GetValue(&hadc); while(HAL_ADC_PollForConversion(&hadc,0) != HAL_OK);

channel_2= HAL_ADC_GetValue(&hadc); HAL_ADC_Stop(&hadc); }

 

 

 

please help me how to read correct value of each channel .

sorry for poor English 

 

thank you

Outcomes