2022-06-23 02:09 PM
2022-06-24 12:21 PM
To answer my own question, you have to set the Rank and the Sampling Time after selecting a new channel.
sConfig.Channel = ADC_CHANNEL_13;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_3CYCLES;
if (HAL_ADC_ConfigChannel(&hadc2, &sConfig) != HAL_OK)
{
Error_Handler();
}
I'd be interested if there are any other solutions, this seems cumbersome.
2022-06-24 01:07 PM
The typical implementation for more than one channel is to use DMA and convert all channels with one start. Channel, Rank and SampleTime configuration initialization for each channel provides complete flexibility for such a sequence.
Is your application not typical?
Cheers, Hal
2022-06-27 01:15 PM
Thanks for your reply Hal,
The application is a multi-channel logger with selective channels, nothing particularly unique. I think that I am just used to other controllers that require a channel selection and then a channel conversion , this is just a different way to think about sampling, i wasn't aware that this is how it is meant to work.
Cheers
Richard