1
\$\begingroup\$

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?)

\$\endgroup\$

2 Answers 2

2
\$\begingroup\$

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.

\$\endgroup\$
1
\$\begingroup\$

From just a brief glance, it appears the Due supports 4 Hardware serial ports. If you want a fifth serial, you can always do it in software on the microcontroller. Note that this is all about the serial data (rx/tx). I don't know how it handles CTS and all that. That is probably worth a question in by itself. But since you're using USB with FTDI from the Arduino back to the PC anyway, it may not make much of a difference.

You are going to have to worry about level shifting as the Due only does 3.3V, so you'll have to make sure not to exceed it.

Good luck. :-)

\$\endgroup\$
5
  • \$\begingroup\$ He'd need level shifting anyways, since it's RS422 \$\endgroup\$ Commented Jan 19, 2014 at 4:05
  • \$\begingroup\$ @ConnorWolf Concur. Just something to be aware of. :-) \$\endgroup\$
    – kmort
    Commented Jan 19, 2014 at 4:07
  • \$\begingroup\$ @kmort what does CTS stand for? \$\endgroup\$
    – canisrufus
    Commented Jan 19, 2014 at 21:19
  • \$\begingroup\$ @canisrufus Clear To Send. There's a couple others like DTR. Check out this link: en.wikipedia.org/wiki/Serial_port \$\endgroup\$
    – kmort
    Commented Jan 20, 2014 at 3:14
  • \$\begingroup\$ @canisrufus - They're "hardware flow control" lines. Basically, in the old-days, it was frequent for device to not have enough processing power to handle a continuous serial data stream. The CTS line lets the receiver tell the transmitter "I can handle more data now"/"I can't handle more data now", and the RTS lets the transmitter tell the receiver "I have data available", so the receiver could query for the data/prepare to assert CTS. \$\endgroup\$ Commented Jan 20, 2014 at 7:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.