# PIC32 -\> xQueueReceive hangs second time

**URL:** <https://forums.freertos.org/t/pic32-xqueuereceive-hangs-second-time/4460>\
**Category:** Kernel\
**Created:** [August 15, 2011, 8:53am UTC](https://forums.freertos.org/t/pic32-xqueuereceive-hangs-second-time/4460 "2011-08-15T08:53:18Z")\
**Posts on this page:** 2\
**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 15, 2011, 8:53am UTC](https://forums.freertos.org/t/pic32-xqueuereceive-hangs-second-time/4460/1 "2011-08-15T08:53:18Z")

</div>

**anonymous** wrote on [Monday, August 15, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c2604c26/#775f):

I’m using version 7.0.1, I start 9 task with success, I can trigger them with a network package and queues. Now when I start a long running task, when I exit the FSM and come in the main for(;😉 with the  
xStatus = xQueueReceive(xQueueTransport, &action, portMAX\_DELAY);  
if ( xStatus == pdPASS)  
It hangs in the vListInsert.  
for 1. I checked the stack overflow and the code never comes to the hooks.  
for 2. I have  
#define configKERNEL\_INTERRUPT\_PRIORITY 0x01  
#define configMAX\_SYSCALL\_INTERRUPT\_PRIORITY 0x04  
#define configMAX\_PRIORITIES ( ( unsigned portBASE\_TYPE ) 6 )  
for 3. with the other task I have no problems (don’t run for \>15sec)  
for 4.&nbsp; The first time the task is started, but when it returns it hangs. I have put a stacksize of 4096 for this task and a total\_heap\_size 56000.

I’m out of ideas to fix this, what can I check to solve this issue?  
Previous when I hit this part of freetos, I needed to increase the heap or minimal\_stack\_size. But nothing seems to fix this issue. I tried to max out these two values without success

---

<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:** [August 18, 2011, 10:18am UTC](https://forums.freertos.org/t/pic32-xqueuereceive-hangs-second-time/4460/2 "2011-08-18T10:18:54Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Thursday, August 18, 2011](https://sourceforge.net/p/freertos/discussion/382005/thread/c2604c26/#20ff):

Without being sat at your desk and able to debug this I’m not sure what advice I can offer.&nbsp; However, I’m curious about your statement “for 4.&nbsp; The first time the task is started, but when it returns it hangs” - are you attempting to return from a task?&nbsp; That would definitely cause a crash, there is nothing to return to.&nbsp; If you want to end a task call vTaskDelete( NULL );

Regards.
