Why in tick hook function I can not send a event to a task . MSP430FR5989, IAR7.11, and FreeRTos is 8.2.3

albert6186 wrote on Saturday, May 18, 2019:

Hi, everyone.
I have a question which cost me several days and I still can’t solve it.
I use tick hook function as a timer. My tick interval is 10ms. In my tick hook function, I create a counter as 3 seconds timer. When the counter reaches 3 seconds I will send a task notification to my daemon task.
My problem is the task can’t get that event notification. I have read the vPortTickISR code. At the end of the ISR, there is a call for switchcontext. That is the same as portYield. So I think the event notify should be ok. But, it is not. If I create a 3 seconds timer using xTimerCreate, and in the timer, I send the same event notification to the same task, the notification will be ok. I want to know why to send event notification won’t work in tick hook.
Thank you very much!
The code snippets are here:

////Daemon task
xTaskCreate(Daemon , “Daemon” , 256 , NULL , (tskIDLE_PRIORITY + 1) , &xHandlDaemon);


void Daemon ()
uint32_t ulEventStatus;
for ( ;; )
xTaskNotifyWait(0 , ULONGMAX , &ulEventStatus , portMAX_DELAY);
if(ulEventStatus & Event_3s)



gDaemonTimerCnt = 300;
void vApplicationTickHook( void )
if(gDaemonTimerCnt == 0)
BaseType_t xHigherPriorityTaskWoken = pdFALSE;
extern __no_init TaskHandle_t xHandlDaemon;
xTaskNotifyFromISR( xHandlDaemon , DaemonEvent, eSetBits , &xHigherPriorityTaskWoken );

rtel wrote on Saturday, May 18, 2019:

Looking through the release history I note a change was made in version
9.0.0rc1 - could that be related? Otherwise perhaps an MSP specific
thing, but that would be doubtful.

Search for “If a task notification is used to unblock a task from an
ISR” in https://freertos.org/History.txt to see what I am referring to.

Out of curiosity, why are you using an old version of FreeRTOS?

albert6186 wrote on Sunday, May 19, 2019:

Thank you, Richard. Thank you very much.
I have tried the 10.2.1 version FreeRTOS, and the task notify is ok in the tick hook function. So, the problem has been solved in previous version of FreeRTOS.
Because my project began in early 2016, at that time, the newest version is 8.2.3, I used that version.

Now, the problem is how big the risk is if I upgrade my os from 8.2.3 to 10.2.1? Could you please help?
After 3 years of development, my product will release soon. I very hesitate to upgrade my OS or not.

One more question, I turn off the time slicing (#define configUSE_TIME_SLICING 0), only using preemption. In my application, there is a 250us ADC interrupt, and I do my best to prevent lost ADC interrupt, so I turn off any unnecessary doing. After I turn off the time slicing, my application runs well. But I’m still not sure, do you think that is right?