# SAM70 call HardFault\_Handler() after xSemaphoreGive()

**URL:** <https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397>\
**Category:** Kernel\
**Created:** [February 9, 2017, 12:32pm UTC](https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397 "2017-02-09T12:32:51Z")\
**Posts on this page:** 4\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 9, 2017, 12:32pm UTC](https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397/1 "2017-02-09T12:32:51Z")

</div>

**[keflex87](https://sourceforge.net/u/keflex87/)** wrote on [Thursday, February 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/f3bac32b/#4b30):

Hallo i use the ATSAME70Q21 and want to use FREERTOS (8.2.3). In my example projekt i have 2 Tasks with a binary semaphore. The first task “task monitor” should notify the second task “task\_led”. I have bebugged my code:

Program sequence while debugging:

1. xSemaphoreGive() was called in task monitor() and went over.
2. xSemaphoreTake() was called in task\_led() and went over.
3. xSemaphoreTake() was called in task\_led() and stoped there.
4. xSemaphoreGive() was called in task monitor() went over and called after that the HardFault\_Handler().

Can you help me? Tank you for your support. Why was the HardFault\_Handler() called? Where ist the problem?

Best regards  
Andre

Code:

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 9, 2017, 12:36pm UTC](https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397/2 "2017-02-09T12:36:47Z")

</div>

**[keflex87](https://sourceforge.net/u/keflex87/)** wrote on [Thursday, February 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/f3bac32b/#81e7):

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [February 9, 2017, 12:37pm UTC](https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397/3 "2017-02-09T12:37:42Z")

</div>

**[keflex87](https://sourceforge.net/u/keflex87/)** wrote on [Thursday, February 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/f3bac32b/#6a32):

Progamm see Appendix

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [February 9, 2017, 4:03pm UTC](https://forums.freertos.org/t/sam70-call-hardfault-handler-after-xsemaphoregive/6397/4 "2017-02-09T16:03:19Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, February 09, 2017](https://sourceforge.net/p/freertos/discussion/382005/thread/f3bac32b/#6a32/2d83):

What does delay\_ms() do? What happens if you replace delay\_ms() with  
vTaskDelay()?
