Debugger and CAN
Posted: Fri Sep 02, 2011 5:01 pm
I am running some code on a MOD5234 that uses CAN. I've noticed that when debugging through NBEclipse, the CAN works perfectly until the debugger stops the program, and then after continuing execution I won't receive any more CAN messages. When I use taskscan or pause the debugger again, it tells me that the code is always waiting on the CAN fifo. This behavior occurs both when hitting a breakpoint and when using the Suspend button to halt execution. The code is still running, I can interact over the the serial port and access the hosted webpage just fine. Has anyone else experienced this issue or have any ideas for troubleshooting?
Here is the relevant code if it helps. It runs in its own task (prio=49).
Thanks,
David
Here is the relevant code if it helps. It runs in its own task (prio=49).
Code: Select all
J2[41].function( PIN_GPIO );
J2[44].function( PIN_GPIO );
J2[41].hiz();
J2[44].hiz();
J2[39].function( PINJ2_39_CAN0RX );
J2[42].function( PINJ2_42_CAN0TX );
if( CanInit(500000, 0, 4) != CAN_OK )
std::cout << "Error: CAN Failed to intialize" << std::endl;
OS_FIFO fifo;
OSFifoInit(&fifo);
RegisterCanRxFifo(0, &fifo);
while (1)
{
CanRxMessage canRaw(&fifo, 0);
if( canRaw.IsValid() )
{
// Handle the CAN message
}
}
David