2020-12-08 04:12 PM
STM32F407VET6 + STM32CubeIDE + CMSIS_OS2
Latest IDE, w/ FreeRTOS 10.2.1, CMSIS-RTOS 2.00
Touch LCD IRQ on PC_5.
EXTI line[9:5] enabled, code gen enabled, and Call HAL Handler checked.
Event defined. Fails with both dynamic and static Allocation.
Include Param: xEventGroupSetBitFromISR enabled (doesn't work disabled either)
I want to set a flag when the touch interrupt is triggered, then resume a handler thread waiting with osEventFlagsWait().
Anyway, IRQ call succeeds.
but (see comments)
void HAL_GPIO_EXTI_Callback(uint16_t GPIO_Pin)
{
if (GPIO_Pin == Touch_INT_Pin)
{
uint32_t flags = 0x00;
extern osEventFlagsId_t touchEventHandle;
flags = osEventFlagsSet(touchEventHandle, 0x01);
// ^ returns 0x01, as expected.
flags = osEventFlagsGet(touchEventHandle);
// ^ returns 0x00, but should be 0x01
}
. . .
}
debug tracing shows touchEventHandle points to the same heap location as FreeRTOS set up.
Those Set/Get routines work fine within a thread.
I've traced through debug, but am unable to discern why it's not working as I expect. The Set routine dives deep into queue related code, so do Event bits use queues? The Get routine seems simpler and doesn't.
Thanks,
-Abe
2021-01-26 04:45 PM
Did you manage to solve the problem? I have the same issue with STM32l4 CMSIS v2. Setting flags works outside the interrupts.
EDIT: I guess the workaround of this problem is to use osThreadFlag (which works in ISR) that will start a thread, and in this thread you can set EventFlags.
2022-01-04 02:39 PM
I'm having the same issue, if either of y'all figured it out, I would love an update.
kronikary thanks for your EDIT, I'll try it out as a work-around, but would love to be able to set flags.
2022-01-09 12:09 PM
2023-06-01 01:04 PM
Bumping this thread.
I have the same problem, even though the NVIC priorities are configured seemingly properly.
If there are two tasks: A and B.
A's priority is higher than B's.
A is waiting for the eventflags and B is running. The bits in the event flag are set in an IRQ, but the xHigherPriorityTaskWoken flag is false, even though task A is blocked because of this.
If I put an osDelay() into task B, then everything works correctly, but it doesn't make sense as B's priority is already lower and preemption is enabled.
2023-07-12 01:28 PM
Hello there !
Same problem here the osEventFlagSet do not work calling from an ISR, but it worked with osThreadFlagSet.
Any advice on this ?
the documentation say that it is possible to use it inside an ISR.
2023-09-07 12:29 PM
Hi there!
Same problem as everyone:grinning_face_with_sweat:
2024-01-05 07:28 PM - edited 2024-01-05 07:29 PM
For me, the osEventFlagsSet was failing because the timer queue was full.
Within the IOC file's freertos config parmameters, I made the TIMER_QUEUE_LENGTH larger and it fixed the problem.
2024-01-17 09:11 AM
I have the same problem. I read a post on the ARM community forum with the same problem and no solution was given. It seems CMSIS OS events do not work as expected. I will use osThreadFlags, but ST developers shall report this bug so we do not waste hours of time on a not-working library.
Leo
2024-02-09 05:35 AM
This thread helped me and solved my problem that EventFlags sometimes have not been set.
Cheers,
Robert
Why "xEventGroupSetBitsFromISR" sometimes can not set Event? - Kernel - FreeRTOS Community Forums