Wednesday, December 26, 2012

Using wpa_supplicate with buildroot

Using wpa_supplicant with buidlroot 
  • Buildroot does not provide scripts ifup/ifdown integrated with wpa_supplicant
    • Ubuntu/OpenWrt and others have scripts that parse interfaces file to start tools 
    • So doing this by hand
      • wpa_supplicant start -iwlan0 -c/etc/wpa_supplicant.conf &
        • Configures wifi and makes a connection then the connection is made need to start a ifup.
      • ifup wlan0 (This kicks off the dhcp client)
  • Will publish more on this issue again.. Might just use openwrt for this..

Monday, December 24, 2012

Working with Micro and buildroot

Have made progress on several projects
  1. imx28-evk (http://www.freescale.com/webapp/sps/site/prod_summary.jsp?code=MCIMX28EVKJ)  HW updated the board to have a SPI 8MB chip.
    1. Have a working u-boot boot from SPI flash
      • Customized u-boot imx28-evk 
      • Customized mxsboot to format the image to be loaded by SPI
    2. Have a working linux 3.7 kernel image boot from SPI flash
      • Using squashfs for ROM file system
      • Using mtdparts to segment flash 
      • Using JFFS2 for write flash area
    • Currently testing a method to program production boards from JTAG or USB.  HAve tried using JTAG Here is the issue https://community.freescale.com/thread/302010
    • So, now u-boot is loading but SPI flash access is not correct.  So, looking at the issues why  boot cannot access SPI flash
  2. Micro board (https://www.olimex.com/Products/OLinuXino/iMX233/iMX233-OLinuXino-MICRO/)
    1. Have buildroot creating a linux 3.7.1 image able to
      1. Connect wifi dongle connect to internet
        1. There is a kernel issue in the driver that dumps time out .  This is due to i2c DMA not timing out.  Have a custom driver to add DMA clear to fix time outs.
      2. Connect to Wii numchuck via i2c 
        1. Will change to use a classic controller
        2. Next need to add a case and power supply.  This will serve as controller to quad copter.
        3. Here is the power supply: https://www.sparkfun.com/products/11496
  3. Teensy3 (http://www.pjrc.com/store/teensy3.html) and Android 
    1. This little board is an ARM Cortex M4 (floating point) with USB (host/device)
    2. I've modified the USB descriptors  to support a bulk endpoint In/OUT
    3. Created an Android App to talk to the board via USB client.  Most cell phones support USB OTG, so all what is need is a simple converter cable:
      1. http://www.amazon.com/eForCity-Micro-USB-OTG-Adapter/dp/B005QX7KYU
      2. Connected the cable to my Samsung III loaded the Teensy USB Android app. now they are connected.
      3. My goal is to port some of IOIO and connect a WII classic or WII numchuck and use it the same was the above Micro board.  The phone has an internal wifi antenna the range is not good, but for close range good enough.  The micro has an external Wifi board using a Alfa which supports one watt of power.  So, should get about 1km of range. Also, now can use a better radio ie http://www.rctimer.com/index.php?gOo=goods_details.dwt&goodsid=817&productname=  One rado connected to teensy 3.0 the other on the beaglebone
      4. The android app uses simple USBHost mode and bulk API to communicate. 

  4. BeagleBone
    1. Restarted this project using Buildroot
      1. Fast boot time, 10 seconds or less
      2. Common startup ie Micro and imx28-evk
    2. Using buildroot to make:
      1. MLO
      2. u-boot
      3. Linux

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.