STMicroelectronics / STM32CubeF2

STM32Cube MCU Full Package for the STM32F2 series - (HAL + LL Drivers, CMSIS Core, CMSIS Device, MW libraries plus a set of Projects running on all boards provided by ST (Nucleo, Evaluation and Discovery Kits))
Other
44 stars 25 forks source link

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

Closed josephnobes-stfc closed 11 months ago

josephnobes-stfc commented 2 years ago

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.

ALABSTM commented 2 years ago

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,

HBOSTM commented 1 year ago

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 commented 1 year ago

ST Internal Reference: 152007

TOUNSTM commented 11 months ago

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,