BTW: I have preemption enabled so I believe FreeRTOS shall switch task
as soon as new item is send to the queue…
That is true for when the queue is written to from a task, so the yield
is not needed there, but it is not true when the queue is written to
from an interrupt. Sometimes more control is needed in interrupts - for
example if you get an interrupt each time a character is received on a
UART you might not want to switch immediately to the handling task
unless you know the last character received was the end of the message.
Hi, I’m afraid that we’ve come to a point here where there is not enough information to find the root cause.
I noticed that the FreeRTOS functions and objects are wrapped into a library. I assume that is not introducing a problem?
If you can send me a simple but complete project that shows the failure, I can test it on my STM32F.
You can use this email address: “h [point] tibosch [at] freertos [point] org” to send me code directly.
But I can not give support on the libraries ( HAL / OS-layer ) that you are using, only direct calls ( API’s ) to the FreeRTOS kernel.
OK, I will prepare extra simplified project you can run on your STM. My project is strictly based on template generated from CubeMX (FreeRTOS 9.0.0 is modified by STM and some functions are wrapped by CMISIS).
I ve prepared simplified project to demonstrate problem. Project template was generated with STM32CubeMX, it contains 3 tasks (main A and two higher priority B and C). B and C are blinking LEDs on the board.Queue of A is feed from ISR, queue of B is feed from A and queue of C is feed from ISR.
Task A (normal priority is working as expected), B and C are freezing on xQueueReceive(…, portMAX_DELAY).
I’m not familiar with the abstraction layer used, so would have to
look at the documentation to see if it was used correctly, and the
implementation to see if it was implemented correctly (neither of which
I have time to do ;o) That limits the support that can be provided as
its not easy to support other people’s code.
I note the assert function is implemented to do nothing but return.
If that assert function is called in response to assert failures within
FreeRTOS then it needs to be implemented to halt operation as assert
failures within FreeRTOS are unrecoverable.
Is STM32Cube generating C++ code, or is that your code? I see calls
such as: SendToMainTask(msg_t(MUserBtn), true); that, inside the
function, use the address of the msg_t object.
I ve prepared simplified project to demonstrate problem. Project
template was generated with STM32CubeMX, it contains 3 tasks (main A and
two higher priority B and C). B and C are blinking LEDs on the
board.Queue of A is feed from ISR, queue of B is feed from A and queue
of C is feed from ISR.
Task A (normal priority is working as expected), B and C are freezing on
xQueueReceive(…, portMAX_DELAY).
I’ve removed xQueueReceive()/xQueueSend() and changed IPC mechanism to xTaskNotify()/xTaskNotifyWait() and it seems to solve freezing issues. However “queue” has only 1 element of uint32_t, so it is easy to lose send information… I believe there is some bug in reschedule of higher priority tasks waiting on xQueueReceive()…
I believe there is some bug in reschedule of higher
priority tasks waiting on xQueueReceive()…
That is unlikely (although of course not impossible) as the reschedule
mechanism is the same in both cases, and that code is mature plus tested
by ourselves. I think there is something else going on that we haven’t
discovered yet.
I mean that xQueueSend() do not wake higher priority task wating opposite to xTaskNotify() which works as expected… I’m quite happy with xTaskNotify() however it is intresting why queue version doesn’t work im my case… Maybe problem with ST port within MxCube?
PS: is it possible to clear notification bits one by one (when processed) not in one call?