Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r19f13e67288117e7f81c1245a75cc6b5f8aaf899 -r46b16ef94cea2d5db25bfee08457686bc440de23 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 19f13e67288117e7f81c1245a75cc6b5f8aaf899) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 46b16ef94cea2d5db25bfee08457686bc440de23) @@ -7,8 +7,8 @@ * * @file SystemComm.c * -* @author (last) Dara Navaei -* @date (last) 20-Mar-2023 +* @author (last) James Walter Taylor +* @date (last) 31-Mar-2023 * * @author (original) Dara Navaei * @date (original) 05-Nov-2019 @@ -45,15 +45,15 @@ #define CAN_XMIT_PACKET_TIMEOUT_MS 200 ///< If transmitted CAN frame does not cause a transmit complete interrupt within this time, re-send or move on #define MAX_XMIT_RETRIES 5 ///< Maximum number of retries on no transmit complete interrupt timeout -#define UI_COMM_TIMEOUT_IN_MS 5000 ///< UI has not checked in for this much time +#define UI_COMM_TIMEOUT_IN_MS 7500 ///< UI has not checked in for this much time #define DG_COMM_TIMEOUT_IN_MS 1000 ///< DG has not checked in for this much time #define MAX_COMM_CRC_FAILURES 5 ///< Maximum number of CRC errors within window period before alarm #define MAX_COMM_CRC_FAILURE_WINDOW_MS (10 * SEC_PER_MIN * MS_PER_SECOND) ///< CRC error window -#define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd +#define MSG_NOT_ACKED_TIMEOUT_MS 250 ///< Maximum time for a Denali message that requires ACK to be ACK'd -#define MSG_NOT_ACKED_MAX_RETRIES 8 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm +#define MSG_NOT_ACKED_MAX_RETRIES 10 ///< Maximum number of times a message that requires ACK that was not ACK'd can be re-sent before alarm #define PENDING_ACK_LIST_SIZE 25 ///< Maximum number of Denali messages that can be pending ACK at any given time #define MAX_FPGA_CLOCK_SPEED_ERRORS 3 ///< maximum number of FPGA clock speed errors within window period before alarm @@ -533,7 +533,7 @@ * Comm Buffers and adds them to the Received Message Queue. * @details Inputs: none * @details Outputs:hdIsOnlyCANNode, rcvMsg, dgIsCommunicating, - * timeOfLastDGCheckIn + * timeOfLastDGCheckIn, timeOfLastUICheckIn, uiDidCommunicate * @return none *************************************************************************/ static void processIncomingData( void ) @@ -592,6 +592,12 @@ { dgIsCommunicating = TRUE; timeOfLastDGCheckIn = getMSTimerCount(); + } + // If message from UI channel, mark UI communication so HD can begin transmitting + if ( ( COMM_BUFFER_IN_CAN_UI_2_HD == MSG_IN_BUFFERS[ i ] ) || ( COMM_BUFFER_IN_CAN_UI_BROADCAST == MSG_IN_BUFFERS[ i ] ) ) + { + timeOfLastUICheckIn = getMSTimerCount(); + uiDidCommunicate = TRUE; } } else if ( -1 == msgSize ) // Candidate message with bad CRC found? @@ -900,7 +906,14 @@ U16 msgID; memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); + if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_DG ) + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_UI, (U32)msgID ); + } + else + { + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_DG, (U32)msgID ); + } pendingAckList[ i ].used = FALSE; // Take pending message off of list } }