# xSemaphoreGiveFromISR failed?

**URL:** <https://forums.freertos.org/t/xsemaphoregivefromisr-failed/11013>\
**Category:** Kernel\
**Created:** [October 30, 2020, 2:11am UTC](https://forums.freertos.org/t/xsemaphoregivefromisr-failed/11013 "2020-10-30T02:11:39Z")\
**Posts on this page:** 1\
**Showing post:** 7

<div class="post-metadata">

**Author:** ![hs2](https://avatars.discourse-cdn.com/v4/letter/h/a4c791/32.png) [@hs2](https://forums.freertos.org/u/hs2)\
**Post date:** [October 30, 2020, 10:01am UTC](https://forums.freertos.org/t/xsemaphoregivefromisr-failed/11013/7 "2020-10-30T10:01:44Z")

</div>

Sounds like an interrupt priority issue of the timer. Did you call `NVIC_SetPriority` with an appropriate priority somewhere ?  
In addition please see this

> [@Program stuck at "configASSERT" whilst calling "vTaskNotifyGiveFromISR", might be caused by interrupt nesting](https://forums.freertos.org/t/program-stuck-at-configassert-whilst-calling-vtasknotifygivefromisr-might-be-caused-by-interrupt-nesting/11011/2):
>
> You’ve to take care and set interrupt priorities correctly i.e. logically less than or equal to configMAX\_SYSCALL\_INTERRUPT\_PRIORITY if your ISRs make use of the FreeRTOS - API. That’s all about it. You don’t really need to take care about nesting at least regarding FreeRTOS. To get interrupt prios right e.g. on Cortex-M3/4/7 please see [https://www.freertos.org/RTOS-Cortex-M3-M4.html](https://www.freertos.org/RTOS-Cortex-M3-M4.html)

and Richard’s follow up.

You should better not define global variables like `data_ready_sem` in a header file.  
Just declare it `extern SemaphoreHandle_t data_ready_sem;` and define it in one c-file if you want to use it (as a global variable) in multiple c-files later on.  
If it’s intended use is limited to a single c-file (e.g. the timer driver/task module) better define it as `static SemaphoreHandle_t data_ready_sem;` in this c-file.  
Just a hint and to avoid unexpected ‘multiple definitions’ errors if you include the header file in another c-file later on.

---

_[View the full topic](https://forums.freertos.org/t/xsemaphoregivefromisr-failed/11013)._
