SPRAD59 October 2023 TMS320F280039
The individual steps for initialization of DCAN and MCAN modules, along with the key differences have been listed in Table 3-1:
Operation | DCAN | MCAN |
---|---|---|
Enter Initialization Mode | Set CAN_CTL.INIT bit | Set MCAN_CCCR.INIT bit and check that the bit has been set |
Unlock Protected Registers | Set CAN_CTL.CCE bit | Set MCAN_CCCR.CCE bit |
Configure CAN Mode and Bit Rate Switching | Not applicable | Set MCAN_CCCR.FDOE bit for CAN FD function Set MCAN_CCCR.BRSE bit to enable Bit Rate Switching (BRS) (Both bits need to be 0 for Classic CAN Communication) |
Configure bit-timing | Configure CAN_BTR register | Configure MCAN_NBTP register |
Configure data bit-timing | Not applicable | Configure MCAN_DBTP register (Not needed for Classic CAN as BRS is disabled) |
Message RAM Configuration | Not applicable | See Message RAM configuration |
Global Filter Configuration, if required (determines how the module handles non-matching frames). | Not applicable | Set MCAN_GFC Register |
Receive and Transmit Configuration (can be done at run time as well) | Setup Message Object | Filter Configuration |
Lock Protected Registers | Clear CAN_CTL.CCE bit | Clear MCAN_CCCR.CCE bit |
Return module to normal operation | Clear CAN_CTL.INIT bit | Clear MCAN_CCCR.INIT bit |
In addition to the steps shown above, for MCAN, the MCAN Clock Divider may need to be set up as part of the initialization process. This configuration is typically done via the AUXCLKDIVSEL register (refer to the device-specific TRM to determine the register for clock division). For 120 MHz and 200 MHz devices, C2000ware examples configure the MCAN bit-clock to 40 MHz. If an application desires a smaller time quanta (TQ), other configurations for the bit-clock are possible. However, the parameters for the Nominal and Data Bit Timings need to be changed accordingly. Figure 3-1 shows the initialization steps for DCAN. Figure 3-2, Figure 3-3, and Figure 3-4 show the initialization steps for MCAN.