Index: firmware/App/Common.h =================================================================== diff -u -r292265111b911fa79c52bb4589911dfb60c921bf -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Common.h (.../Common.h) (revision 292265111b911fa79c52bb4589911dfb60c921bf) +++ firmware/App/Common.h (.../Common.h) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -14,18 +14,19 @@ // ********** public definitions ********** -#define NUM_OF_FW_STACKS 3 ///< Number of firmware stacks (TD, DD, RO). -#define CAN_MESSAGE_PAYLOAD_SIZE 8 ///< CAN message payload size in bytes. +#define NUM_OF_FW_STACKS 2 ///< Number of firmware stacks (TD, DD). +#define CAN_MESSAGE_FRAME_SIZE 8 ///< CAN message frame size in bytes. #define FIRMWARE_START_ADDRESS 0x00010000 ///< Firmware start address. #define FIRMWARE_CRC_TABLE_ADDRESS 0x10020 ///< The starting address of CRC table for firmware image. #define SW_UPDATE_FLASH_BUFFER_SIZE 256 ///< Software update flash buffer bytes. -#define MASK_OFF_MSB 0x00FF ///< Bits to mask off the most significant byte of a 2-byte word -#define MASK_OFF_LSB 0xFF00 ///< Bits to mask off the least significant byte of a 2-byte word -#define SHIFT_8_BITS_FOR_BYTE_SHIFT 8 ///< Number of bits to shift in order to shift a byte -#define MASK_OFF_NIBBLE_MSB 0x0F ///< Bits to mask off the most significant nibble of a byte +#define MASK_OFF_MSB 0x00FF ///< Bits to mask off the most significant byte of a 2-byte word. +#define MASK_OFF_LSB 0xFF00 ///< Bits to mask off the least significant byte of a 2-byte word. +#define SHIFT_8_BITS_FOR_BYTE_SHIFT 8 ///< Number of bits to shift in order to shift a byte. +#define MASK_OFF_NIBBLE_MSB 0x0F ///< Bits to mask off the most significant nibble of a byte. +#define SW_UPDATE_LEN_MSB_INDEX 3 ///< Software update payload length most significant byte. +#define SW_UPDATE_LEN_LSB_INDEX 2 ///< Software update payload length least significant byte. +#define NUM_OF_CMD_CAN_FRAMES 1 ///< Number of command CAN frames. -#define NUM_OF_CMD_CAN_FRAMES 1 ///< Number of command CAN frames. - #define GET_LSB_OF_WORD(w) ((U08)((w) & MASK_OFF_MSB)) ///< Macro returns the least signficant byte of a 2-byte word. #define GET_MSB_OF_WORD(w) ((U08)(((w) >> SHIFT_8_BITS_FOR_BYTE_SHIFT) & MASK_OFF_MSB)) ///< Macro returns the most signficant byte of a 2-byte word. #define MAKE_WORD_OF_BYTES(h, l) ((((U16)(h) << SHIFT_8_BITS_FOR_BYTE_SHIFT) & MASK_OFF_LSB) \ @@ -82,12 +83,13 @@ /// Software update CAN mailboxes enumeration typedef enum SW_Update_CAN_Mail_Boxes { - SW_UPDATE_NOT_USED = 0, // 0 ///< Software update not used mailbox. + SW_UPDATE_NOT_USED = 0, // 0x000 ///< Software update not used mailbox. SW_UPDATE_COMMAD, // 0x601 ///< Software update command mailbox. - SW_UPDATE_FW_RESP, // 0x602 ///< Software update firmware respond mailbox. + SW_UPDATE_TD_RESP, // 0x602 ///< Software update TD respond mailbox. SW_UPDATE_TD_UPDATE, // 0x603 ///< Software update TD update mailbox. - SW_UPDATE_DD_UPDATE, // 0x604 ///< Software update DD update mailbox. - SW_TEST, // 0x605 // TODO remove + SW_UPDATE_DD_RESP, // 0x604 ///< Software update DD respond mailbox. + SW_UPDATE_DD_UPDATE, // 0x605 ///< Software update DD update mailbox. + SW_UPDATE_TD_BROADCAST, // 0x606 ///< Software update TD broadcast mailbox. NUM_OF_SW_UPDATE_MBOXES, ///< Number of software update mailboxes. } SW_UPDATE_CAN_MAIL_BOX_T; Index: firmware/App/Services/CommBuffers.c =================================================================== diff -u -r0c085209bea23f66011059a7c19796c1e4b246fa -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision 0c085209bea23f66011059a7c19796c1e4b246fa) +++ firmware/App/Services/CommBuffers.c (.../CommBuffers.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -11,11 +11,12 @@ // ********** private definitions ********** -#define UPDATE_PACKET_SIZE_BYTES ( SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_PAYLOAD_SIZE ) ///< Software update packet size in bytes. +#define UPDATE_PACKET_SIZE_BYTES ( SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_FRAME_SIZE ) ///< Software update packet size in bytes. /// Software update buffer structure typedef struct { + U32 SWUpdateNumOfFramesCount; ///< Software update number of frame count. U32 SWUpdateFrameCount; ///< Software update frame count. U08 SWUpdateBuffer[ UPDATE_PACKET_SIZE_BYTES ]; ///< Software update buffer. } SW_UPDATE_BUFFER_T; @@ -66,13 +67,42 @@ U32 currentFrameCount = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount; // Check if the number of bytes is less than the allowed bytes in the mailbox buffer. - if ( ( currentFrameCount * CAN_MESSAGE_PAYLOAD_SIZE ) <= UPDATE_PACKET_SIZE_BYTES ) + if ( ( currentFrameCount * CAN_MESSAGE_FRAME_SIZE ) <= UPDATE_PACKET_SIZE_BYTES ) { U32 currentBufferIndex = currentFrameCount * len; // Copy the received can frame into the buffer memcpy( SWUpdateBuffer[ mailBox ].SWUpdateBuffer + currentBufferIndex, data, len ); + switch ( mailBox ) + { + case SW_UPDATE_COMMAD: + // A command is only 1 frame of 8 bytes. + SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount = NUM_OF_CMD_CAN_FRAMES; + break; + + case SW_UPDATE_TD_UPDATE: + case SW_UPDATE_DD_UPDATE: + if ( 0 == SWUpdateBuffer[ mailBox ].SWUpdateFrameCount ) + { + // If the received command is a software update mailbox and if the frame count is 0, so it is the overhead frame. + // In the overhead frame the 2nd and 3rd bytes are payload length and the two payloads are bitwised to get the payload length. + U08 updatePayloadLenMSB = SWUpdateBuffer[ mailBox ].SWUpdateBuffer[ SW_UPDATE_LEN_MSB_INDEX ]; + U08 updatePayloadLenLSB = SWUpdateBuffer[ mailBox ].SWUpdateBuffer[ SW_UPDATE_LEN_LSB_INDEX ]; + U16 updatePayloadLength = updatePayloadLenMSB << SHIFT_8_BITS_FOR_BYTE_SHIFT | updatePayloadLenLSB; + // Per the payload length, calculate the number of frames of 8 bytes that are needed to receive the entire update message. + // Round up the number of frames with (payload length + 1 can frame (8 bytes) - 1) / 1 can frame (8 bytes) + // After calculating the number of frames needed to receive the entire update payload add one more frame for the overhead frame. + SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount = ( updatePayloadLength + CAN_MESSAGE_FRAME_SIZE - 1 ) / CAN_MESSAGE_FRAME_SIZE; + SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount += 1; + } + break; + + default: + // Do nothing. There are other mailboxes that do not need to be processed. + break; + } + // Increment the current frame count SWUpdateBuffer[ mailBox ].SWUpdateFrameCount += 1; status = TRUE; @@ -115,23 +145,44 @@ /*********************************************************************//** * @brief - * The getNumberOfBytesInBuffer function determines how many bytes - * are currently contained in a given comm buffer. + * The isMessageComplete function checks whether a message (command or update) + * has been fully received. * @details Inputs: SWUpdateBuffer[] * @details Outputs: none - * @param mailbox ID of buffer to get byte count for - * @return the number of bytes currently in the given comm buffer. + * @param mailbox ID of buffer to check the completeness of the message + * @return TRUE if the messages has been fully received, otherwise FALSE *************************************************************************/ -S32 getNumberOfBytesInBuffer( SW_UPDATE_CAN_MAIL_BOX_T mailBox ) +BOOL isMessageComplete( SW_UPDATE_CAN_MAIL_BOX_T mailBox ) { - S32 bytes = -1; + BOOL status = FALSE; + U32 frameCnt = 0; + U32 numOfFramesCnt = 0; - if ( mailBox < NUM_OF_SW_UPDATE_MBOXES ) + switch ( mailBox ) { - bytes = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount * CAN_MESSAGE_PAYLOAD_SIZE; + case SW_UPDATE_COMMAD: + frameCnt = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount; + numOfFramesCnt = SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount; + break; + + case SW_UPDATE_TD_UPDATE: + case SW_UPDATE_DD_UPDATE: + frameCnt = SWUpdateBuffer[ mailBox ].SWUpdateFrameCount; + numOfFramesCnt = SWUpdateBuffer[ mailBox ].SWUpdateNumOfFramesCount; + break; + + default: + // Do nothing. There are other mailboxes that do not need to be processed. + break; } - return bytes; + // Check if the frame count is not 0 meaning that at least one frame is received prior to checking for the completion. + if ( ( frameCnt > 0 ) && ( frameCnt == numOfFramesCnt ) ) + { + status = TRUE; + } + + return status; } /*********************************************************************//** Index: firmware/App/Services/CommBuffers.h =================================================================== diff -u -r0c085209bea23f66011059a7c19796c1e4b246fa -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision 0c085209bea23f66011059a7c19796c1e4b246fa) +++ firmware/App/Services/CommBuffers.h (.../CommBuffers.h) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -24,7 +24,7 @@ BOOL getCommBuffer( SW_UPDATE_CAN_MAIL_BOX_T mailBox, U08* data, U32 len ); -S32 getNumberOfBytesInBuffer( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); +BOOL isMessageComplete( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); void clearCommBuffer( SW_UPDATE_CAN_MAIL_BOX_T mailBox ); Index: firmware/App/Services/Download.c =================================================================== diff -u -r292265111b911fa79c52bb4589911dfb60c921bf -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Services/Download.c (.../Download.c) (revision 292265111b911fa79c52bb4589911dfb60c921bf) +++ firmware/App/Services/Download.c (.../Download.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -19,10 +19,10 @@ // ********** private definitions ********** -#define SW_UPDATE_FINAL_MSG_INDEX 0xFFFF ///< Software update final message index. +#define SW_UPDATE_FINAL_MSG_INDEX 0xFFFF // TODO remove ///< Software update final message index. #define SHIFT_BITS_TO_GET_TARGET 4 ///< Shift bits by 4 to get the update target. -static const U32 NUM_OF_CAN_BYTES_FOR_UPDATE = SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_PAYLOAD_SIZE; ///< Number of CAN bytes for update. +static const U32 NUM_OF_CAN_BYTES_FOR_UPDATE = SW_UPDATE_FLASH_BUFFER_SIZE + CAN_MESSAGE_FRAME_SIZE; ///< Number of CAN bytes for update. // ********** private data ********** @@ -171,10 +171,7 @@ *************************************************************************/ static void handleIncomingCmdMessage( SW_UPDATE_CAN_MAIL_BOX_T mailBox ) { - // Peek into the number of bytes received for the command buffer - S32 bytesInBuffer = getNumberOfBytesInBuffer( mailBox ); - - if ( bytesInBuffer == CAN_MESSAGE_PAYLOAD_SIZE ) + if ( TRUE == isMessageComplete( mailBox ) ) { // If the command buffer has been received, get it from the comm buffer and process it SW_UPDATE_CMD_STATUS_T SWUpdateCmdStatus; @@ -221,32 +218,32 @@ *************************************************************************/ static void handleIncomingUpdateMessage( SW_UPDATE_CAN_MAIL_BOX_T mailBox ) { - // Peek into the comm buffer to see if the entire data has been received - S32 bytesInBuffer = getNumberOfBytesInBuffer( mailBox ); - - if ( ( bytesInBuffer == NUM_OF_CAN_BYTES_FOR_UPDATE ) && ( MODE_UPDATE == getCurrentOpMode() ) ) + if ( ( TRUE == isMessageComplete( mailBox ) ) && ( MODE_UPDATE == getCurrentOpMode() ) ) { U08 bufferWithNoCRC[ SW_UPDATE_FLASH_BUFFER_SIZE + sizeof( U32 ) ]; U32 calcCRC = 0; BOOL hasCRCPassed = FALSE; ACK_NACK_STATUS_T ackStatus = NACK; U08 msgID = 0; + U16 payloadLength = 0; getCommBuffer( mailBox, (U08*)&SWUpdateRCVStatus, NUM_OF_CAN_BYTES_FOR_UPDATE ); + payloadLength = SWUpdateRCVStatus.updatePayloadLen; + // Create a local buffer and copy the header into the buffer excluding the CRC so only 4 bytes of ID, Destination, and payload length memcpy( bufferWithNoCRC, (U08*)&SWUpdateRCVStatus, sizeof( U32 ) ); // Copy the entire update buffer that is going either to firmware or FPGA into the local buffer. - memcpy( &bufferWithNoCRC[ sizeof( U32 ) ], SWUpdateRCVStatus.SWUpdateBuffer, sizeof( SWUpdateRCVStatus.SWUpdateBuffer ) ); + memcpy( &bufferWithNoCRC[ sizeof( U32 ) ], SWUpdateRCVStatus.SWUpdateBuffer, payloadLength ); // Calculate the CRC of the local copied buffer and compare it against the message CRC - calcCRC = crc32( calcCRC, bufferWithNoCRC, sizeof( bufferWithNoCRC ) ); + calcCRC = crc32( calcCRC, bufferWithNoCRC, sizeof( U32 ) + payloadLength ); hasCRCPassed = ( SWUpdateRCVStatus.msgCRC == calcCRC ? TRUE : FALSE ); msgID = SWUpdateRCVStatus.msgID; if ( FALSE == hasCRCPassed ) { - BOOL test = TRUE; + BOOL test = TRUE; // TODO remove } @@ -270,8 +267,8 @@ } prepareAndSendFWResponseMessage( msgID, ackStatus ); - clearCommBuffer( mailBox ); // TODo does this need to be here? How about resync? - clearSWUpdateBuffer(); // TODO uncomment + clearCommBuffer( mailBox ); + clearSWUpdateBuffer(); } } Index: firmware/App/Services/FPGA.c =================================================================== diff -u -r0c085209bea23f66011059a7c19796c1e4b246fa -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Services/FPGA.c (.../FPGA.c) (revision 0c085209bea23f66011059a7c19796c1e4b246fa) +++ firmware/App/Services/FPGA.c (.../FPGA.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -172,8 +172,8 @@ static U32 countRemove = 0; // TODO remove static U08 tempACkStatus = 0; // TODO remove -/// FPGA stack ID for TD, DD, RO. -static const U08 STACK_FPGA_ID[ NUM_OF_FW_STACKS ] = { 0x5A, 0x61, 0xFF }; // TODO update with the real FPGA IDs +/// FPGA stack ID for TD, DD +static const U08 STACK_FPGA_ID[ NUM_OF_FW_STACKS ] = { 0x5A, 0x61 }; // TODO update with the real FPGA IDs // TODO what is this value? 0? static const U16 DISABLE_UPDATE_REG_CMD = 5; ///< FPGA disable update register command. static const U08 FPGA_RESET_FLASH_CMD = 0x01; ///< FPGA reset flash command. Index: firmware/App/Services/SystemComm.c =================================================================== diff -u -r292265111b911fa79c52bb4589911dfb60c921bf -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision 292265111b911fa79c52bb4589911dfb60c921bf) +++ firmware/App/Services/SystemComm.c (.../SystemComm.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -40,7 +40,7 @@ // TODO do we need check the range of the messages? // TODO retry? - U08 data[ CAN_MESSAGE_PAYLOAD_SIZE ]; + U08 data[ CAN_MESSAGE_FRAME_SIZE ]; if ( SW_UPDATE_COMMAD == mailBox ) { @@ -50,7 +50,7 @@ if ( result != 0 ) { - addToCommBuffer( mailBox, data, CAN_MESSAGE_PAYLOAD_SIZE ); + addToCommBuffer( mailBox, data, CAN_MESSAGE_FRAME_SIZE ); } } } @@ -64,7 +64,7 @@ if ( result != 0 ) { - addToCommBuffer( mailBox, data, CAN_MESSAGE_PAYLOAD_SIZE ); + addToCommBuffer( mailBox, data, CAN_MESSAGE_FRAME_SIZE ); } } } @@ -84,7 +84,7 @@ { BOOL status = FALSE; - if ( 0 != canTransmit( canREG1, (U32)SW_UPDATE_FW_RESP, data ) ) + if ( 0 != canTransmit( canREG1, (U32)SW_UPDATE_TD_RESP, data ) ) { status = TRUE; } @@ -94,7 +94,7 @@ BOOL broadcastDataTestRemove( U08* data ) // TODO remove { - canTransmit( canREG1, (U32)SW_TEST, data ); + canTransmit( canREG1, (U32)SW_UPDATE_TD_BROADCAST, data ); return TRUE; } Index: firmware/BL.dil =================================================================== diff -u -r292265111b911fa79c52bb4589911dfb60c921bf -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/BL.dil (.../BL.dil) (revision 292265111b911fa79c52bb4589911dfb60c921bf) +++ firmware/BL.dil (.../BL.dil) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -1,4 +1,4 @@ -# RM46L852PGE 02/04/26 13:40:54 +# RM46L852PGE 02/07/26 15:26:24 # ARCH=RM46L852PGE # @@ -3610,7 +3610,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_32_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_24_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_16_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_5_INT_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_5_INT_ENA.VALUE=0x00000400 DRIVER.CAN.VAR.CAN_1_MESSAGE_4_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_3_MESSAGE_9_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_51_ID.VALUE=51 @@ -3910,7 +3910,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_36_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_1_MESSAGE_28_BOOL_ENA.VALUE=0 DRIVER.CAN.VAR.CAN_1_MESSAGE_5_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_1_MESSAGE_4_INT_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_4_INT_ENA.VALUE=0x00000800 DRIVER.CAN.VAR.CAN_3_MESSAGE_64_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_56_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_48_RTR.VALUE=0x00000000 @@ -4158,7 +4158,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_20_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_12_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_4_EOB.VALUE=0x00000080 -DRIVER.CAN.VAR.CAN_1_MESSAGE_4_DIR.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_4_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_30_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_22_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_3_MESSAGE_14_MASK.VALUE=0x000007FF @@ -4177,7 +4177,7 @@ DRIVER.CAN.VAR.CAN_3_MESSAGE_31_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_23_INT_ENA_REF.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_15_INT_ENA_REF.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_5_INT_ENA_REF.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_5_INT_ENA_REF.VALUE=0x00000001 DRIVER.CAN.VAR.CAN_3_MESSAGE_50_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_42_INT_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_34_INT_ENA.VALUE=0x00000000 @@ -4267,7 +4267,7 @@ DRIVER.CAN.VAR.CAN_3_SAMPLE_POINT.VALUE=75.000 DRIVER.CAN.VAR.CAN_1_PORT_TX_DIR.VALUE=1 DRIVER.CAN.VAR.CAN_1_MESSAGE_5_EOB.VALUE=0x00000080 -DRIVER.CAN.VAR.CAN_1_MESSAGE_5_DIR.VALUE=0x20000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_5_DIR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_2_INT_ENA_REF.VALUE=0x00000001 DRIVER.CAN.VAR.CAN_3_MESSAGE_1_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_RAM_PARITY_ENA.VALUE=0x00000005 @@ -4382,7 +4382,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_30_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_22_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_14_MASK.VALUE=0x000007FF -DRIVER.CAN.VAR.CAN_1_MESSAGE_6_ENA.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_6_ENA.VALUE=0x80000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_1_RTR.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_1_MESSAGE_1_ID.VALUE=0x601 DRIVER.CAN.VAR.CAN_1_MESSAGE_63_DLC.VALUE=8 @@ -4537,7 +4537,7 @@ DRIVER.CAN.VAR.CAN_1_MESSAGE_56_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_48_MASK.VALUE=0x000007FF DRIVER.CAN.VAR.CAN_1_MESSAGE_9_INT_ENA.VALUE=0x00000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_6_BOOL_ENA.VALUE=0 +DRIVER.CAN.VAR.CAN_1_MESSAGE_6_BOOL_ENA.VALUE=1 DRIVER.CAN.VAR.CAN_2_MESSAGE_21_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_13_INT_LEVEL.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_4_INT_LEVEL.VALUE=0x00000000 @@ -5041,7 +5041,7 @@ DRIVER.CAN.VAR.CAN_2_MESSAGE_47_DIR.VALUE=0x20000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_39_EOB.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_2_MESSAGE_39_DIR.VALUE=0x20000000 -DRIVER.CAN.VAR.CAN_1_MESSAGE_4_INT_ENA_REF.VALUE=0x00000000 +DRIVER.CAN.VAR.CAN_1_MESSAGE_4_INT_ENA_REF.VALUE=0x00000001 DRIVER.CAN.VAR.CAN_3_MESSAGE_51_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_43_ENA.VALUE=0x00000000 DRIVER.CAN.VAR.CAN_3_MESSAGE_35_ENA.VALUE=0x00000000 Index: firmware/source/can.c =================================================================== diff -u -r292265111b911fa79c52bb4589911dfb60c921bf -rfc9a9244cf4288ff0623c3e02455ac565bf60cdd --- firmware/source/can.c (.../can.c) (revision 292265111b911fa79c52bb4589911dfb60c921bf) +++ firmware/source/can.c (.../can.c) (revision fc9a9244cf4288ff0623c3e02455ac565bf60cdd) @@ -254,8 +254,8 @@ } /* Wait */ canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U); - canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x604U & (uint32)0x000007FFU) << (uint32)18U); - canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; + canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x604U & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; canREG1->IF2CMD = (uint8) 0xF8U; canREG1->IF2NO = 4U; @@ -273,11 +273,30 @@ } /* Wait */ canREG1->IF1MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U); - canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x605U & (uint32)0x000007FFU) << (uint32)18U); - canREG1->IF1MCTL = 0x00001000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; + canREG1->IF1ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x00000000U | (uint32)((uint32)((uint32)0x605U & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF1MCTL = 0x00001000U | (uint32)0x00000400U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; canREG1->IF1CMD = (uint8) 0xF8U; canREG1->IF1NO = 5U; + /** - Initialize message 6 + * - Wait until IF2 is ready for use + * - Set message mask + * - Set message control word + * - Set message arbitration + * - Set IF2 control byte + * - Set IF2 message number + */ + /*SAFETYMCUSW 28 D MR:NA "Potentially infinite loop found - Hardware Status check for execution sequence" */ + while ((canREG1->IF2STAT & 0x80U) ==0x80U) + { + } /* Wait */ + + canREG1->IF2MSK = 0xC0000000U | (uint32)((uint32)((uint32)0x000007FFU & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF2ARB = (uint32)0x80000000U | (uint32)0x00000000U | (uint32)0x20000000U | (uint32)((uint32)((uint32)0x606U & (uint32)0x000007FFU) << (uint32)18U); + canREG1->IF2MCTL = 0x00001000U | (uint32)0x00000800U | (uint32)0x00000000U | (uint32)0x00000080U | (uint32)8U; + canREG1->IF2CMD = (uint8) 0xF8U; + canREG1->IF2NO = 6U; + /** - Setup IF1 for data transmission * - Wait until IF1 is ready for use * - Set IF1 control byte