1 Can Protocol and Terminology

Controller Area Network (CAN) is a multi-master serial data bus which uses Carrier Sense Multiple Access/Collision Resolution (CSMA/CR) to determine access. Message transfer over CAN is controlled by 4 different types of frame: Data frames, Remote Transmit Request (RTR) frames, Overload frames and Error frames. Each CAN data frame is required to have a unique identifier. Identifiers may be 11-bit (standard format) or 29-bit (extended format).

Figure 1The identifier serves two purposes beyond simply identifying the message. First, the identifier is used as a priority to determine which message among those contending for the bus will be transmitted next. Second, the identifier may be used by receivers to filter out messages that they are not interested in, and so reduce the load on the receiver's host controller. 

1.1 Priority Based Arbitration

Priority of an Identifier defines a static message during bus access while Arbitration in CAN protocol tells us that, when the bus is free any node may start to transmit a message, if multiple nodes start transmitting at the same time the bus access conflict is resolved by bit-wise arbitration using identifier. If Data Frame and Remote Frame with the same identifier are initiated at the same time, the data Frame prevails over the Remote Frame. The CAN physical layer supports two states termed dominant (‘0’) and recessive (‘1’). If two or more CAN controllers are transmitting at the same time and at least one of them transmits a ‘0’ then the value on the bus will be a ‘0’. This mechanism is used to control access to the bus and also to signal errors. The CAN protocol calls for nodes to wait until a bus idle period is detected before attempting to transmit. If two or more nodes start to transmit at the same time, then by monitoring each bit on the bus, each node can determine if it is transmitting the highest priority message (with a numerically lower identifier) and should continue or if it should stop transmitting and wait for the next bus idle period before trying again. As the message identifiers are unique, a node transmitting the last bit of the identifier field, without detecting a ‘0’ bit that it did not transmit must be transmitting the message with the lowest numerical value and hence the highest priority that was ready at the start of arbitration. This node then continues to transmit the remainder of its message, all other nodes having backed off. The requirement for a node to be able to overwrite a recessive bit, and the transmitting node detect this change, limits the combination of physical length and speed of CAN bus. The duration of each bit must be sufficient for the signal to propagate the length of the network. This limits the maximum data rate to 1Mbit/s for a network up to 40m in length or to 125Kbit/s for a 500m long network. The arbitration mechanism employed by CAN means that messages are sent as if all the nodes on the network shared a single global priority based queue. The above high level description is a somewhat Simplified view of the timing behavior of CAN. CAN does not have a global concept of time, rather each CAN controller typically has its own clock which, within a tolerance specified by the protocol, may drift with respect to the clocks of other nodes.

The CAN protocol therefore requires that nodes re-synchronize on each message transmission. Specifically, every node must synchronize to the leading edge of the start of frame bit caused by whichever node starts to transmit first Normally, CAN nodes are only allowed to start transmitting when the bus is idle. Thus, when the bus is idle beyond the 3-bit inter-frame space and a node n starts to transmit a message beginning with the dominant start of frame bit (“0”), then all the other nodes synchronies on the leading edge of this bit and become receivers – i.e. they are not permitted to transmit until the bus next becomes idle. In this case any message that becomes ready for transmission after the leading edge of the start of frame bit has to wait for the next bus idle period before it can enter into arbitration.

Proposed Scheme

Proposed system includes the ARM7 lpc2148 microcontroller as the main controller connected with another ARM 7 lpc2148 microcontrollers acting as device 1 Here we are trying to communicate two nodes of ARM7 controller using CAN bus. Baud rate should be constant throughout the communication so as to have synchronized communication. When this data is received by the Device 1 , it is acknowledged by the Peripherals connected to the devices such as LCD.

Working Principle

Initially we are monitoring Temperature of the Industrial area with help of the temperature sensors which are connected to different channels of 10 bit ADC (channel.1: sensor, which is inbuilt for lpc2148 controller.

Those Temperature values which we have collected from the ADC are transmitted to the Controlling section board with the help of CAN engine. Before transmitting we need to initialize CAN-registers and start Transmitting the data from CAN of the Temperature Sensor board to Controlling section Board. Data values are transferred with CAN-H and CAN-L signals. Received Temperature Values from CAN of Sensor board are displayed on to the LCD by converting it to ASCII Character values. Initialization of CAN registers for Transmission as well as reception of data includes, Setting Frame structure by providing values for Identifier (11 bit/29 bit), data rate, enabling Priority control, enabling Interrupt control using Vector address for Interrupt. Here we are using data Frame and Remote Frame format for sending and receiving data.