PIC32MZ UART RX crashes prvIdleTask

arhancock wrote on Tuesday, March 28, 2017:

I am porting our application form a custom PIC32MX board to a new custom PIC32MZ board. I am using Microchip’s Harmony 2.01b and FreeRTOS 9.x. I have two uarts configured in the project (UART 1 and 3). Both are transmitting okay. When I receive a character form UART 3, I get a general exception at an address that is in the middle of prvIdleTask.
Being failry new to Harmony and FreeRTOS, I am at a loss at to how to debug this. I have tried increasing various stack sizes - no difference, and different Harmony usart models (Byte mode and Buffer queue mode) - not difference.

Any ideas?

rtel wrote on Tuesday, March 28, 2017:

Is it the case that your application code runs ok on the old board, but
the exact same code does not run on the new board? If so, then the
first question would be what is different about the boards? Are the
PIC32 devices the same on both?

If you think there is a stack overflow then the easiest thing to do is
ensure stack overflow detection is turned on:


arhancock wrote on Thursday, March 30, 2017:

The boards are significantly different, starting with the PIC. The old one is PIC32MZ695F512L and the new one is PIC32MZ2048EFH144. I/O has been reorganized around the new PICs I/O ports. The serial ports remain the same. The application is normally flashed with a custom USB based boot loader, residing in the lower part of program flash space. A linker script is used in the application build to move the application up 256K.
If the application is build with the default linker script and flashed with a programmer, rather than with the boot loader, the serial RX works correctly.
Analyzing the load maps between the two versions has not revealed anything helpful.
Is there anything in FreeRTOS that needs to be adjusted for vector tables that have moved?

rtel wrote on Friday, March 31, 2017:

Not sure specifically for the PIC32 without cracking out the MIPS
manuals to remind myself, but often devices require a register to be set
to to the base address of the vector table. If the vector table is
moved then the bootloader should setup the required registers before
calling the application code.

arhancock wrote on Friday, March 31, 2017:

The boot loader jumps to a copy of the reset code in the application - effectively rebooting the PIC at the application’s location. Again, many of the inerrupts are working, its just that UART TX event that trashes the system - event before the ISR get called.

arhancock wrote on Friday, March 31, 2017:

I found that if I move the ebase_addr in the linker script to place the IVT 64K above reset (rather than the 4K I had it at), the error goes away.