
GD32A50x User Manual
635
23.3.11.
Interrupts
The CAN interrupt events and flags are list in
Table 23-11.
Interrupt events
Interrupt event
Flag
Enable control
Bit
Register
Enable bit
Control
bit
Enable
register
Control
register
Bus off
BOF
CAN_ERR1
BOIE
CAN_CTL1
Bus off recovery
BORF
BORIE
CAN_CTL2
Error
summary
Bit recessive error
ERRS
F
BRERR
ERRSIE
CAN_CTL1
Bit dominant error
BDERR
ACK error
ACKERR
CRC error
CRCERR
Form error
FMERR
Stuff error
STFERR
Error
summary
for FD
frames with
data bit time
Bit recessive error
ERRF
SF
BRFERR
ERRFSIE
CAN_CTL2
Bit dominant error
BDFERR
CRC error
CRCFERR
Form error
FMFERR
Stuff error
STFFERR
Tx error warning
TWERRIF
TWERRIE
WERREN CAN_CTL1 CAN_CTL0
Rx error warning
RWERRIF
RWERRIE
Wakeup match
WMS
CAN_PN_STAT
WMIE
CAN_PN_CTL0
Wakeup timeout
WTOS
WTOIE
Mailbox successful transmission
or reception
All bits
CAN_STAT
All bits
RFEN = 0
CAN_INTE
N
CAN_CTL0
MSx
MIEx
RFEN = 1
Rx FIFO not empty
MS5_RFNE
MIE5
RFEN = 1
& DMAEN
= 0
Rx FIFO warning
MS6_RFW
MIE6
Rx FIFO overflow
MS7_RFO
MIE7
23.4.
Example for a typical configuration flow of CAN
After power-on reset or system reset, the following operation flow is a typical process for
application to configure and run CAN:
Configure CAN module clock source CANCLK, and enable CAN clock
Configure CANxSEL[1:0] bits in CAN_CFG2 register to select the CAN module clock
source. Program the RCU_APB2EN register to enable the CAN module clock.
Setup the communication interface
Configure GPIO and AFIO module to select PADs to alternate functions.
Enter Inactive mode
Because INAMOD bit, HALT bit, NRDY bit and INAS bit are default set after power-on