Problem moving from pic32MX360 to pic32MX575

steveb75 wrote on Saturday, December 04, 2010:

Hi All.

Have put together several tasks, some tasks using UART/DMA/Interrupts and is running fine using the pic32 starter kit with pic32MX360F512L.

Having problems trying to run the exact same code using pickit-3 with pic32MX575F512L.  The _general_exception_handler
is called regardless of what I try.  For example I have removed all tasks but 1 and the task is simplified to just spin in a loop.  When starting the code, after a few seconds I hit a breakpoint set in the _general_exception_handler.

If removing all tasks, Queues, Sem declarations/definitons and just calling prvSetupHardware() to init clocks, disable interrupts etc, followed by vTaskStartScheduler(), same thing happens.

If I remove vTaskStartScheduler() and just spin in a loop e.g while (TRUE) { i++; }, it seems happy i.e. don’t hit the breakpoint in _general_exception_handler().  Note this all in main() and the correct device is selected under the IDEs Configure->Select Device tab…

I have looked at the exception codes but can’t determine anything from it:-
Status  = 0x103
Cause = 0x8080041C
According to the M4K software user guide, the exception code (41C => 28 based on the bit mapping) is a reserved value….

A friend who is also using the same pickit-3/pic32MX575F512L setup is running similar/standalone code (i.e. without freeRTOS) and has no problems.

One other observation is during initial debugging I noticed the time to step over code/functions seemed very slow when compared to using the pic starter kit/pic32MX360F512L.  Not sure if this is just normal behaviour of the pickit-3 but I would expect the hardware config to be the same for both platforms along with the response/speed.

Any help/advice would greatly appreciated.


steveb75 wrote on Saturday, December 04, 2010:

Correction to above:

The exception code is 0x1C not 0x41C and equates to 7 not 28.

Exception type is DBE: Bus error exception (data reference: load or store)

davedoors wrote on Saturday, December 04, 2010:

I don’t know if this is the solution to your problem, but is something to check. It has tripped people before.

The newer PIC32 devices need different pragma definitions (fuse bit settings maybe, from memory of older PICs?). If you look at the pragmas at the top of main.c for the demo in FreeRTOS\Demo\PIC32MX_MPLAB of the official download you will see this

#pragma config POSCMOD = HS, FNOSC = PRIPLL, FPBDIV = DIV_2

In the book examples, which use a different and newer PIC32 device, you will see this

#pragma config FPLLODIV = DIV_1, FPLLMUL = MUL_20, FPLLIDIV = DIV_2
#pragma config FSRSSEL = PRIORITY_7

The FSRSSEL setting does not exist in the early PIC32 chips, but is essential in the newer ones.

steveb75 wrote on Saturday, December 04, 2010:

Nice one Dave!

Seems to be working fine now after adding FSRSSEL = PRIORITY_7.  Do you happen to know where this is defined? I’d like to find out what it does… Can’t seem to locate it in the reference manual(s).

Stepping over instructions/functions still seems quite slow but will revisit later.

Thanks again!


pistole89 wrote on Thursday, June 09, 2011:

Hi Steve,

I also have the same problem. I used PIC32 Starter kit (PIC32MX360F512L)
However, when I add #pragma config FSRSSEL = PRIORITY_7
It cannot be built.

my compiler is c32 v1.05 , MPLAB IDE v8.60

Which compiler do you use ?

I will really appreciate your help.