# portYIELD\_WITHIN\_API hang

**URL:** <https://forums.freertos.org/t/portyield-within-api-hang/4350>\
**Category:** Kernel\
**Created:** [August 10, 2011, 12:12pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350 "2011-08-10T12:12:25Z")\
**Posts on this page:** 5\
**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:** [August 10, 2011, 12:12pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350/1 "2011-08-10T12:12:25Z")

</div>

**[andreabenoni](https://sourceforge.net/u/andreabenoni/)** wrote on [Wednesday, August 10, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c027bda1/#2438):

I am using RedSuite with last FreeRTOS&nbsp; on a LPC2387.  
I solved some problems related to force supervisor on startup.

Now I have a problem with portYIELD\_WITHIN\_API inside vTaskDelay.  
The run stops on the Yield, I search similar post and I checked:  
- tick is running vPreemptiveTick loops  
- process is moved correctly from running-\>blocked-\>running based on tick

It seems blocked to “SWI 0” instruction.

Thank for your support  
Andrea

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 10, 2011, 1:59pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350/2 "2011-08-10T13:59:43Z")

</div>

**[johandc](https://sourceforge.net/u/johandc/)** wrote on [Wednesday, August 10, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c027bda1/#a6b3):

Check that your software interrupt / exception is running and caught correctly by the appropriate handler.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 10, 2011, 3:12pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350/3 "2011-08-10T15:12:05Z")

</div>

**[andreabenoni](https://sourceforge.net/u/andreabenoni/)** wrote on [Wednesday, August 10, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c027bda1/#c63c):

I checked with debugger and vPreemptiveTick is called, but return always to Yield point of vTaskDelay.  
vApplicationTickHook&nbsp; is correctly called by interupt function.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 10, 2011, 3:49pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350/4 "2011-08-10T15:49:50Z")

</div>

**[andreabenoni](https://sourceforge.net/u/andreabenoni/)** wrote on [Wednesday, August 10, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c027bda1/#6632):

I tried to activate vApplicationIdleHook, it is also executed only one time.  
I tried to trace return from vPreemtiveTick to task moving the pc+4 and it restart to executes until next vTaskDelay.

I am reading Using the FreeRTOS…guide but I am not able to find informations abut Yield should work at low level.  
I am tracing portSAVE\_CONTEXT portRESTORE\_CONTEXT and seems all ok.  
I am trying to understand what should cause the execution of next instruction.

Andrea

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [August 10, 2011, 4:13pm UTC](https://forums.freertos.org/t/portyield-within-api-hang/4350/5 "2011-08-10T16:13:48Z")

</div>

**[andreabenoni](https://sourceforge.net/u/andreabenoni/)** wrote on [Wednesday, August 10, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c027bda1/#5c5a):

Probably I found the problem, I had a wrong SWI pointer, correct is  
\_swi:&nbsp;&nbsp; .word vPortYieldProcessor&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
