Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r85bfe5051e4d2bf67be39d394f96c075b4e52836 -r6311eb9b65fdeec7a285d25e07f3932ac0fb6cf1 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 85bfe5051e4d2bf67be39d394f96c075b4e52836) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 6311eb9b65fdeec7a285d25e07f3932ac0fb6cf1) @@ -78,7 +78,6 @@ static U32 sentCANPacketsCount = 0; // TODO - debug - remove these two flags later static U32 compCANPacketsCount = 0; -static CAN_MESSAGE_BOX_T pendingXmitMsgBox = 0; // ********** private function prototypes ********** @@ -251,22 +250,24 @@ *************************************************************************/ void handleCANMsgInterrupt( CAN_MESSAGE_BOX_T srcCANBox ) { - if ( ( TRUE == isCANBoxForXmit( srcCANBox ) ) && ( srcCANBox != pendingXmitMsgBox ) ) - { - srcCANBox = (CAN_MESSAGE_BOX_T)0; - } - // message interrupt is for a transmit message box? if ( TRUE == isCANBoxForXmit( srcCANBox ) ) { U32 bytesXmitted; compCANPacketsCount++; - bytesXmitted = transmitNextCANPacket(); - if ( 0 == bytesXmitted ) + if ( FALSE == canIsTxMessagePending( canREG1, srcCANBox ) ) { - signalCANXmitsCompleted(); + bytesXmitted = transmitNextCANPacket(); + if ( 0 == bytesXmitted ) + { + signalCANXmitsCompleted(); + } } + else + { + compCANPacketsCount--; + } } else if ( TRUE == isCANBoxForRecv( srcCANBox ) ) { @@ -506,8 +507,7 @@ if ( dataSize == CAN_MESSAGE_PAYLOAD_SIZE ) { signalCANXmitsInitiated(); - pendingXmitMsgBox = mBox; - if ( canTransmit( canREG1, mBox, data ) == 0 ) + if ( 0 == canTransmit( canREG1, mBox, data ) ) { signalCANXmitsCompleted(); // TODO - shouldn't get here, but let's see if we do @@ -516,8 +516,8 @@ else { sentCANPacketsCount++; + result = CAN_MESSAGE_PAYLOAD_SIZE; } - result = CAN_MESSAGE_PAYLOAD_SIZE; } else { // TODO - shouldn't get here - just testing - set first data to new s/w fault enum later