FreeRTOS vTaskNotifyGiveFromISR() functionality is not notifying the task from Interrupt

I have UART task which is notified from UART IRQHandler () which calls vTaskNotifyGiveFromISR() and then uart message process starts inside the task.

  1. While Running on x86 platform using WIN32. I was trying to write unit test on Visual studio.
  2. From that unit test I called Uart_IRQHandler() and gave the proper UART task handler but the task is not getting notified after calling vTaskNotifyGiveFromISR()

Note :- I have made changes inside the port.c file and portmacro.h file and made it compatible for the WIN32 port
3) Do i need to set some more configuration to enable interrupt to operate in x86 platform

Are you using the WIN32 port to do the unit testing? It is strange that you had to make changes to port.c and portmacro.h for WIN32 compatibility.

Since this is a unit test of the UART task, did you try issuing the notification with xTaskNotifyGive instead of vTaskNotifyGiveFromISR? You are not actually in an ISR for the unit tests and the UART task should operate the same when the notification arrives.

1 Like

My apologies i must be more clear. I have used WIN32 port.c and portmacro.h files from WIN32 demo application itself for unit testing.

  1. There are some checks related to uart header frame length which i needed to perfrom. Although i have managed to pass the handle and notify the task from UART handler which is not correct i assume as i am not inside ISR.
  2. I have tried using xTaskNotifyGive. As in both the cases i have to turn on the scheduler. Here after the completion of the task i am not able to get the control again inside unit tests.
    Let me know if its clear now or i will debug it more and update the problem statement

Thanks

Can you show the changes that you made to these files?

Is your scheduler running when you run the test? Which context do you run your test? Is it possible to describe your test environment more or share code?

  1. I have attached the files i am using I have used WIN32 port.c and portmacro.h files from WIN32 demo application itself for unit testing.

port.c (20.4 KB)
portmacro.h (6.1 KB)

  1. Yes, I was not running my scheduler initially. I am running it now and task notification is working now.

Thanks. I compared them with the files in the same version and there is no significant change - so you are good there.

Great! I’ll mark it as resolved then.

Thanks a lot for the help, Yes you can mark it as solved