HAL ADC multi channel in polling mode
Hi everyone,
I have a STM32F042F6P6 chip. I want to read 9 analog channels on it.
I guess there are at least 2 options: configure a scan mode with DMA, and staying in polling mode.
I decided to stay in polling mode to avoid a potential problem due to DMA config.
I defined 1 adc handle and did channel configurations (8 first channels are gpios, the 9th is internal temp)
It seems that when calling those 2 methods repeatedly, the ADC auto-increments and read each channel starting from the lowest ID.
Let's say now that I want to have a method that reads only the internal temperature, how do I manage to tell to HAL_ADC_PollConversion to point on the internal temperature channel only ?
I have had an idea but it is quite radical:
- create other channel config structure, with only the Temp channel defined, and each time I call a conversion method, before that I call HAL_ADC_ConfigChannel with the good channel config structure.
Also, I have 2 questions:
- What is the rank of an ADC channel, and what is it used for ? I see sometimes people defining several channel but with the same rank, I don't understand why.
- Does someone have a breve explanation of multichannel conversion in DMA mode ? I do not find clear information for newbie in embedded systems like me.
Thank you very much,
Arthur
