Saturday 27 February 2016

Interview Questions on Controller Area Network



1) What is CAN(Controller Area Network)?

Ans: Controller Area Network(CAN) is a serial communication protocol originally developed by Robert Bosch for exchanging informations between Electronic Control Units(ECU) connected in a vehicle together.


2)Why CAN is having terminating resistance of 120ohms at each end?


Ans: Controller Area Network(CAN) uses 120 ohms of resistances at each end to match the network impedance. When network resistance matches with the terminating resistance then there will not be any reflections in the network according to Maximum Power Transfer Theorem. Whatever the voltage level sends by CAN node will be completely delivered to the terminating load(Resistance).

Let us take the case of CAN does not have 120 ohms terminating resistance. If a CAN node wants to send consecutive bit sequence of 101. For 1(Recessive)bit, CAN transceiver maintains 2.5V across each CAN High and CAN Low. For 0(Dominant)bit, CAN transceiver maintains 3.5V on CAN High and 1.5V on CAN Low. If there is reflection because of improper terminating resistance then they there will be reflection on network line.

In case of dominant bit(0), the CAN transceiver feedback line will read intermediate voltage rather than 3.5V on CAN High and 1.5V on CAN Low. This leads to CAN bit error because, CAN transceiver expects same voltage on feedback line as maintained by the CAN transceiver for sending out a bit.

3)Why Controller Area Network is an asynchronous communication protocol?


Ans: Controller Area Network(CAN) does not use of external clock signal for data transmission. Synchronization between transmitter and receiver is being done by falling edge of CAN line .i.e from recessive bit(1) to dominant bit(0).

4) Explain Controller Area Network(CAN) standard frame bit fields?









The meaning of the bit fields are:

• SOF(Start of Frame):–The single dominant start of frame (SOF) bit marks the start of a message, and is used for synchronization between transmitter node and receiver node. SOF will be always from Recessive bit to Dominant bit which makes the falling edge.Whenever CAN node sees falling edge then controller adjusts its clock for incoming signal.

• Identifier-The Standard CAN 11-bit identifier establishes the priority of the message. The lower the binary value, the higher its priority. These 11 bit identifier is used for arbitration.

• RTR–The single remote transmission request (RTR) bit is dominant (0) for data frames and recessive (1) for remote request frames.

• IDE–A dominant single identifier extension (IDE) bit means that a standard CAN identifier with no extension is being transmitted. This bit is used to maintain backward compatibility between extended CAN and Standard CAN frame.

• r0–Reserved bit(Reserved for future expansion).

• DLC–The 4-bit data length code (DLC) contains the number of bytes of data being transmitted.

• Data–Up to 64 bits of application data may be transmitted.

• CRC–The 16-bit (15 bits plus delimiter) cyclic redundancy check (CRC) contains the checksum (number of bits transmitted) of the preceding application data for error detection.

• ACK–Every node receiving an accurate message overwrites this recessive bit in the original message with a dominate bit, indicating an error-free message. When a receiving node detect an error then leaves this bit recessive, it discards the message and the sending node repeats the message after rearbitration. In this way, each node acknowledges (ACK) the integrity of its data. ACK is 2 bits, one is the acknowledgment bit and the second is a delimiter.

• EOF–This end-of-frame (EOF), 7-bit field marks the end of a CAN frame (message) and disables bit-stuffing, indicating a stuffing error when dominant. When 5 bits of the same logic level occur in succession during normal operation, a bit of the opposite logic level is stuffed into the data.

• IFS–This 7-bit interframe space (IFS) contains the time required by the controller to move a correctly received frame to its proper position in a message buffer area.



5)If there is only one node on the bus and it is transmitting messages on the bus continuously, what will happen? will node go into the bus-off state or what happens?


Ans: Since there is only one CAN node on the bus, and it transmits messages on the bus continuously, since there is no other node for receiving the CAN messages in the above case,always there is an Acknowledgement error and the node will continue to retransmit the frame until it receives an acknowledgement. Obviously there is no receiver on the bus, no acknowledgement,Error Frames are transmitted on the Bus and finally the CAN transmitter node goes into Bus-off State ans stops transmitting messages until next reset.



6)If there are only two nodes on the bus, and both are transmitting same identifier(exactly the same identifier),who will win the arbitration or what happens?

Ans: If two nodes try to transmit a message with same identifier then both nodes access the network because there will not be any conflicts between two nodes. Both nodes think that it is transmitting message. If the data filed in any of the nodes differ then there will be bit error set by a node,  which tries to send recessive bit, Once it detects an error frame then it stops transmitting message on the network. Node will again try to re transmit the message once the network is idle.



7)Is CAN full duplex?

Ans:
CAN is not full duplex. It is a half duplex communication system because it either transmits or receives a message. It can not do both transmission and reception at a time. Like full duplex RS232 communication system CAN does not have dedicated transmission and reception line. Same line(s) is(are) being used for both transmission and reception based on physical layer.


8) What is the use of Interframe space in CAN?
Ans: IFS– 7-bit interframe space (IFS) contains the time required by the controller to move a correctly received frame to its proper position in a message buffer area.

9) What will happen if an ECU configured for 500Kbps and ECU configured fir 1Mbps, are connected to the same CAN bus and starts communication?
Ans: Communication will stop. Node will go to bus off state. Which node will first enter into bus off state depends on which controller tries to transmit more number of messages. When there are different baud rates, there will not be synchronization between nodes, both nodes will not understand each other. Node will acknowledge each other for the messages sent. Which keeps incrementing Error counter. Eventually will reach busoff  state and Stops communication. 

1 comment:

  1. can u plz explain me below

    1.whta is the use of delimiters and reserve bite in CAN Frame

    2. Why bit stuff happens after 5th bit; why not after or before 4th or 6th bit?


    ReplyDelete