|
楼主 |
发表于 2006-6-29 14:01:51
|
显示全部楼层
Why Add A Serial Port?
Adding a serial port will allow you to:
Access RedBoot, the boot-loader - though you can also TelnetIntoRedBoot.
View kernel messages while the NSLU2 is booting.
Log in, if a getty is running on the serial port, which it normally is.
See any kernel panics.
Interface to peripherals with RS232 ports - though a better alternative for this is normally to use one of the NSLU2's USB ports and a USB2Serial cable.
Pinout of the J2 serial port
Pin 1 3.3V (pin 1 has a white stripe next to it)
Pin 2 RXD (from serial terminal program to NSLU2)
Pin 3 TXD (from NSLU2 to serial terminal program)
Pin 4 GND
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 cabel header can be used.
By default, both RedBoot and the Linux kernel 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 4x 0.1μF capacitors. The diagram to wire up the capacitors to the MAX3232 is available on the Maxim/Dallas Semiconductor page. You can safely omit the capacitor between Vcc and GND.
Like here:
RS232 connection with a kit
If you wish to buy a kit then the CompSys A232DBH3v Max232 adapter kit (3V version) has been used with no problems. See Rod Whitby's guide for more details.
Another board that works is this one, from Italy: http://www.picbasic.it/interfacce/page2.html . The lead has the right pinout for the NSLU2 connector.
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
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/conn ... iemens_c25_s25.html
If your cable is not powered from the DSub-side you have to connect pin 4 to J2 pin 1 (+3.3V).
For a noname cable for Siemens labeled "880880-84501" "A801-2" "Made in China", the BLACK wire is GND, the RED wire is needed for power, the YELLOW cable is data out (TX) and the GREEN cable is data in (RX)
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, so it's gotta be the cheapest serial mod on this page!
USB connection
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.
See this hack-treo page.
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"
Open the connector that connects to the cell phone, You only need 3 wires, and these connect to J2.
Below are a number of cables listed with a description of the colored wires that you need. Since clone cables might use different colors I recommend googling for the connector layout of the mobile phone you used and carefully pry the cable open (at the phone connector) and study the pinning/cabling.
For Nokia 3285 and 5185 Cable:
Pin 1 - NC
Pin 2 - Orange
Pin 3 - Red
Pin 4 - Brown/Shield
For Audiovox 8200, 8500 and 8600 Cable:
Pin 1 - NC
Pin 2 - Yellow
Pin 3 - Orange
Pin 4 - Shield
For LG 1200 Cable:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Orange
Pin 4 - Shield
For Siemens MobileAction MA-8710C Cable:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Black
Pin 4 - Shield
For Future Dial Cable 22:
Pin 1 - NC
Pin 2 - Orange
Pin 3 - White
Pin 4 - Green & Shield (twisted together)
For Nokia DKU-5 (WT048000317):
This cable seems easier to get in Australia (I got mine off eBay.) There are generic versions available, so the colours might be different. You will probably need a multimeter to find the correct wires.
From the USB/PC point of view:
GND: White (maybe also Yellow)
TX: Red
RX: Blue (apparently not Green)
You can check these with a multimeter - the voltage between GND and TX is 3.3V, and the voltage sags slightly if you send a lot of data out over the port (e.g. by holding a key down in a terminal emulator.) You can also hook up a speaker between these two wires and it should click whenever you transmit a character/press a key.
The voltage between GND and RX is about 2.5V. If you connect TX and RX together (join the Red and Blue wires) you should see anything you type echoed back to the screen (possibly appearing twice if you have local-echo enabled in your terminal emulator.) For me, this worked when I connected Red to either Blue or Green, but only Blue worked when connected to the WRT54G - nothing was received through the Green wire.
Assuming your colours are the same as mine, then:
Pin 1 - NC
Pin 2 - Red
Pin 3 - Blue
Pin 4 - White
Solder three wires from a ribbon cable to J2. On the cell phone cable, cut off all but the three wires above.
Carve a slot just below the power connector hole in the back panel that will allow you to insert the strain relief through the power supply hole and slip it down into place.
Run the cable through the power supply hole, and solder the other ends of the 3 wires to the phone data cable. You can shrink wrap, or tape the wires.
Slide the strain relief down into the slot, and slide the board back into the case. The power supply socket will lock the strain relief in place.
Plug the USB connector into your Linux box. Start minicom and set the port to /dev/ttyUSB0 115200 8N1. Power up and you will see a '+' printed. Ctrl+C will get a RedBoot prompt, or leave it alone and watch it boot.
Windows users will need a Windows driver for the Prolific USB-to-Serial adaptor, available at the Prolific Technology Inc Support Site
Accessing the terminal
The NSLU2 configure his serial port at 115200 bauds, 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 cu: /dev/ttyS0: Line in use
even if running as root, you might want to check if /dev/ttyS0 is owned by uucp. If not do a chown uucp /dev/ttyS0
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.
Acknowledgements
Thanks to paulbart, kju, m. allan noah, guidoz and Gerald L Clark.
http://groups.yahoo.com/group/nslu2-linux/message/87
http://groups.yahoo.com/group/nslu2-linux/message/1411
http://www.rwhitby.net/nslu2/serial.html - Guide for adding Serial Port with Pictures |
|