Hi,
I am trying to create a task to call “lv_task_handler( )” periodically, but the esp32(FreeRtos crash).
I tryed with dinamically allocated task and with statically allocated task, but neither worked.
When i comment “lv_task_handler( )” inside task “static void littleVgl_task_handler( void* pvParameters )” and uncomment “printf (“test\n”)” the system works.
Something inside “lv_task_handler( )” is causing the system to crash i think, but it’s strange because if i put “lv_task_handler( )” inside the while loop it works correctly.
// works.
while(1)
{
lv_task_handler( );
vTaskDelay(1);
}
Create dinamically allocated task:
// don't works.
/*
BaseType_t xTaskCreatePinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint32_t usStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
TaskHandle_t * const pxCreatedTask,
const BaseType_t xCoreID
);
*/
xTaskCreatePinnedToCore( littleVgl_task_handler,
"littleVgl_handl",
2048,
NULL,
1,
NULL,
0
);
vTaskStartScheduler( );
Create statically allocated task:
static StackType_t littleVgl_task_handler_stack_buffer[4096];
static StaticTask_t littleVgl_task_handler_task_data_structure;
/*
TaskHandle_t xTaskCreateStaticPinnedToCore( TaskFunction_t pxTaskCode,
const char * const pcName,
const uint32_t ulStackDepth,
void * const pvParameters,
UBaseType_t uxPriority,
StackType_t * const puxStackBuffer,
StaticTask_t * const pxTaskBuffer,
const BaseType_t xCoreID
);
*/
xTaskCreateStaticPinnedToCore( littleVgl_task_handler,
"littleVgl_handl",
sizeof(littleVgl_task_handler_stack_buffer),
NULL,
1,
littleVgl_task_handler_stack_buffer,
&littleVgl_task_handler_task_data_structure,
0
);
vTaskStartScheduler( );
Task to execute “lv_task_handler( )” every 5 ms.
static void littleVgl_task_handler( void* pvParameters )
{
TickType_t xLastWakeTime;
const TickType_t xFrequency = 5;
// Initialise the xLastWakeTime variable with the current time.
xLastWakeTime = xTaskGetTickCount ( );
for( ;; )
{
// Wait for the next cycle.
vTaskDelayUntil( &xLastWakeTime, xFrequency );
// Perform action here.
//printf("test\n");
lv_task_handler( );
}
}
Thank’s for any help.