2015-02-02 01:30 AM
STM32Cube provides project code generation for FreeRTOS along with a wrapper dedicated to use of the CMSIS-OS API.
Nevertheless, it seems that this wrapper is brocken regarding the FreeRTOS API function ''vTaskDelayUntil()
'' wich is wrapped to ''
osDelayUntil()
'' according to the following code from cmsis_os.c:
/** * @brief Delay a task until a specified time * @param PreviousWakeTime Pointer to a variable that holds the time at which the * task was last unblocked. * @param millisec time delay value * @retval status code that indicates the execution status of the function. */ osStatus osDelayUntil (uint32_t PreviousWakeTime, uint32_t millisec) { &sharpif INCLUDE_vTaskDelayUntil portTickType ticks = (millisec / portTICK_RATE_MS); portTickType previouswake = (portTickType) PreviousWakeTime; vTaskDelayUntil(&previouswake, ticks ? ticks : 1); return osOK; &sharpelse (void) millisec; (void) PreviousWakeTime; return osErrorResource; &sharpendif } In the freeRTOS API, the first argument of this function is a pointer to a variable that holds the time at which the task was last unblocked and this variable is automatically updated within vTaskDelayUntil(). Nevertheless, as you can note, the wrapper don't use a pointer anymore. That is, the local variable couldn't be updated anymore and the function is unusable. Of course, it is easy to fix by ourself, but the file cmsis_os.c from STM32Cube should be updated. I'm not sure that it is the right place for reporting it, but I don't know where to do so... Many thanks in advance for your help. Best regards, BaDuf #freertos #cubemx #cmsis #os2015-02-16 11:21 AM
2015-02-26 02:04 AM
In order to expect a futur fix for this bug, which team is the maintainer of the cmsis wrapper for freeRTOS ?
Indeed, I've also reported this bug on FreeRTOS bug tracker, but they are not responsible of this wrapper. As a consequence, is it ST who provide this for CubeMX or do we need to report it elsewhere ? Thanks in advance.2015-02-27 07:13 AM
Hidufay.basile,
The fix proposed by bagautdinov.anton is OK, and it will be implemented in next release like below:
/**
* @brief Delay a task until a specified time
* @param PreviousWakeTime Pointer to a variable that holds the time at which the
* task was last unblocked. PreviousWakeTime must be initialised with the current time
* prior to its first use (PreviousWakeTime = osKernelSysTick() )
* @param millisec time delay value
* @retval status code that indicates the execution status of the function.
*/
osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec)
{
#if INCLUDE_vTaskDelayUntil
TickType_t ticks = (millisec / portTICK_PERIOD_MS);
vTaskDelayUntil((TickType_t *) PreviousWakeTime, ticks ? ticks : 1);
return osOK;
#else
(void) millisec;
(void) PreviousWakeTime;
return osErrorResource;
#endif
}
Keep an eye out for the next update!
Best regards,
Heisenberg.
2015-06-08 08:09 AM
Hi Heisenberg
I'm using STM32CubeMX version 4.8.0 with the Firmware Package STM32F3 Version 1.1.1 and it seems that this bug still exists in the cmsis_os.c file. Could you confirm this? Kind regards Martin2015-06-12 06:14 AM
Hi all,
Thank you for the reply and the suggested fix. I've just tried with CubeMX v4.8 and STM32F4 package v1.6.0, the issue is still there. As noticed by Cami. When do you plan to release a fixed version ? King Regards, Basile2015-10-20 02:37 AM
Hello,
I have updated Cube MX to the latest version some time a go my osDelayUntil routines stopped working. The software is getting stuck inside it. Previously I used to run this in the loop to make a 1 ms delay:
startTick = xTaskGetTickCount();<
br
>osDelayUntil(startTick, 1);
Now it doesnt work and the program is getting stuck. Has something changed in the osDelayUntil usage? Please help I am stuck with not working project :(.
2015-10-26 04:07 AM
Hi guys,
The bug is already fixed forSTM32CubeF4 v1.9.0, STM32CubeF2 v1.2.0, STM32CubeF0 v1.4.0, STM32CubeF7 v1.2.0, STM32CubeL1 v1.4.0, STM32CubeL4 v1.0.0,STM32CubeF1 v1.2.0and STM32CubeL0 v1.3.0. For STM32CubeF3, the fix will be released in version 1.4.0. The workaround is:osStatus osDelayUntil (uint32_t *PreviousWakeTime, uint32_t millisec)
{
#if INCLUDE_vTaskDelayUntil
TickType_t ticks = (millisec / portTICK_PERIOD_MS);
vTaskDelayUntil((TickType_t *) PreviousWakeTime, ticks ? ticks : 1);
return osOK;
#else
(void) millisec;
(void) PreviousWakeTime;
return osErrorResource;
#endif
}
We are sorry for inconvenience may bring.
-Shahrzad-