Sunday, August 26, 2012

Getting started with Olinuxino-Micro

Finally purchased a micro last week.  This weeks goals are for this tutorial:
  1. Compile Linux, File system and tools using OE.
  2. Solder SIP connector to allow using a bread board
  3. Connect RS232 TTL USB converter to see boot messages
    1. An app note:  Must use a Schottky diode on transmit to not cause SD Card issues.  See user manual.
  4. Compile Linux, File system and tools using OE.
  5. Test USB wireless Wifi
  6. Test I2C
  7. Post some example using Lua for accessing i2c

Basics

- I'm using Ubuntu 12.04 as the host OS, if using windows, setup a VM using VirtualBox Please post any questions on doing this.
- Fast internet connection.  OE, Open Embedded downloads several gigabytes of data
- Fast PC, atleast a dual core.
- Plenty of disk space, 20GB
- Soldering iron for adding SIP connectors
- A TTL RS232 to USB converter
- Couple of bread boards
- Pre-made wires (Male to Male, and Male to Female)
- Schottky diode (I'm not using this one, found one at the local electronics store)  This is used to protect voltage feedback from damaging the micro SD card
- micro SD card

Building the code 

The user manual uses the same basic instructions as posted on github. Here is the steps to setup the BSP source (copied from the instructions):

Freescale's Community Yocto BSP
===============================

To get the BSP you need to have `repo` installed and use it as:

Install the `repo` utility:

$: curl https://dl-ssl.google.com/dl/googlesource/git-repo/repo > ~/bin/repo
$: chmod a+x ~/bin/repo

Download the BSP source:

$: mkdir fsl-community-bsp
$: cd fsl-community-bsp
$: repo init -u https://github.com/Freescale/fsl-community-bsp-platform -b denzil
$: repo sync


Then I do the following:
 MACHINE=imx233-olinuxino-micro . ./setup-environment build
instead of
$: . ./setup-environment build

This will setup the MACHINE or platform to build Linux OS to.  So, this way you don't have to change the conf file.

Then execute:
 bitbake -c menuconfig busybox


This will take some time, downloads a lot of code, compilers, etc.  What this step does is display a menu to configure busybox.  (Right now, the goal is to build and get running ASAP, later more details can be provided on what this process is all about. )

The purpose is to configure busybox to provdide the command lsusb Start a terminal in Ubuntu and type lsusb.  This utility displays all of the USB devices connected to your computer.  It is helpful to get this information to see if Linux supports this device. 

bitbake -c menuconfig linux-imx

Since this is a simple core-image-minimal, if you want to add wireless tools, i2c-tools etc, you have to edit the local file in ./fsl-community-bsp/build/conf/local.conf and add a line for more packages to get built and loaded into the image. Here is a the one I use:

MACHINE ??= 'imx233-olinuxino-micro'
DISTRO ?= 'poky'
PACKAGE_CLASSES ?= "package_rpm"
EXTRA_IMAGE_FEATURES = "debug-tweaks"
USER_CLASSES ?= "buildstats image-mklibs image-prelink"
PATCHRESOLVE = "noop"
CONF_VERSION = "1"

BB_NUMBER_THREADS = '2'
PARALLEL_MAKE = '-j 2'

IMAGE_INSTALL_append = " wpa-supplicant wireless-tools bluez4 bluez-hcidump i2c-tools hostap-utils"

Notice the line with IMAGE_INSTALL_append this adds projects that have recipes but not apart of the core-image-minimal recipe.  Will have more info if requested.



bitbake core-image-minimal -v

Also, if you want a GUI, instead of bitbake type hob  hob is a graphical user interface which is bitbake is part of.  It shows the packages and tasks.

But, hob cannot add packages to the image, only the IMAGE_INSTALL_append, to bad there was not a way to do this via the GUI.






The goal is to create a monthly How To using the BeagleBone and Olinuxino-Micro using simple examples.  Over the past several years I've been using simple micro-controllers attempting to provide host USB and wireless (WiFi/BlueTooth) services. Just until last year a large number of boards under $100 i.e. BeagleBone and now the Micro (Under $30) can a wider range of wireless support by using off the self Wifi and Bluetooth dongles.  Each support Linux, so,  the sample examples will apply to both boards.  The main difference will be in the number of services supported, the Micro only has 64MB of RAM, so, some of the applications will be scaled to meet memory limitations.