Problems with CubeMx 6.12 + adc5 + dma
In my project I use 4 adc, managed with the same code. With adc5, and two channels, I had a problem: I read two equal values, that is, the second was equal to first channel.
After several searches I discovered that, in the adc.c file created by cubemx, in the section relating to adc5,
the line -->sConfig.Channel = ADC_CHANNEL_2;<-- was missing
First channel configuration
/** Configure Regular Channel */
sConfig.Channel = ADC_CHANNEL_1;
sConfig.Rank = ADC_REGULAR_RANK_1;
sConfig.SamplingTime = ADC_SAMPLETIME_2CYCLES_5;
sConfig.SingleDiff = ADC_SINGLE_ENDED;
sConfig.OffsetNumber = ADC_OFFSET_NONE;
sConfig.Offset = 0;
if (HAL_ADC_ConfigChannel(&hadc5, &sConfig) != HAL_OK)
{
Error_Handler();
}
/** Configure Regular Channel */
Second channel configuration
--> sConfig.Channel = ADC_CHANNEL_2; <<-- this was not there
sConfig.Rank = ADC_REGULAR_RANK_2;
I have re-done the configuration with Cubemx several times but the problem remains
Is it a bug?
Can I do something?
It is annoying to have to remember to manually add a line of code in adc.c when I change the configuration in Cubemx.
Thanks
