fabianlu wrote on Thursday, July 24, 2014:
Hi,
I have started working with FreeRTOS and the PIC32MZ EC StarterKit ( PIC32MZ2048ECH144 onboard ) about a month ago.
I wrote a working application that uses ADC inputs and outputs data to a LCD. The drivers are custom since the XC32 plib is not supported for the MZ family as far as I understood.
At this point i wanted to send data from the application to my PC and store this data in a .txt file to use it i.e. in Excel. For any keywords that came to my mind Google wanted me to use the Harmony Framework with its new plib and drivers. I downloaded Harmony and setup the provided FreeRTOS demo that worked fine. I cleaned this demo application and fit my own application into the Harmony structure.
After I managed it to compile with no errors or warnings, I ran the app and saw …nothing…
Before I start listing any code: I use MPLAB X IDE v2.05, XC32 v1.32 Compiler, MPLAB Harmony v0_80_02b with the stated PIC32MZ2048ECH144 on the EC StarterKit. Before using the integrated FreeRTOS version, my application was running with FreeRTOSV8.0.0
While debugging I found that the application initializes, runs, resets and starts over again from main(). This is caused by a “Simple Tlb Refill Exception” which I caught overwriting the weak _simple_tlb_refill_exception_handler(void) provided by ?! MIPS32 ?!.
I stepped out of this handler and returned to the FreeRTOS queue.c function “xQueueGenericSend( […] )”. Further single step tells me this function is called by a
“xSemaphoreGive( xASemaphoreHandle );” function that is NOT located in an ISR ( unless Harmony does smt. creepy ).
The exact line that throws this exception is:
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
Single step from entering “xQueueGenericSend” function is like the following sequence of code lines ( those are single code lines copied out of the FreeRTOS file queue.c ):
/* first: (Line: 597) */
Queue_t * const pxQueue = ( Queue_t * ) xQueue;
/* than back to: (Line: 595) */
BaseType_t xEntryTimeSet = pdFALSE;
/* than: (Line: 620) */
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
/* than jumps to: (Line: 731) */
prvLockQueue( pxQueue );
/* than: (Line: 739) */
vTaskPlaceOnEventList( &( pxQueue->xTasksWaitingToSend ), xTicksToWait );
/* now back to: (Line: 614) */
taskENTER_CRITICAL();
/* here again: (Line: 620) */
if( ( pxQueue->uxMessagesWaiting < pxQueue->uxLength ) || ( xCopyPosition == queueOVERWRITE ) )
/* and this throws the exception: */
void _simple_tlb_refill_exception_handler( void )
{
Nop();
}
I honestly dont really understand this behaviour thats why im listing it here.
For information: I used heap_4.c since this worked with my application before!
Any suggestions would be highly appreciated.
Thanks
Fabian