SPRUIM2H May 2020 – October 2023 AM2431 , AM2432 , AM2434 , AM6411 , AM6412 , AM6421 , AM6422 , AM6441 , AM6442
Setting the MCAN_CCCR[0] INIT bit to 1 starts a software initialization. This is done either by software or by a hardware reset, when an uncorrected bit error was detected in the Message RAM, or by going Bus_Off state. While the MCAN_CCCR[0] INIT bit is set, the message transfer is stopped and the status of the output TX pin is recessive (high). The counters of the Error Management Logic (EML) are unchanged. Setting the MCAN_CCCR[0] INIT bit does not change any configuration register. Resetting the MCAN_CCCR[0] INIT bit finishes the software initialization. After waiting for the occurrence of a sequence of 11 consecutive recessive bits (indication for Bus_Idle state) the message transfer starts.
Access to the MCAN configuration registers is only enabled when both MCAN_CCCR[0] INIT and MCAN_CCCR[1] CCE bits are set (write protection).
The MCAN_CCCR[1] CCE bit can only be set/reset while the MCAN_CCCR[0] INIT = 1. The MCAN_CCCR[1] CCE bit is automatically reset when the MCAN_CCCR[0] INIT bit is reset.
The following registers are reset when the MCAN_CCCR[1] CCE bit is set:
The Timeout Counter value MCAN_TOCV[15-0] TOC field is preset to the value configured by the MCAN_TOCC[31-16] TOP field when the MCAN_CCCR[1] CCE bit is set.
In addition the Tx Handler and Rx Handler are held in idle state while MCAN_CCCR[1] CCE = 1.
The following registers are only writeable while MCAN_CCCR[1] CCE = 0
MCAN_CCCR[7] TEST and MCAN_CCCR[5] MON bits can
only be set by the Host CPU while MCAN_CCCR[0] INIT = 1 and MCAN_CCCR[1] CCE = 1.
Both bits may be reset at any time. The MCAN_CCCR[6] DAR bit can only be set/reset
while MCAN_CCCR[0] INIT = 1
and MCAN_CCCR[1] CCE =
1.
Table 12-4103 shows the steps to configure the MCAN module.
Step | Operation | Description | Pseudo Code | |||
---|---|---|---|---|---|---|
1 | Initialize MCAN_CCCR | Set MCAN_CCCR[0] INIT bit and check that it has been set | INIT = 1; If INIT ≠ 1, wait until it is | |||
2 | Unlock protected registers | Set MCAN_CCCR[1] CCE bit | CCE = 1; | |||
3 | Configure CAN mode | Set MCAN_CCCR[8] FDOE bit to CAN FD | FDOE = 1 for CAN FD FDOE = 0 for CAN | |||
4 | Configure Bit Rate Switching | Set MCAN_CCCR[9] BRSE bit | BRSE = 1 with bit rate switching BRSE = 0 without bit rate switching | |||
5 | Set bit timing | Set MCAN_NBTP register | ||||
6 | Lock protected registers | Clear MCAN_CCCR[1] CCE bit | CCE = 0; | |||
7 | Return MCAN module to normal operation | Clear MCAN_CCCR[0] INIT bit and check it has been cleared | INIT = 0; If INIT ≠ 0, wait until it is |