PIC32 Problem

bso1 wrote on Wednesday, August 14, 2013:

Hi,

I use the version 7.5.2. PIC32MX-port on a
-DM320004-board, MPLABX-XC32,
-TIMER5 as  tick-timer,
-5 tasks with queues5
-trace with DBPRINTF.
i have the following problem.
- I prepare trace messages from Tasks with va_xxx
- vPortMalloc space for the data
- send message with the pointer to the trace task.
- trace task, Output with DBPRINTF is ok
- then free the mem
this works about 3x, then
at  the next  xQueueReceive(p-> hQID, & m, portMAX_DELAY);

general_exception, _epc_code 0x800414
general_exception_  adr/code/ 0x9D0211C0 / 5
from map-file:
.text.MACMemCopyAsync   0x9d0210fc           0xa4         164  
.text.uxListRemove              0x9d0211a0           0xa0         160  
.rodata                                 0x9d021240           0xa0         160  Read-only const

in Tasks.c line 18622 if( uxListRemove( &( pxCurrentTCB->xGenericListItem ) ) == ( unsigned portBASE_TYPE ) 0 )

-sometimes the Problem occurs during the vPortFree
-sometimes after the first message DBPRINTF
-if I in the same Task:  alloc - DBPRINTF - free , it works always.

anyone an idea ?

rtel wrote on Thursday, August 15, 2013:

How does DBPRINTF work (through a serial port? semi-hosting, etc.)?

Does the code run if you comment out the calls to DBPRINTF (leaving the memory allocation and freeing, just not printing out the message)?

Does the code run if you use the “debug and run” option from the IDE?

Maybe using the MIPS manuals to decode the cause of the exception would help (possible).

Do you have configASSERT() defined?

Are you using stack overflow detection?

Regards.

bso1 wrote on Thursday, August 15, 2013:

DBPRINTF works trough the PIC32MX440F512H USB microcontroller for on-board debugging.on the dm320004.board, MPLABx-ide debuger, usb

-does not run if i disable DBPRINT , compilerswitch

-exception-codes from pic-manual: sometimes  5:address error,store , or 4:address error load/instruction fetch

-configASSERT() defined

-configCHECK_FOR_STACK_OVERFLOW = 2, hook not called,

Regards

hermarcel wrote on Friday, August 16, 2013:

You use TIMER5 as System Tick. Did you change the last lines in vPortIncrementTick() in file Source\portable\MPLAB\PIC32MX\port.c from

/* Clear timer 1 interrupt. */
	IFS0CLR = _IFS0_T1IF_MASK;

to

/* Clear timer 5 interrupt. */
	IFS0CLR = _IFS0_T5IF_MASK;

bso1 wrote on Friday, August 16, 2013:

i use
mT5ClearIntFlag();