I2C with RS485 or RS232

Discussion in 'Embedded Systems and Microcontrollers' started by tdoan, Nov 6, 2014.

  1. tdoan

    Thread Starter New Member

    Jul 2, 2014
    4
    0
    Hi all,

    I am aware that USART is commonly used with RS485 and RS232 as USART only implements the link layer and does not specify anything about the electrical wave form.

    I would like to ask whether it is suitable to use I2C then a level shifter to RS485 or RS232? If no then why not?

    I believe that I2C implements both link layer and physical layer? Please correct me if I am wrong.

    Thanks heaps
     
  2. Papabravo

    Expert

    Feb 24, 2006
    10,145
    1,791
    The big problem is that I2C requires a bi-directional data line for an ACK in the middle of a frame. RS232 is inherently uni-directional. RS485 is bidirectional but would require logic to turn the bus around at exactly the correct time. This would require a state machine to track the bus traffic and be able to set the bus directions for both the Tx and Rx end of the connection. Since RS-485 is multi-drop you would have to pick one transmitter and N receivers on a bit by bit basis.

    You might have better luck with CAN Transceivers. That implementation is closer to the I2C physical layer.
     
  3. ErnieM

    AAC Fanatic!

    Apr 24, 2011
    7,392
    1,605
    How far are the units apart? If fairly close (under a foot) I2C is a good choice.

    Keep in mind nothing stops you from using serial communication without the level translation for the short haul too.
     
  4. tdoan

    Thread Starter New Member

    Jul 2, 2014
    4
    0
    They are about 1.2m apart, industrial environment so will be noisy, TTL level probably wont do it?

    I think CAN or USART together with RS485 is a better choice but I was just wondering if I2C is compatible with RS232 and RS485. Guess it's not
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,145
    1,791
    I2C is intended for connections on a single board. There is nothing inherently wrong with the idea of extending the range provided you can solve the technical problems.
    You could use an RS232 transmitter to distribute the SCL line of I2C and you could use a CAN transceiver to distribute the SDA line of I2C. It sounds kind goofy, but it might work.
    Maybe you could Use CAN transceivers for both lines.
     
Loading...