Background on this question is here: What can I do to decrease the latency from these serial ports which are attached to a PC via a Serial to USB adapter?
I'm looking at purchasing an Arduino Due to take in 3 (well, ultimately 5, but currently 3) serial signals, one rs-232 and two rs-422. The point would be to get accurate time stamps before sending them on to a real computer for processing.
The due has a USB port, but I'd presumably have to put something together that could let the microcontroller access the serial signals.
I happen to know bupkis about hardware, though. This isn't a plea for someone to draw me up wiring diagrams (I don't actually know if wiring diagrams are relevant to this problem, and I couldn't read them [yet] if you did). I just don't have the language to research this. I would presumably have to solder things together? A serial port (x5) to a circuit board of some sort? Would the Due let me do three serial inputs? Could it support five? More importantly, how can you tell? (I'm kind of guessing that since the Due has 54 pins, and a serial port has 9 each, and 5 * 9 = 45, that the Due could support all five devices. Am I on the right track?)
Answer
The Due, which is really a Atmel AT91SAM3X8E, only has 4 full hardware serial interfaces (though there is an additional UART which may work).
The first thing I'd strongly reccomend is to stop thinking of the board as an "Arduino". The Arduino tools just paper over the actual device. It's a AT91SAM3X8E dev board.
That said, the first place to start is to read the product page and datasheet(pdf).
Functionally, RS-422 looks like a differential asynchronous serial bus. Depending on the implementation, it can be half-duplex (e.g. data can only go one way at a time), or full-duplex (e.g. data can go both directions at the same time). This mode is determined by the hardware, as full-duplex takes more physical wires. Half duplex is one differential pair (and ground), full duplex requires two diff-pairs (and one ground).
For full-duplex on a non-bus topology (e.g. only two devices), the hardware required to interface the bus can be as simple as just sticking a differential line driver/receiver in between your MCU's USART and the other device.
For bus-topologies or half-duplex connexions, it gets more complex, as you need to be able to turn off the line-driver to allow the other device(s) to talk over the shared connections.
Also, one note is you'll see lots of "RS-422/RS-485" line drivers, etc... This is because the physical layer specifications for the two are the same, so a driver that works for RS-422 will generally work for RS-485, and vice versa. In fact, there are often devices that support both protocols.
Fortunately, RS-422 looks exactly like RS-232, simply with different physical signaling levels (and one is differential). As such converting RS232 to RS422 is as simple as just sticking in a converter. (RS485 is more involved).
This means you can probably use the 5th UART in the AT91SAM3X8E for your 5th channel without issue (or you could just use it for the RS232 connection anyways).
With regard to how to actually make your device talk RS-422, you will need a RS422 driver IC. Fortunately, there are lots of options. There are even options available in DIP for easy prototyping.
Breakout boards are harder to come by, as RS-422 is pretty unusual in anything hobbyist grade. I found one, but it looks pretty poorly designed (no ground terminal!). It would probably work fine for experimentation, though.
No comments:
Post a Comment