void vTaskDisplay(void *pvParameters)
{
while(1) {
SWO_PRINTF("Task display entry");
lv_task_handler();
SWO_PRINTF("Task display exit");
vTaskDelay(5/ portTICK_PERIOD_MS);
}
}
void vTaskAnalog(void *pvParameters)
{
int ulNotifiedValue;
while(1) {
SWO_PRINTF("Task analog entry");
HAL_ADC_Start_DMA(&hadc1, value_buff1, 1024); // Here i start the ADC DMA.
ulNotifiedValue = ulTaskNotifyTake(pdTRUE, portMAX_DELAY); // here i am taking notification.
if(ulNotifiedValue > 0) {
SWO_PRINTF("ADC1_ch2 = %d\n ADC1_ch3 = %d\n", value_buff1[0], value_buff1[1]);
}
}
}
I am using these two tasks. Analog and Display Tasks.
void HAL_ADC_ConvCpltCallback(ADC_HandleTypeDef* hadc)
{
if(hadc->Instance == ADC1) {
xTaskNotifyGive(vTaskAnalogHandle); // here i am giving task notification
}
}
Task Creation: Tasks are created successfully.
xTaskCreate(vTaskAnalog, "vTaskAnalog", 128, 0, tskIDLE_PRIORITY+1, &vTaskAnalogHandle);
xTaskCreate(vTaskDisplay, "vTaskDisplay", 4096, 0, tskIDLE_PRIORITY+2, &vTaskDisplayHandle);
FreeRTOSConfig.h:
#define configLIBRARY_LOWEST_INTERRUPT_PRIORITY 15
#define configLIBRARY_MAX_SYSCALL_INTERRUPT_PRIORITY 5
ADC1:
HAL_NVIC_SetPriority(ADC_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(ADC_IRQn);
DMA2 Stream4:
/* DMA2_Stream4_IRQn interrupt configuration */
HAL_NVIC_SetPriority(DMA2_Stream4_IRQn, 5, 0);
HAL_NVIC_EnableIRQ(DMA2_Stream4_IRQn);
Can anyone give me solution. Because i am beginner of RTOS. I donât know where i am doing mistake.
Thanks
Manikandan D