2015-12-08 02:04 AM
I have read the following note in STM32CubeMX 4.12.0 release notes
333755 [MX-FreeRTOS/NVIC] HAL_IncTick must be removed and systick prio must be the lowest when FreeRTOS is activated
I have regenerated a project with 4.12 and indeed the call to
HAL_IncTick() is removed from
SysTick_Handler
()
HAL_GetTick() is used in many HAL drivers for timeout.
How can timeouts work if HAL_IncTick() is removed ?
best regards
#hal #freertos2015-12-08 02:26 AM
Hi Thomas,
The SysTick interrupt should call the xPortSysTickHandler for freeRTOS usage. and for the Delay function, you can use vTaskDelay. void Delay(uint32_t nTime) { vTaskDelay(nTime); } see in FreeRTOSConfig.h ... #define vPortSVCHandler SVC_Handler #define xPortPendSVHandler PendSV_Handler #define xPortSysTickHandler SysTick_Handler2015-12-08 02:34 AM
user delays are not the problem
the question is
HAL_GetTick() is used in many HAL drivers for timeout.
How can timeouts work if HAL_IncTick() is removed ?
2015-12-08 02:40 AM
HAL_GetTick(); // <- used in many HAL drivers.
// Now It's working with freeRTOS ;) /* Start the scheduler. */ vTaskStartScheduler(); while(1); }You should start the scheduler before calling HAL_Delay ! so create a main task who call your HAL_Init function. This function call HAL initialization and the delay works. static portTASK_FUNCTION( vMainTask, pvParameters ) { /* The parameters are not used. */ ( void ) pvParameters; HAL_Init(); printf(''waiting for some delay ...''); HAL_Delay(100); // <- used in many HAL drivers. // Now It's working now with freeRTOS ;) printf(''done\n''); for(;;) { portTickType xLastTickCount = xTaskGetTickCount(); vTaskDelayUntil(&xLastTickCount, LOOP_TIME_MS); } }