Im using stm32f107vc on easymxprov7 board with mikroC IDE. My freeRTOS is v9.0.0 provided by mikroC. Currently i have a problem using xTaskGenericNotifyFromISR for my USART1. The program stuck and my LED task does not blink. But when I changed to xTaskGenericNotify which it should not be called in ISR, its works. Im confused right now.
The Direct To Task Notification API is published here RTOS task notification API functions - the function you are calling (with Generic in its name) is one of the functions used by that API, not something it is intended you call yourself. That said, the way you are calling it doesn’t seem to be wrong. Can you step into the function and see why it is failing? When you stop the code in the debugger after the failure, what is it doing?
More recent Cortex-M ports for other compilers contain a lot of additional configASSERT() calls to trap common configurations in the interrupt priority settings - it is doubtful your version will have those, so I would recommend looking through these pages to see if you can ensure your interrupt priorities are set correctly: RTOS for ARM Cortex-M Additionally, have you done things like ensure stack overflow detection is turned on, etc.? FreeRTOS - Open Source RTOS Kernel for small embedded systems
Priority “1” is actually a very high interrupt priority – too high for making system calls. The link Richard provided explains that lower numbers give higher priorities. In your case, “3” is the maximum priority allowed for system calls (configMAX_SYSCALL_INTERRUPT_PRIORITY being 0x30).
Im not so clear here. This is my case that i have tested.
Case 1
configMAX_SYSCALL_INTERRUPT_PRIORITY being 0x30
NVIC_SetIntPriority(IVT_INT_USART1, _NVIC_INT_PRIORITY_LVL1);
xTaskGenericNotify(xCmd_TaskHandle, NULL, eNoAction, &xHigherPriorityTaskWoken);
Result - Works fine
Case 2
configMAX_SYSCALL_INTERRUPT_PRIORITY being 0x30
NVIC_SetIntPriority(IVT_INT_USART1, _NVIC_INT_PRIORITY_LVL1);
xTaskGenericNotifyFromISR(xCmd_TaskHandle, 0, eNoAction, NULL, &xHigherPriorityTaskWoken);
Result - debugging goes to (configASSERT(ucCurrentPriority >= ucMaxSysCallPriority)
Case 3
configMAX_SYSCALL_INTERRUPT_PRIORITY being 0x30
NVIC_SetIntPriority(IVT_INT_USART1, _NVIC_INT_PRIORITY_LVL5);
xTaskGenericNotify(xCmd_TaskHandle, NULL, eNoAction, &xHigherPriorityTaskWoken);
Result - my uart terminal dont respond to the command received and it will continue printing RTC
What is my solution if i want to use this xTaskGenericNotifyFromISR?
Okay seems like the problem is FreeRTOS priority. I have created LED task, RTC task & USART task. I set priority LED to 5 & USART to 5 & comment out RTC task create. Works fine. Then i create RTC task with priority 1 & my uart terminal only print rtc value & do not respond to my command. What is suitable way to solve my problem? Thanks in advanced.