I guess it is not just a question Keil product, but I need your advice. I am using STM32f1 with CubeMX and keil mdk5. in my project i have to read muti channel ADC value ADC is in Scan conversion mode Enable, Number of conversion 2, Rank1 Channel Temperature sensor and Rank 2 Chane Vrefint.
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); }
Problem is booth call HAL_ADC_GetValue() retint value of Rank1 ti is voltage on Channel Temperature sensor. I can not figure out how to read value from next RANK 2
Thanks for help.
When using DMA, HAL_ADC_GetValue does not need to be included. You include HAL_ADC_Start_DMA (& hadc1, (uint32_t *) Add_Data, n); Where Add_Data-array. You remove the data with Add_Data [n]