Introduction to the ideas and methods of MCU serial port to CAN
[Copy link]
In the process of embedded product development, you may face the problem of insufficient CAN channels. How to choose a suitable conversion module to solve this problem? The following will explain the selection methods of several modules.
1. Application scenario
CAN bus is one of the excellent field buses, which has spread from automotive electronics to all walks of life. From industrial automation to new energy, from rail transportation to aerospace, CAN bus technology has been continuously applied and accumulated in China.
Figure 1 CAN bus data frame structure
When applying CAN bus, we may face the following problems: the main controller does not support CAN controller or the number of CAN channels is insufficient. Specific problems: early product communication uses RS485 or RS232 communication, and the current stage needs to upgrade the product to support CAN communication; subject to cost constraints, the main control MCU must choose a low-end processor without a CAN controller; the number of CAN channels required in the developed product is far greater than 2, and the MCU models that can support more than two CAN channels are limited or the cost is too high.
Figure 2 Comparison of CAN lines between LPC series
Figure 3 Multi-channel CAN application scenario
When the MCU does not support CAN controller or the required number of CAN channels cannot meet the requirements, you can choose to use other communication interfaces to expand the CAN interface. Common conversion methods include serial port to CAN, Ethernet to CAN, WIFI to CAN and optical fiber to CAN. This article mainly introduces the ideas and methods of serial port to CAN.
Figure 4 CAN converter product
2. How to select
The serial port expansion CAN module is generally divided into two forms, one is a simple protocol controller chip implementation, such as MCP2515 and MCP2517; the other is implemented through a high-performance MCU. Compared with a simple protocol controller chip, the protocol conversion module of the MCU solution has the following advantages: easy configuration, with the host computer or serial port instruction set, a few simple serial port data transmissions can complete the configuration; large cache, eliminate frame loss at high speed or high data throughput; excellent performance, complex protocol conversion and frame cache are fully integrated outside the user MCU, which can reduce the burden on the user MCU.
ZLG Ligong Technology·Zhiyuan Electronics launched two series of serial port to CAN modules: CANFDSM and CSM300. How to start the selection work, we start with the difference between them. CANFDSM is the latest generation of serial port to CANFD modules. On the basis of matching the current popular CANFD, it is also fully compatible with the traditional CAN2.0 protocol. Therefore, if the CANFD protocol is selected for your product, you can only use the new generation of CANFDSM modules.
Figure 5 Link layer protocol differences
If the product uses CAN2.0A or CAN2.0B protocol, we continue to compare and select. CANFDSM does not have CAN or CANFD transceivers, and users need to add isolated or non-isolated transceiver modules by themselves. CSM300 has an internal CAN isolation transceiver and CAN controller, so it can directly connect the MCU and CAN bus.
Figure 6 Internal components of CSM300 and CANFDSM
The above discussion is for applications that require onboard use. How should we choose for applications that require direct use in equipment? CANCOM or CANFDCOM are definitely your first choice. The 1~2 channel CAN FD interface of the CANFDCOM interface card has built-in 2500VDC electrical isolation, and the electrostatic level is ±8KV for contact discharge and ±1KV for surge, which can effectively avoid reflux damage caused by different ground potentials at different nodes, and is particularly suitable for testing electric vehicles and trains.
Figure 7 Serial port to CAN device
3. Application circuit
Taking CANFDSM-100 as an example, the general application of this type of module is as follows. The protocol conversion module communicates directly with the MCU through the TX and RX cross-connections of UART, and PIN3 and PIN4 are connected to the external CAN bus through the CAN isolation transceiver CTM3FD. It should be noted that the module needs to be parameterized before use. After using PIN7 to put the module into the configuration state, the parameter configuration can be completed with the AT command of the MCU. In addition, the parameter configuration can also be completed quickly with the upper computer software.
Figure 8 Application circuit MCU serial port to CAN ideas and methods introduction
Figure 9 CANFDSM-100 pin definition
4. Protocol conversion format
The serial port to CAN module provides transparent conversion, transparent with identification, custom protocol and other conversion formats .
|