June 6, 2020

Logging Serial Boot Messages


There might be situations when your Beaglebone image might not bootup, you might be playing around with uboot , MLO/SPL or might have added a new static module to kernal that might be stopping the image to boot. In all such cases you might want to peek inside the messages sent on the serial console. One of the recomended way i have seen on various blog posts and in books is to buy a USB to ttl cable like Adafruit USB-TTL These can cost around 10 $ or so. They come with several variants of chip CP210x and FT232. One importatnt thing to keep in mind is that if you are going to use these with beaglebone boards one must buy those which convert 5v to 3.3v as beaglebone pins are only 3.3v tolerant. Anyways i am not going to show you how to use these chips, What i am going to share is that if you have more than one beaglebones laying around you can use one of them to capture the serial messages that the other spits on boot. (Who knows may be after reading this post you might buy a pocket beagle by adding 15$ and get somthing which not only can be a serial message visualiser but also can do more stuff)

Hardware Setup

I have a Pocket Beagle and a beaglebone black wireless laying around with me. I wanted to see the serial messages on pocketbeagle that are sent to the console when my beaglebone wireless boots up.To achieve this i made connections as following
On beaglebone black wireless or standard beaglebone,there is a 6 pin header adjacent to P9 header just in between the main OCTAVO chip and P9. On this header,if you start counting from the pin nearest to the barrel jack, the 1st pin is GND, 5th pin is TX and 6th pin is RX. In case of pocketbeagle on the P1 header the Pin 32 (or Pin 8 ) can act as UART RX pin.
TX (pin 5 on the serial header of beagle wireless) ----> RX (pin32 or pin8)
GND (beaglewireless)-------------------------> GND (pocketbeagle)

Software to view the messages

Your pin32 on pocketbeagle might or mightnot be configured to act as UART RX pin. To configure it
sudo config-pin P1.32 uart
NOTE: P1.32 corresponds to Pin number 32 on expension header.Change pin number accordingly if using Pin 8.
Now we need a software to view and capture the serial messages. You can use minicom or screen to do so. Install screen using following command:
sudo apt-get install screen
now to set it up to capture. Run
sudo screen -L -Logfile logMessageBoot /dev/ttyS0 115200
after running this command connect power to your beaglebonewireless through USB or barrel jack.You should start seeing text on your console.The command will log the data in logMessageBoot file which should be in your current working directory.
this file doesnot open up with every text editor it is better to transfer the data to .txt file. TO do so
cat logMessageBoot >logFile.txt
Also plese note that the ttyS0 or ttyS1 etc will work for you depends on the uart to which you have made connections