2021-02-05 02:21 AM
I am working on a project that requires 3 channels of ADC1 and FreeRTOS.
I am using STM32F446RCT6.
I start ADC conversion at the start of the code
HAL_ADC_Start_IT(&hadc1);
Here is my implementation for ADC callback.
whereas array to hold data is described as:
volatile uint16_t ADC_raw[3] = {0};
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
if (__HAL_ADC_GET_FLAG(hadc, ADC_FLAG_EOC)) //if call to end of convesion
{
ADC_raw[counter] = HAL_ADC_GetValue(hadc); //ADC value stores in array
counter++;
if(counter>2) counter = 0;
}
}
Now,
When I do not implement RTOS and just runs normal code in while(1) loop, it works well and values for ADC_raw is updated correctly.
But when I enable RTOS and run the same code, the ADC callback is never getting called and thus ADC_raw values are always zero.
I can't figure out what can be the issue. Any help would be greatly appreciated.
Here is my configuration for ADC, interrupt is enabled, DMA is not used.
Here is my RTOS initialization:
2021-05-07 01:12 AM
Hello @Community member ,
Can you share your project that uses FreeRTOS for further check?
Thanks in advance.
Walid.