GD32VF103 User Manual
431
Transmit mailbox state
A transmit mailbox can be used when it is free: empty state. If the data is filled in the mailbox,
setting TEN bit in CAN_TMIx register to prepare for starting the transmission: pending state.
If more than one mailbox is in the pending state, they need schedule the transmission:
scheduled state. A mailbox with priority enter transmit state and start transmitting the
message. After the message has been sent, the mailbox is free: empty state. As shown in
Figure 20-3. State of transmission mailbox
Figure 20-3. State of transmission mailbox
empty
pending
scheduled
transmit
Transmit status and error
The CAN_TSTAT register includes the transmit status and error bits: MTF, MTFNERR, MAL,
MTE.
MTF: mailbox transmits finished. Typically, MTF is set when the frame in the transmit
mailbox has been sent.
MTFNERR: mailbox transmits finished and no error. MTFNERR is set when the frame in
the transmission mailbox has been sent without any error.
MAL: mailbox arbitration lost. MAL is set while the frame transmission is failed because
of the arbitration lost.
MTE: mailbox transmits error. MTE is set while the frame transmission is failed because
of the detection error of CAN bus.
Steps of sending a frame
To send a frame through the CAN:
Step 1: Select one free transmit mailbox.
Step 2: Fill four transmission registers with the application
’s acquirement.
Step 3: Set TE bit in CAN_TMIx register.
Step 4: Check the transmit status. Typically, MTF and MTFNERR are set if transmission is
successful.
Transmission options
Abort
MST bit in CAN_TSTAT register can abort the transmission.
If the transmission mailbox
’s state is pending or scheduled, the abort of transmission can be