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

**URL:** <https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808>\
**Category:** Libraries\
**Tags:** debug\
**Created:** [July 12, 2023, 8:06am UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808 "2023-07-12T08:06:28Z")\
**Posts on this page:** 7\
**Page:** 1

<div class="post-metadata">

**Author:** ![Prince](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Prince](https://forums.freertos.org/u/Prince)\
**Post date:** [July 12, 2023, 8:06am UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/1 "2023-07-12T08:06:28Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![jjulich](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/jjulich/32/3232_2.png) [@jjulich](https://forums.freertos.org/u/jjulich)\
**Post date:** [July 12, 2023, 5:18pm UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/2 "2023-07-12T17:18:12Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![Prince](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Prince](https://forums.freertos.org/u/Prince)\
**Post date:** [July 12, 2023, 8:58pm UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/3 "2023-07-12T20:58:54Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [July 13, 2023, 8:27am UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/4 "2023-07-13T08:27:24Z")

</div>

> [@Prince](#):
>
> Note :- I have made changes inside the port.c file and portmacro.h file and made it compatible for the WIN32 port

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

> [@Prince](#):
>
> 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.

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?

---

<div class="post-metadata">

**Author:** ![Prince](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Prince](https://forums.freertos.org/u/Prince)\
**Post date:** [July 13, 2023, 12:22pm UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/5 "2023-07-13T12:22:25Z")

</div>

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](https://forums.freertos.org/uploads/short-url/18zncy1CpMM0EPIslbL6IFL8JKd.c) (20.4 KB)  
[portmacro.h](https://forums.freertos.org/uploads/short-url/ye3i6j0naKoqaKpMjHanwAvwpZ9.h) (6.1 KB)

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

---

<div class="post-metadata">

**Author:** ![aggarg](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/aggarg/32/4245_2.png) [@aggarg](https://forums.freertos.org/u/aggarg)\
**Post date:** [July 13, 2023, 3:58pm UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/6 "2023-07-13T15:58:59Z")

</div>

> [@Prince](#):
>
> 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.

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

> [@Prince](#):
>
> Yes, I was not running my scheduler initially. I am running it now and task notification is working now.

Great! I’ll mark it as resolved then.

---

<div class="post-metadata">

**Author:** ![Prince](https://avatars.discourse-cdn.com/v4/letter/p/ba9def/32.png) [@Prince](https://forums.freertos.org/u/Prince)\
**Post date:** [July 14, 2023, 6:20am UTC](https://forums.freertos.org/t/freertos-vtasknotifygivefromisr-functionality-is-not-notifying-the-task-from-interrupt/17808/7 "2023-07-14T06:20:44Z")

</div>

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