This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

F28M35H52C: Clarification on Safety of CANMessageClear() During Active Communication

Part Number: F28M35H52C

Tool/software:

Hello,

I’m seeking confirmation regarding the safety of using CANMessageClear() on the CAN module during active communication on a F28M35x.

The Technical Reference Manual (TRM) for the device notes that:

That being said, there is one condition that can cause a write access to the message RAM to be lost. If MsgVal = 1 for the message object which is accessed and CAN communication is ongoing, a transfer from the IFx register to message RAM may be lost. The reason for this is that it might happen that the IFx register write to the message RAM occurs in between a read-modify-write access of the Host Message Handler when it is in the process of receiving a message for the same message object.

To avoid this issue with receive mailboxes, reset MsgVal before changing any of the following: Id28-0, Xtd, Dir, DLC3-0, RxIE, TxIE, RmtEn, EoB, Umask, Msk28-0, MXtd, and MDir.”

This implies that contention occurs when the Host Message Handler (during a receive operation) and the CPU attempt simultaneous updates to the message RAM.

From what I understand:

1. MsgVal is not stored in message RAM: Based on Figure 23-17 (Structure of a Message Object) in the TRM, the MsgVal bit resides in a dedicated register, separate from the fields listed above, which are explicitly unsafe to modify during active communication.

2. Implementation of CANMessageClear():

The function waits for the IF1 busy bit to clear, modifies the CAN_O_IF1_ARB register (clearing MsgVal), and then initiates the transfer to message RAM. Since it only clears MsgVal, this operation does not modify fields in the message RAM that the Host Message Handler accesses during active reception.

From this, I infer that CANMessageClear() is safe to call during active CAN communication, as clearing MsgVal simply deactivates the message object without risking contention with the Host Message Handler.

Could you confirm whether this conclusion is correct? Is it guaranteed that clearing MsgVal will not be prevented by ongoing receive operations, even while the bus is active? Are there any timing requirements in calling this function and subsequent calls to CANMessageSet()?

Thank you in advance for your support!

Best regards,

André