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

pnk004 wrote on Tuesday, November 27, 2018:

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.

rtel wrote on Tuesday, November 27, 2018:

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.

pnk004 wrote on Tuesday, November 27, 2018:

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.

pnk004 wrote on Wednesday, November 28, 2018:

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-

Thank you very much.