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.

CAN - updating data bytes of transmission message objects

Hi there,

the user manual of the RM46 says (page 1255):

"Messages may be updated or set to not valid at any time, even if a requested transmission is still pending
(for reconfiguration, see Section 26.7.7). However, the data bytes will be discarded if a message is
updated before a pending transmission has started"

Could you please clarify the second part of this?
- At 'any time' means normally 'nothing bad will happen'. But discarding data bytes is not a good thing...
- In which situation exactly the data bytes will be discarded?
- What does "discarded" mean?
   - Are they really not stored into message RAM?
   - Or are the 'new' data bytes only ignored for the actual pending transmission (because
      the message has already been transferred with the 'old' data bytes to the shift
      register of the CAN core)?

Background:
- I want to update the data bytes of my transmit message objects in a certain time interval (ca. 5ms)
- The transmit message object can be requested via CAN by a remote frame at any time (asynchronously)
- I really want to make sure consistency and that updated data bytes will not be discarded in any case.

Best Regards, Andy

  • Andy,

    When you update the CAN message, you do so by writing to the IF register set, not to the message RAM directly.

    Likewise the CAN core operates on a copy of the message taken from the message RAM.

    The Message Handler block makes sure transfers between the CPU and message RAM as well as the Message RAM and CAN core are handled atomically.

    So I believe the wording 'discarded' probably would apply to data that was written to the message ram in a prior access through the IF register set,  and was sitting in the RAM waiting to be picked up by the can core by transmission.  If you write to the same mailbox again, it would overwrite that message.   If you overwrite the message before it starts transmitting, you're 'discarding' it.

    Best Regards,

    Anthony

  • Hi Anthony,

    ok, if the 'discarded'-thing shall be interpreted in this way, this will absolutely be no problem for me.

    Of course old data bytes will be overwritten/discarded/lost, if I write new data into the message
    RAM [via IF registers], before the old data bytes have been sent via CAN.

    I just wanted to make sure, that the new data bytes will be stored savely into the message RAM
    and will not be 'discarded' during the 'store-process' in any case.

    Best regards,

    Andy

  • Yes, that is correct.

    The one thing you should note is that when the IF registers are "BUSY" they are write protected. So you should make sure you check the busy bit in the IF registers before trying to write to them. So if you tried to write back to back to IF and ignored the busy flag, you might lose data.  But that would be classified as a programmer's error.

    Best Regards,

    Anthony

  • Hi Anthony,

    thanks for your answer.
    I'm familiar with the handling of the IF registers, so everything is fine for me.

    Best Regards, Andy