How to convert an I2C interface to an RS422 interface.

Thread Starter

bobthedylan

Joined Jun 6, 2020
1
Hi All

I'm pretty new to this world, and I'm struggling a bit to understand what I need to do to solve this problem. I don't need a detailed solution at this point, I'm more looking for the general steps that I'll need to take.

Basically I have a computer chip, it has a microcontroller, an I2C interface and a CAN interface.

I need to connect this component to another one through an RS422 synchronous link. There is no RS422 available on the chip, so I presume I'll need to implement one. I have the required pin-out for the RS422.

Am I correct in thinking the following:
- I'll need to make or buy an interface IC, to convert the I2C to an RS422.
- There is a dock for the chip, and there's room for an expander board in the dock. This interface IC can be placed on the expander board

Is there a limit on how many interfaces can use the I2C? From what I read it seems that it can handle quite a large number.

I'm sure there's a lot I've missed. As I said, this is the first time I've worked on something like this and I don't really know what I'm doing. Any help or pointers would be really appreciated.

I am not experienced in this area so I don't know if I've provided enough information. I can give more if needed.
 

MrChips

Joined Oct 2, 2009
30,708
Welcome to AAC!
This is an unusual request which I have not encountered before, perhaps because of my lack of experience with CAN bus.

I2C and RS-422 are two different things.
It is like comparing the engine of a car with it‘s wheels. Maybe I am wrong and maybe another member will be able to set you straight.
 

Papabravo

Joined Feb 24, 2006
21,159
Welcome to AAC!
This is an unusual request which I have not encountered before, perhaps because of my lack of experience with CAN bus.

I2C and RS-422 are two different things.
It is comparing the engine of a car with it‘s wheels. Maybe I am wrong and maybe another member will be able to set you straight.
I2C is bi-directional, single ended, and half duplex. RS-422 is none of those. I don't think this has a prayer of working. As always, you are more thane welcome to try anything you set your mind to. You might even discover some "new physics".
 

AlbertHall

Joined Jun 4, 2014
12,345
Presumably the microcontroller could 'bit-bang' some pins to create or receive the appropriate signals but you would need some sort of driver to send and receive the differential signals required.
 

Papabravo

Joined Feb 24, 2006
21,159
If I were doing this I would uses RS-422 with a higher level protocol and a microcontroller at each end. The micro on the local I2C bus could send and receive the data over RS-422 with the other processor. UARTS on either end of the RS-422 would work just fine for a full-duplex point-to-point connection.
 

MrChips

Joined Oct 2, 2009
30,708
I agree with Pb. You cannot connect I2C to RS-422.

What you need to do is to transfer the data from one device to another.
Firstly, you connect to the I2C device and get the data. Once you have the data you can send it to another device using whatever protocol is required.
 

JohnInTX

Joined Jun 26, 2012
4,787
A good approach would be to use a microcontroller with an I2C peripheral and a UART peripheral to create a bridge between the two protocols. I've done several protocol/interface converters using PIC microcontrollers over the years so it's possible. In general you buffer the received I2C and as characters are received, send them to the UART. Another buffer is used to send UART received to I2C either as a master or a bus slave that gets polled periodically.

It's somewhat involved to do but not too bad if you have some experience in the art:
I2C slave -> I2C receive protocol handler -> character buffer 1 -> RS422 protocol transmit handler -> UART TX
I2C master <- I2c transmit protocol handle <- character buffer 2 <- RS422 protocol receive handler <- UART RX

If you're not up to rolling your own, Arduino has lots of libraries to help.
You might also take a look at one of @danadak 's PSOC (programmable system on a chip) setups that can be programmed visually using drag and drop blocks. They have inexpensive demo boards.
Microchip Curiosity HPC would work, too. These have built in debugger/programmers and accept Mikroe 'click' boards for the UART -> RS485. I2C is built in. The learning curve is a bit more steep but with the XC8 free C compiler and MCC (code generator libraries) you should be able to get something running.
Microchip also has AVR/ARM stuff on the Curiosity platform but I haven't used those.
Searching 'i2c to rs485' on Google brings up some things as well.

Lots of options,
Good luck!
 

MrChips

Joined Oct 2, 2009
30,708
I think that this is not what the TS wants to do.
MAX3107 is a UART that can be configured and controlled using I2C.
TS needs to convert data packets from I2C to serial RS-422.
 

Deleted member 115935

Joined Dec 31, 1969
0
"Basically I have a computer chip, it has a microcontroller, an I2C interface and a CAN interface. "

your dead right

Both are physically different interfaces and both have a protocol on them.

I assume the I2C is the master,

You write a protocol on the micro that receives I2C, in your protocol, and then writes it out as the CAN protocol you want.

https://forum.arduino.cc/index.php?topic=21190.0
 

schmitt trigger

Joined Jul 12, 2010
868
The single-post TS has not yet replied back, which means that he has understood that "a chip" that performs a direct I2C to RS422 conversion is not available, or he has been overwhelmed by the amount of responses, which some newbies can find daunting.

But in my opinion it is best to have many than no responses to a query.
 
Top