I'm using halcogen to setup the DCAN of a TMS570LS20216 and seeing memory leak/corruption after receiving/sending a number of CAN messages.
I have a whole bunch of other things setup and working fine, NHET, HTU, SPI, ADC, RTI. This can run for hours without any memory corruption.
For testing CAN I am sending a single CAN message from an external unit, interrupting and transmitting a message back. This is repeated by clicking a button every few seconds (so load is very low, single frame at a time). After 20 to 50 messages I get a memory corruption of generic variables in RAM. First 20 or so messages work fine.
My 'canMessageNotification()' is this simple test code below:
if((node == canREG1) && (messageBox == canMESSAGE_BOX2)) { if(!canIsRxMessageArrived(node, messageBox)) { return; } canGetData(canREG1, canMESSAGE_BOX2, data); /* copy to RAM */ data[0] = 'T'; data[1] = 'e'; data[2] = 's'; data[3] = 't'; data[4] = '1'; data[5] = '2'; data[6] = '3'; data[7] = '4'; canTransmit(canREG1, canMESSAGE_BOX1, data); return; }
I can't see anything in particular that I'm doing wrong. I've looked through the canTrasmit and canGetData source, and can't see any potential memory leaks.
Is it ok to call canTrasmit from within the interrupt handler?
Any ideas welcome?