GD32F403xx User Manual
614
22.3.8.
Error flags
The state of CAN bus can be ref lected by Transmit Error Counter (TECNT) and Receive Error
Counter (RECNT) of CAN_ERR register. The value can be increased or decreased by the
hardware according to the error, and the software can judge the stability of the CAN network
by these values. For details on incorrect counting, refer to the CAN protocol section.
By using the CAN_INTEN register (ERRIE bit, etc.), the software can control the interrupt
generation when error is detected.
Bus-Off recovery
The CAN controller is in Bus-Off state when TECNT is over than 255. In This state, BOERR
bit is set in CAN_ERR register, and no longer able to transmit and receive messages.
According to the ABOR configuration in register CAN_CTL, there are two ways to recover
f rom Bus-Off (to an error active state). Both of these methods require the CAN bus controller
in the Bus-Off state to detect the Bus-Off recovery sequence defined by CAN protocol (when
CAN_RX detects 128 consecutive 11-bit recessive bits) before automatic recovery.
If ABOR is set, it will be automatically recovered when a Bus -Of f recovery sequence is
detected.
If ABOR is cleared, CAN controller must be configured to enter initialization mode by setting
IWMOD bit in CAN_CTL register, then exit and enter nomal mode. After this operation, it will
recover when the recovering sequence is detected.
22.3.9.
CAN interrupts
The CAN bus controller occupies 4 interrupt vectors, which are controlled by the register CAN
_INTEN.
The interrupt sources can be classified as:
◼
Transmit interrupt
◼
FIFO0 interrupt
◼
FIFO1 interrupt
◼
Error and status change interrupt
Transmit interrupt
The transmit interrupt can be generated by any of the following conditions and TMEIE bit in
CAN_INTEN register will be set:
◼
TX mailbox 0 transmit finished: MTF0 bit in the CAN_TSTAT register is set.
◼
TX mailbox 1 transmit finished: MTF1 bit in the CAN_TSTAT register is set.
◼
TX mailbox 2 transmit finished: MTF2 bit in the CAN_TSTAT register is set.
Содержание GD32F403 Series
Страница 1: ...GigaDevice Semiconductor Inc GD32F403xx Arm Cortex M4 32 bit MCU User Manual Revision 2 6 Jul 2022 ...
Страница 177: ...GD32F403xx UserManual 177 Peripheral Channel 0 Channel 1 Channel 2 Channel 3 Channel 4 SDIO SDIO ...
Страница 217: ...GD32F403xx UserManual 217 ensures that no conversion is in progress ...