+ Post New Thread
Results 1 to 9 of 9
  1. #1
    Advanced Member level 1
    Points: 2,915, Level: 12
    Achievements:
    Created Blog entry
    mrinalmani's Avatar
    Join Date
    Oct 2011
    Location
    Delhi, India
    Posts
    406
    Helped
    56 / 56
    Points
    2,915
    Level
    12
    Blog Entries
    2

    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

    •   Alt18th December 2016, 17:49

      advertising

        
       

  2. #2
    Member level 1
    Points: 755, Level: 6

    Join Date
    Jan 2014
    Location
    Bangalore, India
    Posts
    36
    Helped
    9 / 9
    Points
    755
    Level
    6

    Re: Physical layer for CAN protocol

    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


    1 members found this post helpful.

  3. #3
    Full Member level 3
    Points: 1,230, Level: 7

    Join Date
    Aug 2014
    Location
    Buenos Aires, Argentina
    Posts
    176
    Helped
    28 / 28
    Points
    1,230
    Level
    7

    Re: Physical layer for CAN protocol

    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.


    1 members found this post helpful.

    •   Alt20th December 2016, 13:48

      advertising

        
       

  4. #4
    Super Moderator
    Points: 36,269, Level: 46
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    7,381
    Helped
    1799 / 1799
    Points
    36,269
    Level
    46

    Re: Physical layer for CAN protocol

    Hi,

    Google gives a lot of hits
    One example: http://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


    1 members found this post helpful.

    •   Alt20th December 2016, 14:02

      advertising

        
       

  5. #5
    FvM
    FvM is online now
    Super Moderator
    Points: 221,680, Level: 100
    Awards:
    1st Helpful Member

    Join Date
    Jan 2008
    Location
    Bochum, Germany
    Posts
    38,044
    Helped
    11646 / 11646
    Points
    221,680
    Level
    100

    Re: Physical layer for CAN protocol

    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.


    1 members found this post helpful.

  6. #6
    Advanced Member level 1
    Points: 2,915, Level: 12
    Achievements:
    Created Blog entry
    mrinalmani's Avatar
    Join Date
    Oct 2011
    Location
    Delhi, India
    Posts
    406
    Helped
    56 / 56
    Points
    2,915
    Level
    12
    Blog Entries
    2

    Re: Physical layer for CAN protocol

    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?



  7. #7
    Super Moderator
    Points: 36,269, Level: 46
    Awards:
    Most Frequent Poster

    Join Date
    Apr 2014
    Posts
    7,381
    Helped
    1799 / 1799
    Points
    36,269
    Level
    46

    Re: Physical layer for CAN protocol

    Hi,

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

    Klaus



  8. #8
    Full Member level 3
    Points: 1,230, Level: 7

    Join Date
    Aug 2014
    Location
    Buenos Aires, Argentina
    Posts
    176
    Helped
    28 / 28
    Points
    1,230
    Level
    7

    Re: Physical layer for CAN protocol

    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...



    •   Alt21st December 2016, 03:35

      advertising

        
       

  9. #9
    Full Member level 4
    Points: 1,840, Level: 9

    Join Date
    Feb 2014
    Location
    Boston
    Posts
    227
    Helped
    77 / 77
    Points
    1,840
    Level
    9

    Re: Physical layer for CAN protocol

    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.



+ Post New Thread
Please login
--[[ ]]--