Taking TC387 as an example, there are three MCM CAN modules, namely CAN 0, CAN1, and CAN2. The following figure shows the basic parameters of the three CAN modules, among which CAN0 has the most comprehensive functions.
As can be seen from the figure, each CAN module has 4 CAN Nodes. Each Node is implemented using Bosch's M_CAN method, supports CAN and CANFD, and has a maximum rate of 5Mbps. Each Node has a maximum of 64 Rx Buffers and supports a maximum of 2 Rx FIFOs. In addition, each Node has a maximum of 32 Tx Buffers and supports a maximum of 1 Tx FIFO/Tx Queue.
Compared with TC2XX, the difference lies in the replacement of the original Message Object with Message RAM, the addition of Pretended Networking features, and the addition of Range Filter functions.
Let’s talk about the details below.
01. Clock
First, let's look at the clock. For the CAN module, there are mainly Fsyn and Fasyn, as shown in the figure below. Fsyn provides the clock for access to CAN-related registers and Message RAM, and Fasyn provides the clock for CAN/CAN FD baud rate generation. In order for MCMCAN to have good performance, it is very important to ensure that Fsyn>=Fasyn.
02. Data sending and receiving management
Data transmission and reception are divided into Dedicated Rx/Tx Buffer and RX FIFO, where Dedicated Rx Buffer means each ID corresponds to a buffer, that is, FULL CAN. All Dedicated Rx Buffer addresses must be continuous and the occupied Message RAM size must be the same.
After each Dedicated Rx Buffer is written with data, it will be locked and no new data will be written from the CAN Bus until the CPU completes accessing the Dedicated Rx Buffer and then unlocks it.
Rx Buffer is actually multiple Rx Buffers composed of Rx FIFO for management. Each CAN Node can set up to 2 Rx FIFOs, namely Rx FIFO 0 and Rx FIFO 1. Each Rx FIFO can contain up to 64 Rx Buffer data.
Both Dedicated Rx Buffer and Rx FIFO can set Filtering to determine which messages on the CAN Bus are received.
Message transmission is also divided into Dedicated Tx Buffer and Tx FIFO, but there is an additional Tx Queue. The meanings of the first two are the same as those mentioned in the receiving management. There are a few points to note in Tx management. Dedicated Tx Buffer and Tx FIFO or Tx Queue can exist at the same time, but there can be a maximum of 32 Tx Buffers.
For the coexistence of Dedicated Tx Buffer and Tx FIFO, they must be arranged in order. Each time arbitration is sent, all Dedicated Tx Buffers and the oldest Tx FIFO Tx Buffer are compared in priority, and the one with the smallest Message ID is sent first.
For the coexistence of Dedicated Tx Buffer and Tx Queue, they are also arranged in the order of Dedicated Tx Buffer and Tx Queue. Each time arbitration is sent, the priority of all Dedicated Tx Buffers and Tx Buffers in the Tx Queue is compared. The one with the smallest Message ID is sent first. If the Message IDs are the same, the Tx Buffer with the earlier order is sent first.
03. MCAL configuration
Regarding the MCU and CAN module, the first step is to set the clock frequency of the CAN module, as shown in the figure below.
Below is the Port module, which is configured according to the hardware interface table. For example, P20.8 is configured as output, as shown in the figure below.
The following is the configuration of the CAN module, configuring RXDB, as well as the sending and waking up methods. The following is the polling mode, and the following is the CAN clock source and the corresponding baud rate.
The following is the setting of baud rate. In order to configure the sampling point at about 80%, it is necessary to configure the time parameters of each segment. This is usually required by the OEM, so just configure it accordingly.
Next, configure the Hardware object, including the frame type, FIFO or other type, and the associated CAN module.
You can also configure filters as shown in the following figure.
Finally, configure the operation cycle of the main function of the CAN module, as shown in the following figure.
Previous article:MIPI improves transmission performance of next-generation image data
Next article:Mercedes-Benz Actros series gateway CAN bus fault analysis
- Popular Resources
- Popular amplifiers
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- stm32 pwm wave control
- Zynq UltraScale+MPSOC Development Board Feature List
- Why is the American Fluke 15B more durable than domestic multimeters? Take a look and you will understand
- Electronic computing software
- MCO (PA8) does not output waveform during DEBUG. What is the reason?
- Patch reverse check
- EEWORLD University ---- Control system of 100 quantum bits
- The difference between USART, USI, USCI and eUSCI serial communication modules in MSP430 microcontroller (updated on March 4, 2019)
- Polarity of EPWMA pulse
- RF Sampling DAC Spurious Troubleshooting and Optimization