combine multiple rs232/485

Discussion in 'General Electronics Chat' started by bug13, Jul 15, 2014.

  1. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    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.


    [​IMG]
     
  2. pwdixon

    Member

    Oct 11, 2012
    488
    56
    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.
     
  3. Sensacell

    Well-Known Member

    Jun 19, 2012
    1,127
    266
  4. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    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?
     
  5. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    You can do it either way.
     
  6. bug13

    Thread Starter Well-Known Member

    Feb 13, 2012
    1,208
    38
    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?
     
  7. MrChips

    Moderator

    Oct 2, 2009
    12,415
    3,354
    Do you have an MCU with four UART ports? Then it is possible to do it with one MCU using interrupts.
     
  8. kubeek

    AAC Fanatic!

    Sep 20, 2005
    4,669
    804
    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.
     
    bug13 likes this.
  9. Papabravo

    Expert

    Feb 24, 2006
    10,135
    1,786
    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.
     
    bug13 likes this.
Loading...