![Cmsemicon BAT32G1 9 Series Скачать руководство пользователя страница 922](http://html1.mh-extra.com/html/cmsemicon/bat32g1-9-series/bat32g1-9-series_user-manual_2627609922.webp)
BAT32G1x9 user manual | Chapter 22 CAN control
922 / 1149
Rev.1.02
22.8 CAN controller initialization
22.8.1
CAN module initialization
Before enabling CAN module operation, the system clock of the CAN module needs to be determined by
setting the CCP [3:0] bit of the CnGMCS register by software. After the CAN module is working, do not change
the setting of the CAN module system clock.
Enable the CAN module by setting the GOM bit of the CnGMCTRL register.
For procedures on initializing the CAN module, see 22.16The operation of the CAN
22.8.2
Initialization of the packet cache
When the CAN module is enabled, the packet buffer contains undefined values. Minimal initialization of all
message buffers (even if the application is not in use) is required before switching the CAN module from
initialization mode to one of the operating modes.
-
Clear the RDY, TRQ, and DN bits (0) of cnMCTRLm
-
Clear the MA0 bit (0) of the CnMCONFm
Note
m= 0
to
15
22.8.3
Redefine the message cache
Redefining a packet buffer means that when a packet is received or transmitted, the ID and control
information of the packet buffer is changed without affecting other send/receive operations.
(1)
Redefine the message cache in initialization mode
Put the CAN module into initialization mode once, and then change the ID and control information of
the packet buffer in initialization mode. After changing the ID and control information, set the CAN
module to operating mode.
(2)
Redefine the message cache in the receive
(3)
Redefine the message cache in the send
To rewrite the contents of the transmission packet buffer that has been set for a transfer request, perform transfer
abort processing (see 22.10.4
abort processing outside of Automatic Block Transfer (ABT) in Normal
Operating Mode and Transfer Abort Processing outside of Automatic Block Transfer (ABT)
). ) .
Confirm that the transfer was aborted or completed, and then redefine the packet buffer. After you redefine the
transfer message buffer, use the procedure described below to set up the transfer request. However, when a
transfer request is set to a redefined packet buffer without aborting an in-progress transfer, a 1-bit wait time is not
required.