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.

Two Questions about CAN transmit

Q1. We have to write some registers of CAN module to send CAN messages .(e.g, MSGID, CANMDL, CANMDH)

We need very short delay for completing writing to the registers?

When I sent thousands of messages, one message had Old data in MSGID, CANMDL or CANMDH.

The other messages were what I currently wrote and OK.

I guessed CAN module might need very short delay because I set CANTRS just after writing to MSGID, CANMDH and CANMDL.

My code is summarized like this.

1.Disable CANME

2. Write MSGID

3. Enable CANME

4. Write CANMDH

5.Write CANMDL

6.Set CANTRS

I need a delay  between 5 and 6?

 

Q2. In order to send next CAN message, it's recommended to read CANTA.

But I read CANTRS. If the bit of CANTRS is 0, I send next CAN message.

Does this method have some problem?

  • Q1: No.

    Q2: Yes.

    You do not need a delay between step 5 and 6.

    If you do not wait fpr CANTA there will be definitely trouble. If the older message could not be transmitted (because of traffic or transient errors), your next write to the mailbox will destroy the older information.