On the abstract CAN main line’s distributional control node generally is composed of the monolithic integrated circuit and the programmable CAN communication controller. The hardware aspect introduced the node circuitry, the software aspect has given the question which the system programming flow and needs to pay attention.
Key word MCP2510 CAN controller intelligence node
CAN (Controller Area Network) main line, namely controller local area network. Because has the high performance, the redundant reliability as well as the unique design, the CAN main line is valued people’s more and more. Germany’s Bosch Corporation at first has designed the CAN main line for the automobile monitoring and the control system, now, its application already domain development and so on procedure-oriented industry, mechanical industry, textile industry, agricultural use machinery, robot, numerically-controlled machine tool, medical instrument and sensor. The CAN main line already formed the international standard, and recognized for was already one of most promising field buses. The CAN main line standard was already drawn up by the International Standardization Organization for international standard ISOll898, and has the numerous semiconductor device manufacturer support, promotes each kind of integration to have the CAN agreement product. The CAN bus system intelligence node is in the network the text receive and the transmission station, generally or the two combines by the monolithic integrated circuit and the CAN controller is composed.
MCP2510 is one kind of independent programmable CAN controller chip which Microchip Corporation produces. This article will introduce that new independent CAN communication controller MCP2510, and gives it in the CAN bus system intelligence node application example.
1 MCP2510 chip introduction
MCP2510 is one kind has SPI the connection CAN controller, DIP seal like chart l shows. It supports CAN technology standard V2.OA/B. Can transmit or the receive standard and the expansion information frame, simultaneously has receives the filter and the information management function. MCP2510 carries on the data transmission through the SI connection and MCU, the highest data transfer rate may reach 5Mbps, MCU to be possible through MCP2510 and CAN on main line’s other MCU unit correspondence. MCP25lO contains 3 transmission buffers and 2 receive buffers, meanwhile has the nimble interrupt managed capacity, these characteristics cause MCU become to the CAN main line’s operation very simple.

1.1 MCP2510 main features
◇ supports CANV2.OA/B;
◇ has the SPI connection, supports SPI pattern 0, O and l,1;
◇ contains 3 transmission buffers and 2 receive buffers, may carry on the programming to its priority;
◇ has 6 receive filter, 2 receive filter shield;
◇ has the nimble interrupt managed capacity;
◇ uses the low power loss CMOS processing technology, its working voltage scope is 3.0~5.5V, the effective current is 5mA, the standby current for 10μA;
◇ operating temperature scope for - 40~ 125℃.
1.2 structures and principle of work
MCP25lO has PDIP, SOIC and the TSSOP three kind of seal forms. Figure 2 is the MCP2510 internal structure diagram. The CAN protocol machine is responsible with the CAN main line’s connection, the SPI interface logic to use in realizing with the MCU correspondence, but checks, the buffer group and the control logic uses for to complete each way the hypothesis and the work management. Presently unifies its work process various part of functions, the principle to do an introduction.

(1) receiving and dispatching operation
The MCP2510 transmit operation realizes through 3 transmission buffers. These 3 transmission buffer occupies 14 byte SRAM respectively. The 1st byte controls register TXBNCTRL, this register uses for to establish the message routing the condition, and has given the information transmission mode; The 2~6th byte uses for to deposit the standard and the expansion identifier as well as the arbitration information; Finally 8 bytes use for to deposit treat the transmission the data message. Before carrying on the transmission, must carry on the initialization first to these registers.
(2) interrupt management
MCP2510 has 8 interrupt sources, including the transmission interrupt, the receive interrupt, the malfunction and the main line awakens the interrupt and so on. Enables register (CANINTE) and interrupt mask register (CANINTF) using the interrupt may realize conveniently to each kind of interrupt effective management. When has the interrupt occurs, the INT pin becomes the low level and maintains at the low level, until MCU elimination interrupt.
(3) error detection
The CAN agreement has measuring abilities and so on CRCF mistake, reply mistake, form mistake, position mistake and packing mistake. The MCP2510 content receive makes a mistake counter (REC) and the transmission makes a mistake the counter (TEC) two wrong counters. Therefore as soon as to network any node, has the possibility different to cause it because of the wrong counter value to be at wrong rousing attention, the wrong approval and the main line is separated from one of 3 conditions.
2 MCP2510 in intelligent node application example
May constitute a CAN main line distributional observation network using MCP2510 and CAN main line transceiver TJAl050. The system may include a master-control unit and many node controllers, this kind of node controller may to electric motor’s electric current, the voltage and the periphery temperature carries on the monitoring, its structure as shown in Figure 3.

This kind of network topology has used the main line type structure and the passive tap connection, and the structure is simple, the cost is low, therefore system’s reliability is high. Its intelligence transmission uses the CAN communication protocol, the correspondence medium uses the twisted pair line. Because the CAN main line is based on the transmission text code, does not carry on the code to the CAN control node, therefore system’s extendibility is quite good, simultaneously on the additions and deletions CAN main line’s control node will not have any influence to system’s other nodes.
Node controller’s MCU may select has the SPI connection microprocessor, may also use does not bring the SPI connection microprocessor. This system uses does not bring SPI connection microprocessor AT89C5l. AT89C51 may through the P1 mouth and CAN controller’s SPI connection direct connected, and realizes the SPI connection agreement with the software algorithm. CAN main line transceiver TJAl050 as MCP2510 and physical main line’s connection. If needs to further sharpen system’s antijamming ability, then may adds an electro-optical disconnector again between MCP2510 and TJAl050.
Intelligent node electric circuit schematic diagram as shown in Figure 4.

2.1 software designs
Before MCP2510 normal work, needs to carry on the correct initialization, including establishes the SPI connection the data transfer rate, the CAN correspondence baudrate, the MCP25lO receive filter and the shield as well as the transmission and the receive interrupt permits the flag bit and so on. Is different what with SJAl000, the monolithic integrated circuit and transmits buffer’s operation to the MCP2510 receive buffer, must complete through the SPI connection with the MCP25lO built-in read-write order. It reads, writes the order succession chart like chart 5 and shown in Figure 6.

In this article MCP2510 mainly adopts the interrupt pattern to carry on the main line data the receive and the transmission. The overall system main foreword provides two kind of interrupts: Timer interrupt and external interrupt. The timer interrupts interrupt subroutine primary cognizance processing from analog channel AINO~AIN7 A/D data, to the MCP25lO transmission “data transmission request order” as well as transmission data. External interrupt’s interrupt processing subroutine mainly includes the CAN main line error processing subroutine and the data receive subroutine.
2.2 software main body design cycle
Software main body design cycle as shown in Figure 7. When software design needs to pay attention to following question:
①Because MCP2510 after the initialization completes is in tacitly approves under the Config-uration pattern, therefore needs after the MCP2510 initialization sets at it is the Normal pattern, otherwise MCP2510 has paused under the Configuration pattern, cannot carry on the work normally. Sets at the Normal pattern MCP2510 to be possible through to use MCP2510 built-in BitModify (position revision) 4 instructions to read in 0 bytes to the CANCTRL control word to realize.
②In carries on any operation before MCP2510, must select patches or strips of land as worth saving for seed CS by the microprocessor to MCP2510 to output a low level, causes MCP2510 to select.
③When carries out MCP2510 “reads” the operation, after transmitting reads the instruction and the address, still needed to MCP2510 to provide the clock, receives the data which “reads” arrives. May through transmit a O byte to MCP2510 to realize.
④In completes after MCP2510 operates willfully, wants time delay period of time, enables it to have the enough time to prepare to receive the next time operation the order, prevents presents MCP2510 “busily” situation.
3 summaries
The CAN main line has been recognized for is one of most promising several kind of field buses. Because its performance-to-price ratio high, realizes and so on simply the prominent merit depth more and more research and development personnel’s favor. This article intelligent node may join many collection and distribution control system, its software and hardware electric circuit’s design method suits similarly in other based on the CAN main line’s distributional control system’s node design.