# I have a problem in using FreeRTOSv10.1.1. The MCU is iteratively rebooting and not executing task function.

**URL:** <https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551>\
**Category:** Kernel\
**Created:** [November 27, 2018, 11:33am UTC](https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551 "2018-11-27T11:33:35Z")\
**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:** [November 27, 2018, 11:33am UTC](https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551/1 "2018-11-27T11:33:35Z")

</div>

**[pnk004](https://sourceforge.net/u/pnk004/)** wrote on [Tuesday, November 27, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/dc22bfd1d9/#52f9):

I have a problem in using FreeRTOSv10.1.1.

The MCU is iteratively rebooting and not executing task function.

I am using dsPIC33CK256mp508 MCU. The development tool is MPLAB X IDE v5.10.

The freeRTOS supports dsPIC33FJ256GP710 MCU and not supports dsPIC33CK256mp508 MCU.

So, I changed the FreeRTOS as follows for the dsPIC33CK256mp508 MCU.

1. In port.c and portasm\_dsPIC.S, I added " || defined( **dsPIC33C** )" in the source code.

2. The PIC33CK has not PSVPAG register. So I replaced the PSVPAG with DSRPAG register.

The MCU is rebooing after executing main() -\> vTaskStartScheduler(() -\> xPortStartScheduler() -\> portRESTORE\_CONTEXT().

If I add extra code after portRESTORE\_CONTEXT(), the MCU does not rebooting but does not execute task functions.

I used the stack size of LED task function as 512 (which is sufficient).

I used the STACK GROWTH definition as follows. Would you check it is right?

```
   #define portSTACK_GROWTH 1

```

I will really appreciate if I can be given any advice and solutions.

Thank you very much.

Sincerely Yours,

Ick-Sung Choi.

---

<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:** [November 27, 2018, 5:17pm UTC](https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551/2 "2018-11-27T17:17:09Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Tuesday, November 27, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/dc22bfd1d9/#52f9/5c23):

> ```
> The PIC33CK has not PSVPAG register. So I replaced the PSVPAG with
> DSRPAG register.
> 
> ```

So is this an ESD part? The FreeRTOS port uses the **HAS\_EDS**  
definition to switch between pushing and popping the PSVPAG register, or  
alternatively pushing and popping both the DSRPAG and DSWPAG registers.  
It is quite a while since I’ve looked at these details.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 27, 2018, 11:24pm UTC](https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551/3 "2018-11-27T23:24:55Z")

</div>

**[pnk004](https://sourceforge.net/u/pnk004/)** wrote on [Tuesday, November 27, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/dc22bfd1d9/#2419):

I did not define **HAS\_EDS** , but it is defined by system (compliler).

In the source code, there is a comment that “dsPIC parts(dsPIC33CK256mp) with EDS are not supported”.

I tried to undeclare the \_HAS\_EDS definition in the source code.

The rebooting does not happen. But the task does not executed.

Can I disable EDS in the dsPIC33CK256mp and MPLAB X IDE compiler?

How can I solve the problem?

Thank you very much.

---

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [November 28, 2018, 1:29am UTC](https://forums.freertos.org/t/i-have-a-problem-in-using-freertosv10-1-1-the-mcu-is-iteratively-rebooting-and-not-executing-task-function/7551/4 "2018-11-28T01:29:44Z")

</div>

**[pnk004](https://sourceforge.net/u/pnk004/)** wrote on [Wednesday, November 28, 2018](https://sourceforge.net/p/freertos/discussion/382005/thread/dc22bfd1d9/#735f):

I have solved the problem.

After using the source code in the following link, it works well.

[https://interactive.freertos.org/hc/en-us/community/posts/210026846-FreeRTOS-V8-2-0-port-for-ALL-16-bit-PICs-with-hardware-stack-checking-SPLIM-](https://interactive.freertos.org/hc/en-us/community/posts/210026846-FreeRTOS-V8-2-0-port-for-ALL-16-bit-PICs-with-hardware-stack-checking-SPLIM-)

Thank you very much.
