Serial adapters

From OLPC
Jump to navigation Jump to search

Connectors (serial ports) are exposed on the XO laptop motherboard which allow developers to perform advanced diagnostics. When hooked up to another computer, the serial console allows you to:

  • View firmware messages as the system is booting (even before the display is initialized)
  • Interrupt the booting process at the firmware level and execute forth commands
  • View kernel messages as Linux is booting (even before the display is initialized)
  • Access a root shell

A special cable and adapter board is needed for this. If your development efforts would benefit from having this connection available, please approach your OLPC technical contact directly or ask on the devel mailing list. Alternatively, you can construct your own adapter based on the detailed information below.

The connectors

To access the connectors, you must disassemble the laptop to the point where you can access the top side of the motherboard. See Disassembly top for instructions.

Here is what the connector looks like:

Closeup-J1.png

XO-1

The XO-1 laptop has two serial ports provided for low level debugging. One (J1) is connected to the serial console on the main processor (Southbridge, actually). The second (CN24) is connected directly to the embedded controller on the motherboard.

TODO: document the location of these connectors referring to a motherboard photo

XO-1.5

The XO-1.5 has a serial port connected to the main processor. The white connector can be found directly to the left of the DCON chip, up and to the left of the RAM (refer to XO 1.5 Motherboard).

TODO: document what this connector is labelled as

How do I get one?

OLPC-ready serial adapters are available for a small charge from http://iLoveMyXO.com in Wisconsin.

See http://twitter.com/iLoveMyXO for latest availability / announcements.

Connecting up

The OLPC serial kit includes a cable which you can connect to the connector identified above. The other end of this cable gets plugged into the serial board (also included in the serial kit). The connector on the serial board is annotated with the colours of the wires - make sure to line the connector up correctly.

On the other side of the serial board, you will see a USB B-type connector. Taking a regular USB A-to-B connection cable (not provided by OLPC, but you can find these at any computer shop, they are the same cables typically used for USB printers), connect this board to the USB port of the other computer where you will be performing the diagnosis. The device will then be recognised as a USB-serial port, and you are good to go.

Software

The TTL<->USB chip is a a FT232R made by FTDI and has drivers for all major operating systems. The serial console can then be operated through any standard terminal application using the following settings:

  • 115200 baud
  • 8 data bits
  • No parity
  • 1 stop bit
  • Handshake disabled
  • Hardware flow control disabled
    • In the USB modes the hardware flow control pins are wired so that they are de-asserted. Therefore the hardware flow control setting does not matter. The RS232 flow control lines on the DB9 were left unconnected and can float such that the flow control is asserted. So in RS232 modes hardware flow control must be disabled.
  • Initialization string: none
  • Reset string: none

Linux

The ftdi driver is included the 2.6.x series of kernels and is included by most distributions, including OLPC OS. Plug in the adapter and the kernel should create a device /dev/ttyUSB0, or later. Aliases may also be found at /dev/serial/by-path or /dev/serial/by-id. The by-path aliases are quite long, but are unique by USB socket, which is very helpful if you have many adapters.

To access the serial console, use screen, which is packaged in major Linux distributions:

screen -L /dev/ttyUSB0 115200
  • the -L flag creates a log file, such as screenlog.0,
  • use C-d to detach from the screen, then to reattach: screen -r,
  • use C-a C-b to send a BREAK. OpenFirmware responds to a BREAK by interrupting the currently executing code. Linux can be configured to respond to a BREAK.
  • use C-a C-a to send a C-a,
  • use C-a \ to terminate screen.

Another option is to use minicom, which is also packaged in major Linux distributions. Run "minicom -s" to configure the serial port with the settings suggested above. Adjust the device path (e.g. /dev/ttyUSB0). Then connect the USB adapter and run "minicom".

Windows

Download and install the driver using the instructions.

The hardware will appear as a COM device and can be operated through HyperTerminal (included in a standard Windows install).

Macintosh

The FTDI driver is not included in Mac OS X. Download and install the driver using the instructions.

The hardware will appear as /dev/tty.usbserial-SN, where SN is the serial number.

screen is also included in Mac OS X, and works well. The default port settings are adequate, with the exception of the baud rate. To connect, identify the name of the device in /dev, and start screen like this:

screen /dev/tty.usbserial-A6008ShI 115200

(A6008Shl is the serial number in this example, shell autocomplete makes this unimportant.)

Use C-a k to kill window, which causes screen to terminate.

Reassembling the system

After connecting and testing the serial console, you might want to reassemble the system. If you want to have the serial cable still accessible for quick connection of the serial board, you have a couple of options:

Run it through the side

Cable exposed through side

There are some holes in the white plastic where the green side-bumper normally gets hooked on (directly to the right of the power button and game keys). You can run the cable through here. You will not be able to properly reattach the side-bumper, you can leave it off or attach it loosely at an angle.

Jam it under the back cover

Cable exposed through cover

If you look carefully you will see that in some places, the back cover of the laptop does not make as forceful contact with the rest of the laptop in some places. You can run the cable through here.

When re-attaching the back cover, you'll have to apply some force and screw it in well. The cable will probably break at some point due the pressure here. However, it's still serving well on my XO after 2 years.

XO-1.5 caveats

On the XO-1.5, the serial board must be connected before the laptop boots. If it is connected later, it will not work until the laptop is rebooted.

On the XO-1.5, the serial port shares resources with the camera. Only one can be used at a time. If the serial board is detected at boot time, it will be used. The via-camera Linux driver attempts to detect that serial is being used and then prevents itself from loading. If this check is not working for some reason, you will see a load of junk on the serial console when the driver loads.

The exclusivity between serial and camera means that using the serial board to diagnose camera issues on the XO-1.5 is not possible.

The XO-1.5 requires the 3rd generation serial board detailed below.

Serial boards

Unless otherwise stated, OLPC will always ship the most recent serial adapter generation. Details of older devices are only for historical reference.

First generation serial adapter

First gen serial adapter

The original adapter that came with the XO-1 ´´ATest´´ boards was very simple and only does +3.3V serial to RS232 voltage level conversion. This only works on the XO-1.

Second generation serial adapter

Second gen serial adapter

The second generation adapters are able to do the conversion from LVTTL (3.3V TTL) to RS232 and USB. The also have a mode for converting RS232 to USB. In the RS232 modes they are able to work with both straight and NULL modem cables. Because of this they are a bit more complicated than the first generation adapters. They only work on XO-1.

This complexity is in the form of 2 jumper blocks on the adapters. Blocks J4 and J6.

J4: Mode select block

J4: Mode select block

J4 selects between the 3 modes of operation.

Mode 1: TTL<->USB

  • Jumper 1&2, 5&6

Mode 2: RS232<->USB

  • Jumper 3&4, 7&8

Mode 3: TTL<->RS232

  • Jumper 2&4, 6&8

Note: in the same PCB this conventions are clearly marked

J6: Null Modem block

In the RS232 modes 2 & 3, J6 will swap the TX and RX lines. Normally changing these jumpers is not necessary.

  • RS232 NULL Modem: 1&2, 5&6
  • RS232 Normal: 3&4, 7&8

To make the adapter appear like a serial port you would find on a PC you would use normal wiring. Connection between the adapter and the PC would use a NULL modem or crossover cable. Just like you would use if you were connecting 2 PC's to each other.

If you are using a serial cable that is wired to be straight through then you would use NULL modem wiring.

If you are using Mode 1 then the settings for J6 do not make any difference because the DB9 is not used.

Third generation serial adapter

Third gen serial adapter

The current generation of serial adapter is USB-only and does not have any jumper for configuration - just connect it up and go. It supports both XO-1 and XO-1.5.

Electrical details

If you want to understand more about these connectors or if you want to construct your own serial adapter board, the following information will be of use.

The signals levels are 0v/3.3volt TTL.

XO-1 Serial Ports - electrical interface

Console/Serial connector - J1

The J1 pinout of the serial connection on the laptop is:

PinFunction
1+3.3V is provided by the laptop on this pin, for use by the serial adapter
marked on PCB with white circle near the J1 designator.
2TX serial data
3RX serial data
4 GND return for both data and power
marked with a small number 4.

EC Serial connector - CN24

In addition, the EC serial connector (CN24) has an additional pin (5), used to provide a clock for programming the serial ROM in recovery mode. This pin expects a +3.3V compatible 65 MHz clock signal, if used. The EC serial port may be used for monitoring by connecting a laptop/serial adapter cable to the first four pins of the connector.

PinFunction
1+3.3V is provided by the laptop on this pin, for use by the serial adapter
2TX serial data
3RX serial data
4 GND return for both data and power
5 G3.3v 65 Mhz clock signal (optional).

The Pinout of the EC serial connector is identical to that of J1 except for the extra pin 5. The 4 pin connector works fine when plugged up to the EC serial port if its justified to Pin 1.

XO Serial Ports - physical interface

Both connectors are very close (though not quite identical) to a 1.25 pitch MOLEX picoblade. The latter will fit perfectly.

The authoritative drawing for from the manufacturer can be found at File:J1 CN24 male.pdf and File:J1 CN24 female.pdf. The dimensions are listed as CKT 4 for the J1 and CKT 5 for CN21 - both one row.

Generally the plastic connector is sold separate from the metal socket. And you assemble those by crimping a wire to the socket and then inserting it into the connector. The type of socket used requires a special crimping tool.

Some vendors sell ready made 150mm or 300mm cables; with a socket on one and and a tinned lead on the other - which means you can postpone buying the expensive crimp tool for a bit.

Molex numbers

Datasheets: http://www.molex.com/molex/products/datasheet.jsp?part=active/0530470410_PCB_HEADERS.xml (wire to board header) and http://www.molex.com/molex/products/datasheet.jsp?part=active/0510210400_CRIMP_HOUSINGS.xml (terminal and receptacle).

Right angle Molex Pico Blade 1.24 (0.49") PCB 90 degree headers (male, connector) and matching cable sockets (female); SMD is used on the board; the non SMD version can be made to fit and is slightly easier to solder; and much easier to source.

Connectorpinsboard header (male)receptacle on cable (female)
J1 4 53048-0410 (non SMD) 51021-0400
4 53261-0471 (SMD) 51021-0400
CN24 5 53048-0510 (non SMD) 51021-0500
5 53261-0571 (SMD) 51021-0500

Along with matching sockets (above female connectors are just the 'plastic receptacles'), see item 50125/50133 (http://www.molex.com/catalog/pdf/MX51021.pdf) depending on wire thickness.

Technical drawings of the board socket: http://www.molex.com/pdm_docs/sd/532610271_sd.pdf and for the receptacle http://www.molex.com/pdm_docs/sd/510210400_sd.pdf (J1) or http://www.molex.com/pdm_docs/sd/510210500_sd.pdf (CN24)

Digikey numbers

Equivalent digikey numbers (of above MOLEX-es):

Connectorpinsboard header (male)receptacle on cable (female)
J1 4 WM7622CT-ND WM1722-ND
CN24 5 WM7623CT-ND WM1723-ND

See DigiKey page 1 and DigiKey page 2 for more details.

Depending on the wire thickness - you will need 4 or 5 sockets to wire things up - which have digikey number WM1775-ND (22AW) or WM1142CT-ND (24AQ). The Crimp tools are WM9931-ND, WM9978-ND, WM9932-ND or WM9933-ND depending on the wire.

RS-Component numbers

RS Components only has the receptacles:

Connectorpinsreceptacle on cable (female)
J1 4 279-9162 (http://nl.rs-online.com/web/2799162.html)
CN24 5447-6580(http://nl.rs-online.com/web/4476580.html)

And a 300mm socket to socket premade wire can be found at # 279-9522 (http://nl.rs-online.com/web/2799522.html) - or alternatively you can order individual sockets and crimp these.

Power

The device is powered from either the 3.3V from the laptop or by USB. Both may be plugged up at the same time.

Schematics and Board Layout

Hooking up the second-generation serial adapter

On an XO-1 C board, the J1 pinout is: 2 - TX serial data, 3 - RX serial data, 4 - common ground. When the adapter_cable that came with my mini-adapter gets plugged into J1, an orangy wire connects to pin 4 (ground).

The other end of my adapter_cable has a male 5-prong plug, whereas the mini-adapter itself has a female 6-wire_socket receptacle. Unless the adapter_cable is correctly plugged in, the mini-adapter setup will not work.

Holding the mini-adapter component-side up, at the cable receptacle the PCB markings label the 1st (top) wire_socket as 'GND'. I inserted the plug end of my adapter_cable so that the orangy wire connected to that wire_socket. That let the two data wires in the cable connect to the 4th+5th wire_sockets (labeled TXO and RXI) on the receptacle. Now the serial adapter connection worked.

Third Party Adapters

Very similar adapters are readily available at relatively low cost. Some examples include:

  • DLP EVAL232R (EVAL232R)
  • FTDI Basic Breakout (DEV-08772)
  • FTDI Breakout Board (BOB-00718)