Thursday 30 May 2013

Minix on the BeagleBone Black Part 3 - Booting

This is the third post in a 3 part mini-series on getting Minix up and running on the new BeagleBone Black. It's intended to help those interested in following my work over the summer. I'll be looking for people interested in helping test out my code as the summer goes along. In the previous posts, I described what hardware you'll need and how to cross build a Minix SD card image. In this post, I will go over terminal program setup, booting, and logging into Minix.

The first step is to take your MicroSD card and insert it into the MicroSD card slot on the bottom side of the board with the label facing up, pads facing down. Next, attach the FTDI USB-Serial Cable. Be sure you're using the 3.3V version of the cable, and also be sure that it's oriented correctly. Pin 1 is marked on the board with a white dot, it's closer to the ethernet connector than the MicroSD card slot. Pin 1 on the connector is marked with a small arrow and the insulator of the wire going to pin 1 should be black. Now plug the USB side of the USB-Serial cable into your computer. The driver should be loaded automatically. Use `dmesg` or `ls /dev/ttyUSB*` to see what device file to use in the next step. It will most likely be /dev/ttyUSB0 unless you have other USB to Serial adaptors plugged in. You can use pretty much any terminal program. I use picocom for no particular reason other than it is the first one I tried and it worked. Most programs have the proper default settings except for the baud rate which needs to be set to 115200 BAUD. Here's how to invoke picocom:

picocom -b 115200 /dev/ttyUSB0

The final step, once the terminal program is running, is to plug in the BeagleBone to a power supply. This should cause it to start booting. It will default to the MicroSD card and should start Minix automatically. Eventually, you'll be presented with a login prompt. The default login is "root" with no password. That will give you a shell where you can issue commands. As the project progresses, I'll be making posts explaining how to get started with i2c on Minix.

When you're done, you can issue the `halt` command. Minix will stop itself and print a message saying that it's okay to turn off the computer. At this point, you can remove the power supply and unplug the USB cable from your computer.

Project Introduction Video

I have uploaded an introductory video to

Wednesday 29 May 2013

Minix on the BeagleBone Black Part 2 - Software

This is the second post in a 3 part mini-series on getting Minix up and running on the new BeagleBone Black. It's intended to help those interested in following my work over the summer. I'll be looking for people interested in helping test out my code as the summer goes along. The previous post listed some suggested hardware. This post will detail how to cross compile Minix and get it on a MicroSD card. The third and final post will go over terminal setup, booting, and logging into Minix.

You'll need some sort of Linux or Unix-like system to build Minix. The system should have at least the following tools installed: git, bash, sfdisk, mcopy, dd, wget, mkfs.vfat, make, and a C compiler. Once you've got the tools installed, the next step is to get the source code from my minix-i2c repository on github and checkout the i2c branch.

git clone git://
cd minix-i2c
git checkout i2c

The next steps of building a cross compiler, cross compiling Minix, and creating an SD card image have been automated. You just need to set a few environment variables and run a script.

echo "BASE_URL=" > .settings
echo "FLAG=-DAM335X" >> .settings
echo "CONSOLE=tty00" >> .settings

After a lot of compiling, you'll be left with an image file in the current working directory named minix_arm_sd.img

Insert your SD card into your SD card reader/writer. Check the output of `dmesg` to see which device file it was mapped to. If you aren't paying attention here, you could write the SD card image to your hard drive by accident, destroying your partition table and boot sector in the process. If your card had file systems on it previously and your computer auto-mounted them, you should unmount them all. Then, write the image to the SD card with dd.

dd if=minix_arm_sd.img of=/dev/sdX bs=1M oflag=direct

After several minutes or more, dd will finish and you can remove the card. I'm not sure if it makes a difference or not, but I usually issue the sync command before removing the card just to make sure that all of the data was actually flushed to the card.

That's all for now. In my next post I'll go over how to set up the hardware, how to set up your terminal program, booting, and logging in.

Tuesday 28 May 2013

Minix on the BeagleBone Black Part 1 - Hardware

This is the first post in a 2 or 3 post mini-series about getting Minix up and running on the new BeagleBone Black. It's intended to help those interested in following my work over the summer. I'm always looking for people interested in helping test it out as the summer goes along. This post lists the hardware you'll need. Future posts will explain how to cross compile Minix, get Minix on a uSD card, and how to boot the system.

You'll obviously need a BeagleBone Black for this. In addition to that you'll need a 3.3V FTDI cable. This will enable you to connect your development machine to the BeagleBone's serial header via USB. With almost any terminal program you'll be able to interact with the Minix command line interface. Be sure to get the 3.3V version. While you can power the BeagleBone Black over USB, it may be more convenient to just get an AC adaptor and plug it into mains power. The adaptor I link to below has clips with different prongs for connecting to outlets in different countries. Choose the right one for your country. Lastly, you'll need a MicroSD card to load your Minix image on. The minimum size for Minix is currently 2GB. The class number specifies the transfer speed among other things. The higher the better as it can mean minutes when writing large images to the SD card. I chose a MicroSD card combo that comes with a full sized SD card adaptor because I have only a full sized SD card reader/writer (not MicroSD).

Shopping List:
I listed specific part numbers above because I wanted to make it easy to find the right parts. When I was initially shopping for accessories I found that it wasn't always obvious which parts would work properly with the BeagleBone Black. Note, I am not affiliated with Digikey, but I do order from them occasionally and have always been satisfied. They usually ship same day and the parts arrive the next day before noon (only $8 for shipping too!).

That's all for now. In my next post, I'll go over how to get the code from my github repository and cross compile it.

Monday 27 May 2013

Preliminary Timeline

The following is a preliminary project timeline for this summer. It lists my goals and milestones for each week of GSoC.

Community Bonding Period (May 27 - June 17) - get to know my mentor(s), interact more with the BeagleBoard community, obtain hardware, setup my development environment, read documentation, read code, do some additional planning / design work, create an audio/video presentation, create a blog, and register the project on

June 17 - June 23 - Begin coding. The first part of the week will be spent writing the skeleton code for the driver. The SoC has multiple I2C instantiations (3 for the BeagleBone black). The driver must support multiple instances, one for each bus. Once the driver is hooked into the build system and setup to start at boot I'll begin work on the code to set the registers required to take the I2C module out of reset.

June 24 - June 30 - Any work left from the previous week will be completed early in this week. Once the I2C module is out of reset, there is some initialization that needs to be done (setting the mode, interrupt masks, and DMA). The remainder of the week will be spent on the initialization procedure.

July 1 - July 7 - There are 12 I2C interrupts for the BeagleBone Black. This week will be spent developing interrupt handlers.

July 8 - July 14 - This week will be spent developing code to initiate a transfer and send/receive data.

July 15 - July 21 - Additional testing and code clean up will take place during this week. I'll do some final I2C tests and document the I2C API on the Minix wiki.

July 22 - July 28 - During this week I'll work on getting the i2cscan program from NetBSD working as well as refining any rough edges in the I2C code.

July 29 - August 4 - I will develop a simple driver to read the EEPROM on I2C 0 to further test my code (i.e. have it read board name, serial number, and revision information).

August 5 - August 11 - Begin work to enhance the frame buffer driver to query the EDID information and setup the display properties accordingly.

August 12 - August 18
- Continue working on the frame buffer driver.

August 19 - August 25 - Finish up and do more testing of the frame buffer driver.

August 26 - September 1
- Begin work on the TPS65217C driver. Setup the driver skeleton code, hook it into the build system, define the registers, and test reading the CHIPID register.

September 2 - September 8 - Continue through the datasheet developing code to read from the registers.

September 9 - September 15 - Develop code to write to the registers. Begin by developing code to handle the password protected write scheme. Then implement writing for the appropriate registers.

September 16 - September 23 - Create the concluding audio/video presentation. Tie up any loose ends. Document what's been done and what future enhancements could be made.

Included in each week but not explicitly stated over and over again are weekly status reports as well as blog posts with updates about the project and the weekly IRC meetings. I'll be on IRC throughout the project. My nick is tcort on

Project Overview

The project is to develop a generic I2C driver subsystem for Minix, and then use it to write drivers for I2C devices on the new BeagleBone Black. The primary programming language will be C, and the code will be open source under Minix's BSD-style license. These drivers will enable the community to run Minix on the new BeagleBone with drivers that allow them to take advantage of more of the hardware features. The generic I2C driver will setup the I2C registers, take the I2C module out of reset, initialize the I2C buses, handle interrupts, initiate transfers, and transmit/receive data. An interface to the generic I2C driver will be developed in Minix's libsys. The other drivers will interact with I2C through that interface. The interface will be the same that NetBSD and OpenBSD provide. The Linux I2C dev interface is similar with only a few more ioctl()s and will likely also be implemented. As a first test to verify that the basics of that interface are working, I will use NetBSD's usr.sbin/i2scan program and import it into Minix's base system. Following that, I will develop a driver for the EEPROM to get information about the board. After that, I will enhance the framebuffer driver to support EDID via the TDA19988. If time permits, I would work on the driver for the power management chip (TPS65217C). The Minix project is eager to get this code written and tested widely. Small commits will be submitted for inclusion to mainline Minix throughout the summer as code becomes production ready rather than waiting until the end of the summer and having one huge patchset.

First Post

Greetings! My name is Thomas Cort. My "Minix I2C Drivers for the BeagleBone Black" proposal to for Google Summer of Code 2013 was just accepted. I'm creating this blog to provide a place for me to post updates and general information about the project as well as pointers to my code. I'll be making several posts here before the coding officially gets underway on June 17th and then posts every week or so during the project, so stay tuned.