Continue to Site

Welcome to EDAboard.com

Welcome to our site! EDAboard.com is an international Electronics Discussion Forum focused on EDA software, circuits, schematics, books, theory, papers, asic, pld, 8051, DSP, Network, RF, Analog Design, PCB, Service Manuals... and a whole lot more! To participate you need to register. Registration is free. Click here to register now.

Physical layer for CAN protocol

Status
Not open for further replies.

mrinalmani

Advanced Member level 1
Joined
Oct 7, 2011
Messages
463
Helped
60
Reputation
121
Reaction score
58
Trophy points
1,318
Location
Delhi, India
Activity points
5,285
Confusion between CAN, RS232 and RS485

Hi
Up till now I have only worked with SPI and I2C serial protocols. But now I have a project that needs an inverter to communicate with a battery pack. The battery pack has a controller chip.
The communication options as specified by the end user are:
1. RS232
2. RS485
3. Modbus
4. CAN
Any one can be used.

After a quick internet search I got to know that RS232 and RS485 are only physical layer protocols. The MAC layer is not defined. On the other hand CAN defines all the layers except physical layer (not sure)
My question is
1. Is there some information missing that the user must provide? For example what MAC protocol is to be used with RS232 or RS485, or is there a de-facto that is understood if not explicitally told?
2. Does CAN bus have a physical layer definition?
3. Is it probably CAN with RS485 as physical layer?

Thanks
 

Does CAN bus have a physical layer definition?

Yes, CAN has a defined physical layer.

Is it probably CAN with RS485 as physical layer?
No.

Since you have experience with SPI and I2C, you can imagine CAN to be similar(to an extent). You can either use an external CAN controller IC or you can use a microcontroller which has a built-in CAN peripheral. You may need to use CAN transceiver(part of CAN physical layer implementation) between CAN controller and the CAN bus.

Regards,
Raj Gunaseelan
 
As you say, all four can be used, but you should choose the most addecuate for each application.

RS232 is used in medium lenght communications (50ft at 19200 baud, and 3000ft at 2400 baud, the longer the wire, the lower transmission speed you can achieve). It is full duplex, that means you can transfer AND receive data at the same moment. Also, data must be transmitted from one device to other, and another, and another, just in "series".

MODBUS is the same thing, the same phisical layer, but data is sent via ASCII codes, the messages starts and ends with a defined character; very used in industrial communications (PLCs, etc).


RS485 has a different phisical layer; it has the disadvantage that it is only half-duplex (only transmit OR receive at a moment, but you can make it so fastly that in most applications it isn't really a problem).
But... it can be connect multiple (as far as I remember, 128 devices) in parallel, so they can communicate between them, and if one doesn't work any more, it won't obstruct the whole bus.
Also, electrically, it consists in two wires (D+ and D-) that are inverted between them, performing a differential pair, making it -almost- immune to external noise, as transceivers only "see" the difference between both, being the "summed noise" cancelled. This helps to achieve high speed (100Kb/s) at a lenght of upto 4000ft (1,2Km).


I've been investigating a time ago, and don't find the CAN pshisical layer, but it's differential just like RS485 (taking in account what a disaster could a lost or noise-modified data pack could lead to...). The only difference is the protocol, this is how you transmit data (Start signal, speed, data order, etc).


Hope being useful.
 
Hi,

Google gives a lot of hits
One example: https://www.ti.com/lit/an/slla270/slla270.pdf

Where in chapter 4 it says:
Physical layer Requirements:

The data link and physical signaling layers of Figure 1, which are normally transparent to a system
operator, are included in any controller that implements the CAN protocol such as the Texas Instruments
TMS320F2812™ 3.3-V DSP with integrated CAN controller. Connection to the physical medium (the bus)
is then implemented through a line transceiver such as TI’s SN65HVD233 3.3-V CAN transceiver to form
a system node shown in Figure 6.


Klaus
 
The only difference is the protocol, this is how you transmit data (Start signal, speed, data order, etc).
No, there's another important difference, CAN uses dominant and recessive bit levels, the data of multiple transceivers is combined on the bus in a "wired or" manner to detect possible collisions. That's a reason why CAN can't use RS-232 or RS-484 interfaces.
 
Thanks for the reply.
One thing that is still not clear is : Do RS232 and RS485 have a communication protocol defined above the physical layer or are they just the physical layer definitions?
For example if I decide to use RS485, will I have to couple the RS485 driver IC with a serial communication block such as SPI or UART etc. or is RS485 a complete set of communication protocol in itself?
 

Hi,

Afaik the physical layer never defines a protocol. It just defines the hardware and specifies the signal (levels, timing...).

Klaus
 

Actually RS-232, RS-485, CAN, are all the layers.

Each one has their own hardware (which can be the same in some cases) and their voltage levels, timing, normalised speeds, etc. Also the order in which data is transfered.

If you use a RS485 communication, you will have to generate the communication protocol (or "lenguage") with the MCU, and then to use a driver IC (or a discrete circuit if you want) to get the TTL/CMOS levels to a differential pair.

You can "speak" any "lenguage" (protocol) using any phisical layer, but probably many ICs or slaves won't speak yours. So you will have to use a standard one, that's why protocols were created... can you imagine if you asked in this forum in english and I answered in french? Things would never get working...
 

The CAN spec specifies the physical layer and also an addressing and arbitration scheme. Because of what it tries to accomplish in terms of a bidirectional multi-device bus with addressing and arbitration it generally specifies more than either the RS-232 or RS-485 standards.

The CAN physical layer is differential like RS-485 with somewhat similar levels but, as said, is essentially open-drain in nature (which allows the arbitration and bidirectionality). CAN is a lot like a differential I2C though generally a bit more complicated and therefore more often used between microcontrollers.


If you have a single battery controller I'd consider RS-232 or RS-485 as the simplest solution. If you might have multiple batteries then CAN may be the way to go.

Note that it's easy to bridge between different physical layers to suite your needs however. Unidirectional busses like RS-485/RS-232 can be bridged to almost anything easily, for example to LVDS for a lower voltage, lower power solution.
 

Status
Not open for further replies.

Similar threads

Part and Inventory Search

Welcome to EDABoard.com

Sponsor

Back
Top