MultiMode ADC Stops Shortly After Start When Integrated With FreeRTOS & TouchGFX
Hello,
So in an earlier question, I asked about how I can suspend/restart multimode ADCs of the STM32F429 configured in the triple interleaved mode.
To find an answer, I set up a blank project in which I periodically start/stopped the ADCs after different combinations of delays.
I was able to successfully suspend/restart the ADCs in all combinations with no problem.
My proof for that is that I'm able to see the noise introduced by ADCs sampling when they're running, on the input signal via an oscilloscope.
Now I want to do the same thing but this time with the FreeRTOS and TouchGFX added.
So I implemented the same code in my application as the following:
///////// in screen1view:
void Screen1View::handleTickEvent()
{
TickCounter++;
if (TickCounter > 500) { //startADCs
All_Init(); //initialize ADCs & DMA
HAL_ADC_Start(&hadc3);
HAL_ADC_Start(&hadc2);
HAL_ADCEx_MultiModeStart_DMA(&hadc1, (uint32_t *)ADC_Buffer, 3000);
TickCounter = 0;
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, GPIO_PIN_SET); //PE4 -> 1
} else if (TickCounter == 250) { //stop ADCs
HAL_ADCEx_MultiModeStop_DMA(&hadc1);
HAL_ADC_Stop(&hadc2);
HAL_ADC_Stop(&hadc3);
HAL_GPIO_WritePin(GPIOE, GPIO_PIN_4, GPIO_PIN_RESET); //PE4 -> 0
}
}
////// in main:
void All_Init(void) {
MX_DMA_Init();
MX_ADC3_Init();
MX_ADC2_Init();
MX_ADC1_Init();
}Note that the code I'm using for suspending/restarting the ADCs is exactly the same as before without FreeRTOS.
Now by running this code, the ADCs start when TickCounter gets above 500, but they stop running after ~7 milliseconds.
Here's the waveform captured on an oscilloscope.
Here the yellow waveform is the analog signal to the ADCs,
The cyan waveform is the GPIO PE4 which I used in the code above in order to find out when the ADC starts.
As you can see in the marked area in the picture, the ADC sampling starts as soon as the PE4 gets high, but instead of running until the PE4 gets low which is when the ADC suspension should occur, they just turn off after ~7ms.
The DMA interrupt priority is set to 0,0.
If anyone has any suggestions I'd be happy to hear them.
Thank you in advance
