Adding a serial console to the Buffalo Air Station WZR-1750DHP

Playing with custom kernels and OpenWRT... It took me more than a month to flash a kernel that won't boot, but I did it yesterday. So the only way was to open the case, and connect the cables to access the serial console. Here is what I learned.

Before you start

Tools

For opening the case you will need to remove two screws that are similar to those of mobile phones. I don't know the type name nor the size, so I recommend you to check type and size before starting. The screws are under the adhesive on the back of the router near the power plug and the mode button. UPDATE: Matt Sealey posted a comment saying that the screws are Torx T6. Thank you Matt!


USB to Serial

You will need something to connect your computer to the serial interface of the router. The most common solution is to use an USB to serial adapter. There are plenty of options, but I'm using this one that I bought on Ebay for less than € 10. Search for 'FT232RL' on your favorite online store.




Cables

You will also need 3 female to female breadboard wires, which are also easy to find in your favorite online store. I found a pack of 40 wires for less than € 2.



Opening the case and connecting wires

Opening the case


This is more complicated than usual for two reasons:

  • There are two hidden screws on the back of the router. One near the power connector and other near the mode button. Remove the adhesive with care so you can put it back later. The screws are similar to the ones used on cell phones, so before you start, make sure you have the tools to open it properly.
  • There is a heat sink on the part you are going to remove, and it is glued to some metallic case on the PCB. Open the case slowly and with care.
But it is not a big deal, the case is not fragile, so you can apply a little bit of brute force when opening it.


3.3V Serial vs 5V Serial

The Serial to USB usually have the option to be 3.3V or 5V. Configure it to 3.3V. On my adapter the configuration is done on the back side of the PCB.


Connecting the wires

This is easier than opening the case. The pins on the router are near the reset button on the top right. You need to connect GND, RX and TX. The labels on the picture shows where the pins of the Serial to USB adapter should be connected to. TX on the Serial to USB should be connected to the pin with the label TX on the picture below.


Connecting 3.3V pin of the router to the VCC pin of the Serial to USB adapter causes the Serial to USB adapter to power off with the router. This can make your life harder as powering off the router may freeze the terminal emulation software on your PC.


Software

How to find the device node of the serial port?

After connecting the USB to serial adapter to your computer use dmesg and look for the ttyUSB string:

$ dmesg
...
[ 7174.272428] usb 6-1.3.4: Product: FT232R USB UART
[ 7174.272434] usb 6-1.3.4: Manufacturer: FTDI
[ 7174.321779] ftdi_sio 6-1.3.4:1.0: FTDI USB Serial Device converter detected
[ 7174.321873] usb 6-1.3.4: Detected FT232RL
[ 7174.322740] usb 6-1.3.4: FTDI USB Serial Device converter now attached to ttyUSB1

So in this case it is /dev/ttyUSB1


Do my user has permission to use the serial port?

Your distro may not allow your user to access the serial port. It is easy to check with ls and groups if you have rights:

$ ls -la /dev/ttyUSB1
crw-rw---- 1 root dialout 188, 1 Apr 14 16:55 /dev/ttyUSB1

$ groups
peter wheel dialout wireshark

As the grouop dialout has read and write permission at /dev/ttyUSB1 and as I'm member of the group dialout, everything is fine. If your user is not on the correct group, fix it before continuing. Simple dirty and dangerous hack: call minicom with sudo


Which software to use?

As I'm using Linux, I tried moserial and minicom. I could made it work only with minicom. There are two magical commands to minicom: Ctrl-A Z for showing all options and Ctrl-A X to exit in a clean way.


How to configure the serial port?

Configuring the serial port to 115200 8N1 is enough to read from the console, but not to write to it. For writing, it is necessary to disable Hardware Flow Control and disable Software Flow Control.


For minicom:
$ minicom -s -D /dev/ttyUSB1

Then navigate to Sertial port setup and make sure the configuration matches the description.



After that you could Exit to go to the console or save the configuration.


Interacting with the console

I follow this order:
  1. Connect the USB to Serial to your computer
  2. Start minicom
  3. Power on the router and wait for the initialization messages
  4. Press Ctrl-C some times until you see the prompt CFE> 
Now you can start fixing your router.



Now what?

Check this out: http://wiki.openwrt.org/doc/techref/bootloader/cfe


Sources / References

Popular posts from this blog

How to tell rpmbuild the number of simultaneous jobs? (make -j)

Buffalo WZR-1750DHP + OpenWRT