STM32CubeF2 icon indicating copy to clipboard operation
STM32CubeF2 copied to clipboard

Logic in osEventFlagsSet() for xEventGroupSetBitsFromISR() return appears to be inverted

Open josephnobes-stfc opened this issue 2 years ago • 1 comments

Set-up STM32F205 project on custom board using STM32Cube FW_F2 1.9.2 with FreeRTOS middleware enabled (using CMSIS RTOS v2).

Issue When program comes to execute osEventFlagsSet() from within an ISR, it returns osFlagsErrorResource after the flag has been created through the IOC editor.

Under investigation, it seems that the logic in the aforementioned function for handling the return value of xEventGroupSetBitsFromISR() may be inverted. When pdPass is returned to indicate a successful addition of the message to the queue internally, the resonse of the calling function is to report an error, which should be the response to pdFail.

As a comparison, osEventFlagsClear() calls xEventGroupClearBitsFromISR(), but returns the error if the return value is pdFail.

Checking the example code published by FreeRTOS, != pdFail test is used to trigger the yield, therefore I think the behaviour should be as follows:

if (xEventGroupSetBitsFromISR (hEventGroup, (EventBits_t)flags, &yield) != pdFAIL) {
    rflags = flags;
    portYIELD_FROM_ISR (yield);
} else {
    rflags = (uint32_t)osErrorResource;
}

Thanks for the help. I've check that this is still the case in the latest commit to master and can't find anything else about it. If this is the wrong forum for this suggestion please let me know.

josephnobes-stfc avatar Apr 28 '22 17:04 josephnobes-stfc

Hi @josephnobes-stfc,

Thank you for this clear and detailed report. We will forward it to our development teams and get back to you once we have their feedback.

With regards,

ALABSTM avatar Apr 29 '22 08:04 ALABSTM

Hello @josephnobes-stfc,

Thank you for this contribution, this point has been reported to our development teams. I will get back to you as soon as I have any updates.

Best Regards,

HBOSTM avatar May 12 '23 15:05 HBOSTM

ST Internal Reference: 152007

HBOSTM avatar May 12 '23 15:05 HBOSTM

Hello @josephnobes-stfc,

I hope you are fine. The point you have raised has been fixed in the CMSIS-FreeRTOS v10.2.0. Unfortunately, there is no plan to upgrade the FreeRTOS version for STM32CubeF2 .

Please allow me to close this issue. Thank you for your comprehension and thank you again for having reported the point.

With Regards,

TOUNSTM avatar Nov 10 '23 19:11 TOUNSTM