
GD32F403xx User Manual
606
Transmit mailbox state
A transmit mailbox can be used when it is free (
empty state
). If the mailbox is filled with data,
set 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 scheduling the transmission
(
scheduled state
). A mailbox with highest priority enters into transmit state and starts
transmitting the message (
transmit state
). After the message has been sent, the mailbox is
f ree (
empty state
). As is shown in
Figure 22-3. State of transmit mailbox
.
Figure 22-3. State of transmit 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 transmit finished. Typically, MTF is set when the frame in the transmit
mailbox has been sent.
◼
MTFNERR: mailbox transmit finished with no error. MTFNERR is set when the frame in
the transmit mailbox has been sent without any error.
◼
MAL: mailbox arbitration lost. MAL is set when the frame transmission is failed due to the
arbitration lost.
◼
MTE: mailbox transmit error. MTE is set when the frame transmission is failed due to the
error detected on the CAN bus.
Steps of sending a frame
To send a f rame through the CAN:
Step 1: Select one free transmit mailbox.
Step 2: Configure
four transmission registers with the application’s acquirement.
Step 3: Set TEN 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 transmit mailbox’s status is
pending
or
scheduled
, the abort of transmission can be