Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r42d74314fb54739936fb9d24d6245613cfab26a0 -r911f6526ec3ba03ba0131681c7fb371c0abda6bb --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 42d74314fb54739936fb9d24d6245613cfab26a0) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 911f6526ec3ba03ba0131681c7fb371c0abda6bb) @@ -282,7 +282,7 @@ // Check for sub-system comm timeouts checkForCommTimeouts(); - // Check ACK list for messages that need to be re-sent because they haven't been ACK'd + // Check ACK list for messages that need to be re-sent because they have not been ACK'd checkPendingACKList(); } @@ -296,7 +296,7 @@ *************************************************************************/ void execSystemCommTx( void ) { - // Do not bother with transmitting if no other nodes on CAN bus + // Do not transmit if no other nodes on CAN bus if ( FALSE == hdIsOnlyCANNode ) { // If CAN transmitter is idle, start transmitting any pending packets @@ -306,7 +306,7 @@ } else { - // Generally, transmitter should not be busy at time of this function call - check timeout just in case so we don't get stuck waiting forever + // Generally, transmitter should not be busy at time of this function call - check timeout just in case so we do not get stuck waiting forever if ( TRUE == didTimeout( lastCANPacketSentTimeStamp, CAN_XMIT_PACKET_TIMEOUT_MS ) ) { // Assume last packet was not successfully transmitted. Re-send last packet. @@ -647,13 +647,12 @@ else { signalCANXmitsCompleted(); - // TODO - should not get here, but let's see if we do - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, (U32)mBox ) + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_SYSTEM_CMMM_CAN_TRANSMIT_REJECTED, (U32)mBox ) } } else - { // TODO - should not get here - just testing - set first data to new s/w fault enum later - SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, (U32)buffer, (U32)dataSize ) + { + SET_ALARM_WITH_2_U32_DATA( ALARM_ID_HD_SOFTWARE_FAULT, SW_FAULT_ID_SYSTEM_COMM_INVALID_FRAME_SIZE, ((U32)buffer << 16) | dataSize ) } } @@ -721,7 +720,7 @@ { U32 numOfBytesInBuffer; - // Assume false so we don't get stuck in loop - only set to true if we find another complete message in buffer + // Assume false so we do not get stuck in loop. Set to true only if we find another complete message in buffer messagesInBuffer = FALSE; // Since messages can have 8-byte alignment padding left unconsumed by last get, get padding out of buffer @@ -733,7 +732,7 @@ U32 bytesPeeked = peekFromCommBuffer( MSG_IN_BUFFERS[ i ], data, MIN( numOfBytesInBuffer, sizeof( MESSAGE_WRAPPER_T ) + 1 ) ); S32 msgSize = parseMessageFromBuffer( data, bytesPeeked ); - hdIsOnlyCANNode = FALSE; // If we are getting a message, we cannot be alone + hdIsOnlyCANNode = FALSE; // Since we are getting a message, this indicates we are not the only node on the CAN bus canXmitRetryCtr = 0; if ( msgSize > 0 ) // Valid, complete message found? @@ -799,7 +798,7 @@ U08 data; U32 numOfBytesInBuffer = numberOfBytesInCommBuffer( buffer ); - // Consume bytes out of buffer 1 at a time until we find the sync byte or it's empty + // Consume bytes out of buffer 1 at a time until we find the sync byte or it is empty while ( numOfBytesInBuffer > 0 ) { peekFromCommBuffer( buffer, &data, 1 ); @@ -848,7 +847,7 @@ msgSize = MESSAGE_OVERHEAD_SIZE + payloadSize; // We now know the size of the message - we can now know if full message is contained in buffer if ( msgSize <= remSize ) - { // Check CRC to make sure it's a valid message + { // Check CRC to make sure it is a valid message if ( data[i+msgSize] == crc8( &data[pos], msgSize - 1 ) ) { result = msgSize; // We found a complete, valid message of this size