2020-12-08 4: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
2025-10-06 7:19 AM
I had also the same issue with using osEventFlagsSet() in ISR. The link above helped resolve the issue. It's indeed necessary to change default value ( = 2) of TIMER_TASK_PRIORITY to value:
#define configTIMER_TASK_PRIORITY configMAX_PRIORITIES - 1
Why CubeMX generate a default value "2" instead of "MAX_PRIORITIES - 1" ?
Any comments from ST people?