combine multiple rs232/485

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Hi guys

I am doing some research on a project that I want to work on. So the idea is combine the data from different RS232/485 (say 4) and send the data over ethernet. On the other side of the ethernet, a same device receive the data from ethernet and separate the data into original form.

So my question is: How can I do that? I am thinking using a raspberry Pi/beaglebone black to do the ethernet thing, and a MCU/just a chip to do the RS232/485 thing.


 

pwdixon

Joined Oct 11, 2012
488
You would need to develop your own protocol across the ethernet network to package the data per serial link with encoding on one side and decoding on the other. In effect you would need to put a wrapper on each serial data package that steered the link to the appropriate serial output.
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
Say my 4 com ports receive a message at the same time, how can I handle that? Do I need 4 MCU to handle each com port and buffer the incoming message, or can I use just one MCU and handle it in a smart way?
 

Thread Starter

bug13

Joined Feb 13, 2012
2,002
You can do it either way.
Which way will you do it? I need some wisdom here.

I would prefer to use just one MCU to handle it, but I don't know how to handle it when 4 com port receive data at the same time. What technique do I need to know? (So I can handle 4 ports at the same time)

Or am I looking into this with a wrong approach here?
 

kubeek

Joined Sep 20, 2005
5,776
Supposing your raspberry or beaglebone doesnt have enough hardware uarts, then my solution would be to use a dedicated microcontroller like for example some ATxmega, which has enough hardware uarts and enough ram for buffers and doesnt cost much. Then you just need to provide a simple parallel interface to read the RX and TX buffers from each channel. See 16550 and tl16c554 on how external uarts are done, and decide what of those features would be beneficial to your design.
Also dont forget that you need to be able to set individual baud rates.
 

Papabravo

Joined Feb 24, 2006
19,574
Which way will you do it? I need some wisdom here.

I would prefer to use just one MCU to handle it, but I don't know how to handle it when 4 com port receive data at the same time. What technique do I need to know? (So I can handle 4 ports at the same time)

Or am I looking into this with a wrong approach here?
The technique is called interrupts. The UART hardware will receve a character and raise an interrupt request. The CPU will prioritize and service all of the interrupt requests and then allow the hardware to process further interrupt requests. Each UART can only genrrate interrupts at a rate determined by the baudrate and the number of bits in each frame.
 
Top