Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r329acf53eb90ccf47c5b3f68623b87ec38de5fda -r16b5527af1f1ada72110b030bfcf6054fc9a38b8 --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 329acf53eb90ccf47c5b3f68623b87ec38de5fda) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 16b5527af1f1ada72110b030bfcf6054fc9a38b8) @@ -8,7 +8,7 @@ * @file SystemComm.c * * @author (last) Dara Navaei -* @date (last) 07-Apr-2023 +* @date (last) 20-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 7500 ///< UI has not checked in for this much time +#define UI_COMM_TIMEOUT_IN_MS 5000 ///< 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 250 ///< Maximum time for a Denali message that requires ACK to be ACK'd +#define MSG_NOT_ACKED_TIMEOUT_MS 150 ///< Maximum time for a Denali message that requires ACK to be ACK'd -#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 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 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 @@ -169,9 +169,9 @@ dgIsCommunicating = TRUE; timeOfLastDGCheckIn = getMSTimerCount(); - if ( TRUE == isAlarmActive( ALARM_ID_HD_DG_COMM_TIMEOUT ) ) + if ( TRUE == isAlarmActive( ALARM_ID_DG_COMM_TIMEOUT ) ) { - clearAlarmCondition( ALARM_ID_HD_DG_COMM_TIMEOUT ); + clearAlarmCondition( ALARM_ID_DG_COMM_TIMEOUT ); } } @@ -533,7 +533,7 @@ * Comm Buffers and adds them to the Received Message Queue. * @details Inputs: none * @details Outputs:hdIsOnlyCANNode, rcvMsg, dgIsCommunicating, - * timeOfLastDGCheckIn, timeOfLastUICheckIn, uiDidCommunicate + * timeOfLastDGCheckIn * @return none *************************************************************************/ static void processIncomingData( void ) @@ -593,12 +593,6 @@ 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? { @@ -767,26 +761,17 @@ } } - // Only alarm on DG comm loss while in the treatment workflow - if ( MODE_PRET == opMode || MODE_TREA == opMode || MODE_POST == opMode ) - { - if ( TRUE == didTimeout( timeOfLastDGCheckIn, DG_COMM_TIMEOUT_IN_MS ) ) - { - activateAlarmNoData( ALARM_ID_HD_UI_COMM_TIMEOUT ); - } - } - if ( TRUE == didTimeout( timeOfLastDGCheckIn, DG_COMM_TIMEOUT_IN_MS ) ) { #ifndef RUN_WITHOUT_DG // Only alarm on DG comm loss while in the treatment workflow if ( MODE_PRET == opMode || MODE_TREA == opMode || MODE_POST == opMode ) { - activateAlarmNoData( ALARM_ID_HD_DG_COMM_TIMEOUT ); + activateAlarmNoData( ALARM_ID_DG_COMM_TIMEOUT ); } else // Otherwise clear the alarm { - clearAlarmCondition( ALARM_ID_HD_DG_COMM_TIMEOUT ); + clearAlarmCondition( ALARM_ID_DG_COMM_TIMEOUT ); } dgIsCommunicating = FALSE; #endif @@ -915,14 +900,7 @@ U16 msgID; memcpy( &msgID, (U08*)&pendingAckList[ i ].msg[ sizeof( U08 ) + sizeof( U16) ], sizeof( U16 ) ); - if ( pendingAckList[ i ].channel != COMM_BUFFER_OUT_CAN_HD_2_DG ) - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_BY_UI, (U32)msgID ); - } - else - { - SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED_BY_DG, (U32)msgID ); - } + SET_ALARM_WITH_1_U32_DATA( ALARM_ID_HD_CAN_MESSAGE_NOT_ACKED, (U32)msgID ); pendingAckList[ i ].used = FALSE; // Take pending message off of list } } @@ -1185,6 +1163,12 @@ handleSetHDServiceTime( message ); break; + case MSG_ID_FW_SET_ENTER_BOOTLOADER: + case MSG_ID_FW_ENTER_BOOTLOADER_NOW: + case MSG_ID_FW_REBOOT_NOW: + handleRebootNowRequest( message ); + break; + // NOTE: this always must be the last case case MSG_ID_TESTER_LOGIN_REQUEST: handleTesterLogInRequest( message );