Android Things: Serial Debug Console for Linux

  • Post Author:
  • Post Category:IoT

Long story short I bricked the NXP Pico i.MX7D board that came with my Android Things starter kit. DON’T EVER FLASH A PRODUCTION IMAGE TO IT.

Unsurprisingly, all attempts to recover this board have led me down quite the rabbit hole. One of the most useful tools I’ve discovered is the serial debug console. Connect your board and it will  display the kernel log messages and provide access to a full shell prompt. It’s pretty magical ✨

The Android Things site has some instructions for working with the serial debug console but if you’re completely new to IoT like I am, you may require some additional hand holding. Below are the Ubuntu instructions. For Mac users I recommend Serial, a program so simple you won’t need instructions.

 

First Attach the Board to the Computer

First attach the board to the computer with a micro USB to USB cable. Plug the micro USB end into the board’s serial port. For now, leave the device powered off.

Screen Shot 2018-08-20 at 4.44.07 PM
Source: https://www.nxp.com/docs/en/quick-reference-guide/PICO-iMX7D-QSG.pdf

picoimx7d_debug

Ubuntu Instructions

Install minicom:

sudo apt-get install minicom

Start it in setup mode:

minicom -s

An interactive screen will pop up. Navigate to ‘Serial port setup’ and press enter.

Screen Shot 2018-05-20 at 3.32.14 PM.png

Press ‘a’ and change the ‘Serial Device’ field to ‘/dev/ttyUSB0’. Press enter to save. Then press ‘f’ to set the ‘Hardware Flow Control’ to ‘No’.

Screen Shot 2018-05-20 at 3.49.23 PM.png

Press enter to quit the configuration screen. Select ‘Exit’ to leave setup mode.

Screen Shot 2018-05-20 at 3.56.53 PM.png

 

 

 

 

 

 

Now you should see a nice terminal with not much to look at. This is because the device has not been powered on. Before doing that let’s take care of one more thing.

Screen Shot 2018-05-20 at 3.59.23 PM

Try typing something. You’ll notice nothing happens. Chances are if you need to see the serial console, you’re going to want to take advantage of the shell. Fortunately the fix is easy.

Press ctrl+a, then press ‘e’. This turns echo on. Now you can type stuff!

Screen Shot 2018-05-20 at 4.08.29 PM.png

Lastly power the board by connecting the USB to a power source. Log messages will start populating the console. You can even stop autoboot if you need (use CTRL + C).

Screen Shot 2018-05-20 at 4.12.04 PM.png