matt-oes wrote on Tuesday, December 09, 2008:
I have been somewhat randomly receiving an exception while in vListRemove. Here is my stack list:
prvIdleTask
prvCheckTasksWaitingTermination
vUART2InterruptHandler (this is the ISR)
UartHandler (collectively handles each port)
xQueueGenericSendFromISR (called when I am moving a byte from the uart to the character queue)
xTaskRemoveFromEventList
vListRemove
The reason for the failure is in vListRemove the following line:
[code]
pxList = ( xList * ) pxItemToRemove->pvContainer;
[/code]
Which is followed by:
[code]
if(pxList-pxIndex == pxItemToRemove)…
[/code]
which throws the actual exception. The reason it throws the exception is that pxItemToRemove->pvContainer equals 0xA5A5A5A5 wwhich indicates crap memory, so when pxList is assigned to this crap memory, it is now crap and the if statement explodes.
Since most of this code is stock, i will only copy over my own ccode to show what I am doing (the UartHandler is modified from the demo)
[code]
__declspec(interrupt:0) void vUART2InterruptHandler( void )
{
UartHandler( serCOM3 );
}
/*-----------------------------------------------------------*/
void UartHandler( eCOMPort ePort)
{
unsigned portCHAR ucChar;
portBASE_TYPE xHigherPriorityTaskWoken = pdFALSE, xDoneSomething = pdTRUE;
while( xDoneSomething != pdFALSE )
{
xDoneSomething = pdFALSE;
/* Does the tx buffer contain space? */
if( ( MCF_UART_USR(ePort) & MCF_UART_USR_TXRDY ) != 0x00 )
{
/* Are there any characters queued to be sent? */
if( xQueueReceiveFromISR( xCharsForTx[ePort], &ucChar, &xHigherPriorityTaskWoken ) == pdTRUE )
{
/* Send the next char. */
MCF_UART_UTB(ePort) = ucChar;
xDoneSomething = pdTRUE;
}
else
{
/* Turn off the Tx interrupt until such time as another character
is being transmitted. */
MCF_UART_UIMR(ePort) = serRX_INT;
xTxHasEnded[ePort] = pdTRUE;
}
}
if( MCF_UART_USR(ePort) & MCF_UART_USR_RXRDY )
{
ucChar = MCF_UART_URB(ePort);
xQueueSendFromISR( xRxedChars[ePort], &ucChar, &xHigherPriorityTaskWoken );
xDoneSomething = pdTRUE;
}
}
portEND_SWITCHING_ISR( xHigherPriorityTaskWoken );
}
[/code]
This code can be run successfully hundreds of times, but if i sneeze it will fail. That is to say, it could fail if i am streaming messages too quickly, or if i enable or disable a breakpoint in some unrelated code.
What’s going on? I am sure i’m leaving much to be desired in my explanation, so please, ask for any additional info.
Thanks,
Matt
oh yeah, it is throwing the following exception:
[code]
VECTORDISPLAY("Error on operand read\n");
[/code]