Why Add A Serial Port?
Because you can!! [IF you're careful at tight-space soldering around surface-mount components, and a lot of non-experts have been.]
There are two ways that you can connect a serial port to your NSLU2: you can plug a USB-to-Serial cable in to one of its USB ports, or you can open the case and make use of the internal serial port.
Using a USB-to-Serial cable will allow you to:
See USB2Serial for more information about using these cables.
There are, however, some things that you can only do using the internal serial port. You can:
The rest of this page describes how to connect up your internal serial port.
Pinout of the J2 serial port
RXD and TXD are (LV)TTL signals (0V/3.3V), not RS-232 signals (+/-12V). This means that they cannot be connected directly to a PC serial port. Converters are discussed below.
Pin 1 is the left-hand pin.
NB: In the photo above, a set of header pins has been attached to J2. As sold, J2 consists only of a row of holes, filled with solder. First action for any of the methods below is to mount such a header (you didn't consider soldering your cable directly to the board, did you?). After that construct a cable to connect to this header using one of the methods below. As an easy starter one can cut a CDROM audio cable in two. That will give you a four pin connector with some wire to connect to. Alternately a flat cable header can be used.
Before soldering a header to the board (as opposed to separate wires), you should remove the solder from the holes. If you try to insert the header while the solder is still there, you would need to heat all holes simultaneously in order to push it through the board. Removing the solder can be done by soldering a wire to the hole (without adding extra solder) and removing it again, and possibly repeating this several times.
If you want to put the board back in the case after you connected the header, take care that it doesn't go too far through the board. If it does, it will push a bit at the case. This is enough to lock the power button in a way that prevents it being pushed.
By default, RedBoot, APEX and the Linux kernel all use 115200,8,N,1 settings.
Set DTR drop time to 0, and "modem has DCD line" to no.
Make sure that your terminal program does not send a modem init string and that you have set it to software flow control, not hardware.
RS232 connection without a kit
If you wish to construct a level converter from scratch and not buy a kit then a suitable level converter chip is the MAX3232 from Maxim/Dallas Semiconductor. In addition to the MAX3232, you will need five 0.1μF capacitors. The diagram to wire up the capacitors to the MAX3232 is available on the Maxim/Dallas Semiconductor page. You may be able to omit the capacitor between Vcc and GND, though doing so could increase noise.
(Note that there are actually 2 level converters on this chip. Don't get the wiring wrong, or you put high voltages (+/-12V) on the board!
Photos of the steps to build such a level converter can be found here (in this case its built into a Diskstation 106): http://helgen.oinkzwurgl.org/diskstation/rs232/
RS232 connection with a level-converter kit
A really good kit is the RS Link from jescab (Swedish...) RS-Link (page in Swedish but specs in english). Note that this converter is Max232-based and requires +5V to do it's magic, has points on board for adding external power. Connect TX on your board to "In" and RX to "Out" on the RS-Link.
Another board that works is this one, from Italy: http://www.picbasic.it/interfacce/page2.html . The lead has the right pin-out for the NSLU2 connector.
Yet another board is this one: http://www.futurlec.com/Mini_RS232_TTL_3V.shtml. The connectors aren't particularly convenient, but it's very cheap. If you have access to 0.1" female headers and male test pins, this is probably the cheapest approach. This board will have two serial ports, so you can use the other one for your serial port APC UPS (if one of the not-so-smart variety). The pin-out is as follows below. Note that the DB9 connectors are assumed to be female (DTE), as opposed to male (DCE). Please see RS-232 Wiki for more details.
Finally, NSLU2 RHS R128 (as viewing silk screen) is RX data only (TX is not present), connect this as follows:
Using a mobile phone data cable (DB9 serial port types)
Some mobile phone data cables are just level converters, and may be a good choice if you can get one more cheaply than the level converter kits described above. However, note that noise pick-up has been reported more often with these cables.
The Siemens S/C25, S/C/M35 and S/SL/ME/M45 phones all operate at 3.3V and the RS232 data cables are compatible. This cable is used on another embedded project. Take a look at: http://www.meshcube.org/meshwiki/ModifiedMobileSerCable (Dead link, use http://web.archive.org/web/20070820095200/http://www.meshcube.org/meshwiki/ModifiedMobileSerCable(approve sites) )
The cable should be powered from the DSub-side (PC/Terminal). The pins which are used are 1 (GND), 5(TX), 6(RX).
The Siemens-Handy-connector is shown at http://www.hardwarebook.net/connector/cellular/siemens_c25_s25.html
You can also use Nokia DLR-3P data cable. Just cut off connector and wire RED to J2 pin 1 (+3.3V), GREEN to J2 pin 2 (RXD), GRAY to J2 pin 3 (TXD) and BLACK+SHIELD to J2 pin 4 (GND). Since this cable is normally powered by phone you need to connect J2 pin 1.
The Nokia DLR-3 cable is the same hardware, but older Windows95 driver software (which you don't need). I found my cable through Froogle for $2.00 US.
Nokia DKU-5 and CA-42 clone cables are available widely, and cheaply (from US$4.00 or UKú2.50 including postage on EBay at time of writing). Instructions for identifying each pin are available at http://buffalo.nas-central.org/index.php/Use_a_Nokia_Serial_Cable_on_an_ARM9_Linkstation
FTDI sell a couple of reasonably cheap USB to 3v3 serial cables, part numbers TTL-232R-3V3 and TTL-232R-3V3-WE, which are known to work. The TTL-232R-3V3 has a 6 pin connector which can be used by swapping the pins to make it compatible with the NSLU2, while the -WE version has bare wires that you can connect up as you like. They are available from the FTDI Online Store.
Using a USB to TTL converter is nice because it seems to solve the floating RxD problem which prevents the NSLU2 from booting (see the section titled, "Serial port and picking-up mains: a word of caution" on this page). The following steps describe how to hook up the TTL-232R-3V3 6-pin connector to the NSLU2 4-pin serial port.
A USB based data cable for a mobile phone is another possibility. Most (if not all) of these cables are nothing more than an USB to serial port adapter, and as most mobile phone today are using 3.3V anyway they already have the right signal levels.
Most of the cheap cables are based on a Prolific PL2303 chipset (PL2303 datasheet ) which is supported under Windows (Driver Download) and Linux. A third party Nokia data cable for a 8000 series phone has been used with no problems. A data cables from the Siemens C25/35/45 works too. The cables from the old models (i.e. C25) costs a 2..3$.
A cheap($20) cable can be purchased at Radio Shack. The Future-Dial cables have a "dongle" in the middle that has the Prolific usb-serial chip.
Compatible Radio Shack (Future Dial) "Mobile Phone Data Cables":
- LG Models 1200, VI5225, VX4500, VX4600, VX600 - Audiovox Models 8200, 8500 and 8600 - Nokia Models 3285 and 5185 - Cable 22 (For Nokia 3100, 3200, 3585i, 3588 and others with Nokia 14-pin pop-port)
Installation of "Radio Shack Mobile Phone Data Cable for Nokia Models 3285 and 5185.", "Radio Shack Mobile Phone Data Cable for Audiovox Models 8200, 8500 and 8600.", "MobileAction MA-8710C for Siemens mobiles" and "Future Dial Cable 22"
I had something a little different:
If the phone connector can easily be opened (as in the case of my connector which I got from ebay), then you can probably even do without a multimeter. Just have a look at the pinout of the Nokia Pop-port, or this similar document with photos for the Buffalo NAS devices, and you can easily figure out which wire is connected to which pin.
Read only connection without level conversion
When I bought an USB to RS232? TTL converter running with 5V by mistake, I didn't want to buy another one just to adjust the voltage. So I read about TTL and the specs said that even 5V TTL circuits would recognize voltage greater than 2.2V as a logic one. So the 3.3V on the NSLU2s? TXD will still be enough to allow the 5V TTL chip to read the signals. What I did was connecting the 5V VCC provided by USB to the VCC pin of the converter, both GNDs? (The one of the NSLU2 and the one of USB) to the GND pin and the NSLU2s? TXD pin directly to the converters RXD pin.
With this connection I can read all the output of the NSLU2, but of course I can't write anything. Maybe I will add a little circuit to convert the 5V TXD of the converter to 3.3V so the connection will be bidirectional. But for now read only is fairly enough to debug things.
Accessing the terminal
The NSLU2 configure his serial port at 115200 baud, with 8 bits of data, no parity (8N1) If you run a Linux a box, you can use the UUCP for talking to the nslu2 by the serial port:
cu -l /dev/ttyS0 -s 115200 (for COM1).
If cu is giving you
cu: open (/dev/ttyS0): Permission denied
even if running as root, you might want to check if /dev/ttyS0 is owned by uucp. If not do a
picocom is another simple terminal program:
picocom -b 115200 /dev/ttyS0
If you run a windows box, you can use the HyperTerminal program located in accessory->Communication in the start menu. Or you can download uCon from: http://www.microcross.com/html/micromonitor.html (do a find for uCon). It's supposed to have better logging and more features. Or putty for its all-around goodie-ness.
Serial port and picking-up mains: a word of caution
Loose wires hanging off the serial connector can prevent the slug from booting properly. When this happens, the power LED stays orange and linux never boots. If a serial cable is plugged in and a serial terminal run, pressing enter will resume the booting process. This problem does not seem to occur with a TTL-232R-3V3 (see above) USB to TTL converter which makes sense, because the serial port of the NSLU2 is always connected to the FT232R IC which is used inside the cable.
This problem is caused by the mains being picked up by wire and injected into the RX pin as a 1.6V, 50Hz signal (measured with a scope).
There are two cases where this could be a problem:
This illustrates the second case: User drilled a hole under the power connector and fitted a 2.5mm stereo jack socket to bring the serial lines to the back. The NSLU2 will boot when the socket is used, but not when the serial cable is unplugged from the NSLU2. The 10cm cables between the socket and the PCB connector were causing the problem.
The following experiment was conducted to trace the problem:
Connect a 3K resistor between pins one and two of the serial port pads on the SLUG and the problem will go away. Any TTL level driver can drive into 3K yet the resistance is low enough to prevent AC pick-up.
Thanks to paulbart, kju, m. allan noah, guidoz and Gerald L Clark.
You can find yet another example of serial port h/w implementation at http://p13r0.no-ip.info/g604t/RS232_howto.zip(approve sites)
To set the port free from the Linux prompt (in other words: to let my application use that serial port), I did this (tested on Unslung 6.10 only):
This page is password protected.
The password is "serialport". Let's see if that stops the automated wiki spam.
view · edit · print · history · Last edited by tester12.
Based on work by tester12, Piero, groost, compn, Nathan Zadoks, Mike, a, MXL, ByronT, TimSmall, Christoph Pegel, Rob Lockhart, LJR, nilsandreasdreicsystemsde, Bas Wijnen, me, BrianZhou, bwalle, dyoung, Chris, mhx, fcarolo, Peter Taylor, bekuul, rvczbx, stappers, trbdcg, chris, uwouto, Isan, suampk, PatrickSchneider, analoav, jerrinot, analxii, rwhitby, xhqofm, Phil Endecott, aqeikw, restorer, xxlhnu, ismo, tqhxzv, xsvumr, flipflip, davidc, dumfrac, ths, Ayden, Peter Enzerink, Bullfrog, Reedy Boy, krakker, Dave Hrynkiw, phil endecott, Gordon, zzdomi, NeoMatrixJR, Egor Zindy, eFfeM, Lurch, Adam Nielsen, Patrick Schneider, Charles Turner, Michiel Leegwater, endecotp, jr, zoobab, rpedde, tylerl, alecv, repvik, tman, and dmahurindmaorg.
Originally by tman.
Page last modified on February 11, 2014, at 08:15 AM