Cross-wired Uart Ports between two Pine Boards via Cat5 Cable
#1
   

A Cat5 ethernet cable has four twisted pairs of high quality telephone wire (24 AWG) which may be used to connect the uart ports of two pine boards very effectively ( or between a pine board and a PC using a cp2102 based adapter similar to the one in the following pic. In the pic above I have four colored pairs (blue, orange, green, and brown). Each pair has a solid ie [B (blue)] and its partner the white wire with the stripe ie [Bw].  So we have [ B:Bw, G:Gw, and BR:BRw ]. I am ignoring the orange pair. 

   

The idea is to connect the uart3 of PineA to the uart0 (serial console) of PineB;  and to connect the uart3 of PineB to the uart0 (serial console) of PineA. The uart(s) of each pine board are cross-wired so that each machine (on ttyS3) may monitor the other machines boot progress on serial console uart0;  not at the same time, of course. 

The machine pictured above is machine PineB. The cable has been constructed so that all of the cross-wiring happens within the cable, so that the yellow and orange jumpers of each end of the cable plugs into uart3 (ttyS3) on the euler bus,  and the green and white jumpers plug into the serial console of each board at uart0 on the EXP header. Orange yellow is crossed with green white,  also G:Gw is crossed with Gw:G, and B:Bw is crossed with Bw:B-- this so that it does not matter which wires plug where on either board as long as both boards are plugged the same way -- they must be consistent !

   

In the pic above machine PineA is shown.  I have debian mate running on PineA, and ubuntu mate running on PineB. On each board I have the green jumper plugged into uart0 Tx, and the white jumper plugged into Rx.  Again, because the cable is constructed as a cross-over both boards are plugged the same--as long as they are consistent it does not matter.  I have the yellow jumper of each board plugged into uart3 Tx on the euler bus, and the orange jumper of each board plugged into the uart3 Rx on the euler bus for each board.

With this setup I can now monitor the bootup of either board, from the other board; of course, not at the same time. Or, from either board I may signon to the other board without a network connection using the serial console. I am using the screen program to access the ttyS3 (uart3) of each machine with :

Code:
sudo  screen  /dev/ttyS3  115200

The ends of the Cat5 cable have been removed and replaced with standard male header pins (and spacers) ; again, the orange pair has been ignored. Brown is ground, Blue and Green are the uart3 & uart0 crossed pairs, each containing a crossed Tx and Rx line.  No adapters are required; the uart(s) are simply wired together. The cable is something less than 2M and is standard Cat5.

You may need to download the screen program:

Code:
sudo apt-get install screen

   

In the pic above I'm using the same Cat5 cable with the cp2102 serial ttl bridge adapter to monitor the serial console uart0 of my ubuntu PineB machine. Of course in this setup only one twisted pair is required, and ground.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#2
pfeerick pointed out (on a recent PM) that I should make a note here about the nature of Cat5 and Cat6 cables in terms of their construction.

... many Cat5 cables (and most Cat6 cables) do not have solid core copper wires; rather, they have 24 AWG braided core copper wires-- which makes them good !

Unfortunately, it makes working with the individual wires in an experiment like the one in this post difficult, often; which requires good soldering skills. 

The trick is tinning the wires; which means, after stripping away the plastic coating of each wire we need to carefully twist tightly the braided core underneith, and then we need to coat the twisted wire with solder to hold the wrap together... this so that the solder tends to run up under the plastic wrap !  If you've never done this before, it can be a pain in the neck (just a friendly warning, but not intended to scare anyone off).

The next step is to tin the tips of the male header pins, and the final step is to 'tack' solder the tinned cable  wires to the bottom tips of the male header pins (see the pics above).

By the way, this of course does 'waste' a perfectly good Cat5 cable !   Big Grin

So, I will add the cable does not have to be one of your best cables, in fact if you have an old cable perhaps with damaged end plugs (bad RJ45 plug) use that cable. Then add this modified cable to your collection of debuging tools for use with your Pine boards and PI boards. It also works very well indeed with your Arduino boards too.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#3
I wouldn't go so far as to say wasted... using ethernet cable good is because it's a cheap and readily available source of some light guage wire. And if you have solid core wire instead of stranded wire, it is also a perfect source of wire suitable for breadboards.... so those unsed pairs might just have a use as well!  Big Grin btw, stranded wire is more flexible than equivalent solid core wire, is also a better conductor, and suffers from metal fatigue (breaking due to frequent bending) less, hence why more cables are using it. Doesn't stop them from being a PITA in comparision to their solid core counterparts when wiring your own othernet cables!  Dodgy
  Reply
#4
Have you noticed any power leakage with this setup? I did something similar - I had a USB-UART adapter that I can't use, because it's not compatible with any of my SBC's (the chip runs @ 1.8V). I realized the other day that even though I can't use the chip, I could still use the wire. So I cut off the wire and connected some header connectors.

On one pine, I connected to UART0 on the EXP connector: black to pin 6 for ground, green to pin 8 for RX, white to pin 7 for TX.

On the other pine, I connected the other end of the cable to UART2 on the Pi2: black to pin 6 for ground, green to pin 8 for TX, white to pine 10 for RX.

I've been using this setup for 2 days now and it works great - I can see all the bootup messages and can log in over the serial console, no problem. But this morning, I happened to shut down the 2nd pine, and couldn't get the red power LED to go off. I disconnected the AC power, unplugged the battery, and the light was still on. It finally went out when I uplugged the serial cable.

Did I wire something up wrong or is this a flaw in the board? Would the power going in through the UART pins have damaged anything?
  Reply
#5
(11-18-2016, 10:30 AM)psychedup Wrote: Have you noticed any power leakage with this setup?

I have noticed similar behaviour, but the other way around - if the serial adapter is connected to the pine but not plugged into the usb. I don't think you did anything wrong in your setup, there was just enough bleed through of power via the usb-to-serial to make the pine64 power led stay lit.

Edit: And unsurprisingly, there is a mention of this exact behaviour on the linux-sunxi page for the pine64...

Quote:A connected UART cable is leaking power and this causes some annoyances. For example, unplugging and plugging back a power cable does not reboot the board cleanly. Thus ensuring the availability of a reset button is recommended for doing any reasonable software development.
  Reply
#6
is it possible to use IDC connectors for this.? it would take away the stripping/tinning steps. i don't have any spare cat5. i guess it depends on the wire. i think telephone industry uses them on phone wire but that is solid core.
  Reply
#7
(11-19-2016, 02:47 PM)dkryder Wrote: is it possible to use IDC connectors  for this.?  it would take away the stripping/tinning steps. i don't have any spare cat5. i guess it depends  on the wire. i think telephone industry uses them on phone wire but that is solid core.

If you think of what used to be one of the common uses for IDC connectors - the IDE ribbon cables for computer hard drives and cddrives - they actually used stranded wire - but the beauty of IDC was no stripping or tinning was needed - you just cut the cable straight(ish)... and clipped it in the connector - it spiked the wire itself. For sure you can get 10 pins IDC connectors... but if you only want the serial link - you're much better off using single dupont connectors (as you'd need to cross-wire one end so TX goes to RX and RX goes to TX with the IDC connector). You can either buy the connectors and housings, or if you have the boards sat next to each other, buy pre-made packs of connector leads.
  Reply
#8
The best way to use connectors ( for this use case , cross-wiring between two pines ) is to use good 'ol regular RJ45 connectors. 

Make the cat5 cable youself and do the cross-over in the cable; male RJ45 standard plugs.

On the female RJ45 jacks mounted in the ABS boxes ( or where ever ) run the wiring from the RJ45 to female connectors for plug-in to the uart(s) on the respective pine boards. 

Note:   I have done this on my cross-over and it worked very nicely. I tagged my cat5 cross-over cable at each end so that its obvious to me that its NOT an ethernet cable !  I also tagged the RJ45 female jacks on the ABS boxes to denote the jack as serial console cross-over port vs  ethernet port.
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply
#9
(11-19-2016, 06:42 PM)MarkHaysHarris777 Wrote: On the female RJ45 jacks mounted in the ABS boxes ( or where ever ) run the wiring from the RJ45 to female connectors for plug-in to the uart(s) on the respective pine boards.

If you're putting RJ-45s on the ends, why not just use or wire them as ordinary Ethernet cables? Then you can use it for ethernet or as an extension for serial... and the only then the difference is the wiring past the RJ45 sockets. I don't see the point in making up special cables when there's actually nothing special about them! :-P
  Reply
#10
(11-20-2016, 12:10 AM)pfeerick Wrote:
(11-19-2016, 06:42 PM)MarkHaysHarris777 Wrote: On the female RJ45 jacks mounted in the ABS boxes ( or where ever ) run the wiring from the RJ45 to female connectors for plug-in to the uart(s) on the respective pine boards.

If you're putting RJ-45s on the ends, why not just use or wire them as ordinary Ethernet cables? Then you can use it for ethernet or as an extension for serial... and the only then the difference is the wiring past the RJ45 sockets. I don't see the point in making up special cables when there's actually nothing special about them! :-P

Yes, you're absolutely correct, if you are ever only going to connect just two boxes.  Because Rx-->Tx and Tx-->Rx the cross-over has to occur someplace  1) in box A,  2) in the cable,  or 3) in box B.   If I were just going to connect two boxes the cross-over need not be in the cable.

But I have three boxes. So, I want to be able to use the same cable between any two of the three; so the boxes are wired identically, and the cable has both pairs crossed. But, you're right, this obviously ruins the cat5 cable for ethernet.   Blush

On the other hand , its just a single 2m cable that only has to be modified for the use case once; so, its not too big a deal.  I have cat5 cables laying all over the place here.   Smile
marcushh777    Cool

please join us for a chat @  irc.pine64.xyz:6667   or ssl  irc.pine64.xyz:6697

( I regret that I am not able to respond to personal messages;  let's meet on irc! )
  Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  RPi.GPIO python module for Pine A64/A64+ aquilegia 98 129,791 12-15-2022, 08:40 PM
Last Post: Fadazo
  Exp Header UART for TTL is True Serial Console (very nice) MarkHaysHarris777 12 16,605 08-01-2016, 10:37 AM
Last Post: MarkHaysHarris777

Forum Jump:


Users browsing this thread: 1 Guest(s)