Part Number: TMS570LC4357
Other Parts Discussed in Thread: HALCOGEN
Hi,
I would like to reconfigure CAN Message Boxes for transmit and receive.
Question 1:
In the canUpdateID function, what is the purpose of node->IF2CMD = 0xA0U; ?
0xA0 only affects ID fields, why are we writing 0xA0 in the ID field?


Question 2:
I had to modify the canUpdateID message to accommodate some of the register file changes, I have tried to assign values to the registers as the HALCOGEN generated code as shown below. But it doesn't work. The second message that I am trying to transmit after updating the ID of the object is not getting transmitted. Moreover, I see in debug mode that the values are not getting written to the registers. Does the IF2 register have any write-protect settings?
void canUpdateID(canBASE_t *node, bool isTx, uint32 messageBox, uint32 can_id)
{
/** - Wait until IF2 is ready for use */
while((*node).CAN_IF2CMD.bit.Busy)
{
} /* Wait */
/** - Configure IF2 for
* - Message direction - Read
* - Data Read
* - Clears NewDat bit in the message object.
*/
//(*node).CAN_IF2CMD.all = 0xA0U;
//
// Set direction to transmit
//
if(isTx)
{
(*node).CAN_IF2CMD.bit.DIR = 1U;
}
else
{
(*node).CAN_IF2CMD.bit.DIR = 0;
}
(*node).CAN_IF2CMD.bit.TxRqst = 0;
/* Copy passed value into the arbitration register. */
//(*node).CAN_IF2ARB.all &= 0x80000000U;
(*node).CAN_IF2ARB.bit.MsgVal = 1;
//node->CAN_IF2ARB.all |= (msgBoxArbitVal & 0x7FFFFFFFU);
(*node).CAN_IF2ARB.bit.MsgVal = 0;
if(isTx)
{
(*node).CAN_IF2ARB.bit.Dir = 1U;
}
else
{
(*node).CAN_IF2ARB.bit.Dir = 0;
}
(*node).CAN_IF2ARB.bit.ID = can_id << CAN_IF1ARB_STD_ID_S;
/** - Update message box number. */
/*SAFETYMCUSW 93 S MR: 6.1,6.2,10.1,10.2,10.3,10.4 <APPROVED> "LDRA Tool issue" */
(*node).CAN_IF2CMD.bit.MSG_NUM = messageBox;
/** - Wait until data are copied into IF2 */
while((*node).CAN_IF2CMD.bit.Busy)
{
} /* Wait */
}
Regards,
Rashmitha




