cancel
Showing results for 
Search instead for 
Did you mean: 

STM32 STM32H753ZIT6 ADC multiple ADC channels with polling

tyassin
Associate III

Hi,

I have tried to setup the ADC in STM32H753ZIT6, to sample more than one channel by using the polling method.
So far I have not been successful. I have tried to follow guides and Youtube videos. What they all seem to do is to enable the wanted channels and then also only enable one "Number of Conversions". In the software they then switch channels like shown below. But this only read the same channel. 

I hope and believe this should be fairly straight forward, but I can simply not get it to work.

Any help or inputs are appriciated.

Thank you

 

sConfig.Channel = channel[i];

sConfig.Rank = 1;

HAL_ADC_Start(&hadc2); // Start ADC Conversion @ Selected Channel

HAL_ADC_PollForConversion(&hadc2, 1000); // Poll The ADC Channel With TimeOut = 1000mSec

ADC_result[i] = HAL_ADC_GetValue(&hadc2); // Read The ADC Conversion Result

HAL_ADC_Stop(&hadc2); // Stop conversion

 

tyassin_0-1722843834409.png

 

2 REPLIES 2

> In the software they then switch channels like shown below. But this only read the same channel.

Does that code write the desired channel into ADC registers at all?

Cube is open source, so you can debug it as your own code.

JW

tyassin
Associate III

Hi,
Thank you for the reply. I think I will park this for now as I will use the DMA method instead. Whgich I can get to work but now I have a calibration issue, which I think I will open a new thread on.

Thank you all.

 

Br.