Tool/software: Code Composer Studio
For RM46, HalCoGen generates a function called getCanID. That code collects the message identifier as if it were an extended ID. When configured to be non-extended that means the 11 bit message identifier value is shifted to the left as if it were a 29 bit identifier.
*/
/* SourceId : CAN_SourceId_026 */
/* DesignId : CAN_DesignId_020 */
/* Requirements : HL_SR537 */
uint32 canGetID(canBASE_t *node, uint32 messageBox)
{
uint32 msgBoxID = 0U;
/** - Wait until IF2 is ready for use */
while ((node->IF2STAT & 0x80U) ==0x80U)
{
} /* Wait */
/** - Configure IF2 for
* - Message direction - Read
* - Data Read
* - Clears NewDat bit in the message object.
*/
node->IF2CMD = 0x20U;
/** - Copy message box number into IF2 */
/*SAFETYMCUSW 93 S MR: 6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "LDRA Tool issue" */
node->IF2NO = (uint8) messageBox;
/** - Wait until data are copied into IF2 */
while ((node->IF2STAT & 0x80U) ==0x80U)
{
} /* Wait */
/* Read Message Box ID from Arbitration register. */
msgBoxID = (node->IF2ARB & 0x1FFFFFFFU);
return msgBoxID;
}