First Steps with OlinuXino iMX233

This page is mostly outdated!

See here for my experiences done with the latest image from archlinuxarm.org which was dated 07-Aug-2013.

Here is an even newer description on how to setup a system using the archlinux image dating from 01-Sep-2015.


I'm playing around with a iMX233-OLinuXino-MINI-WiFi with an Archlinux as installed on the SD-card with Linux image for iMX233-OLinuXino.

The recipes below worked on the Arch Linux image on the iMX233-OLinuXino-SD card delivered on may 2013.

The experiences done with the latest image from archlinuxarm.org which was dated 07-Aug-2013 is summarized on a different web page

iMX233-OLinuXino is a series of controller boards based on the i.MX233 processor (System on Chip, SoC) by Freescale.

Recipes

top

Get First Access to the System running from the SD-Card

To get a first access to the system, you need to get access to the serial console via UART. This is done easiest by using a USB-Serial-Cable-F.

Connect USB-SERIAL-CABLE-F to OLinuXino-MINI U_DEBUG connector:
  RED wire (Tx) to pin.1 (RX)
  GREEN wire (Rx) to pin.2 (TX)
  BLUE wire to pin.3 (GND)

Consult the iMX233-OLinuXino-MINI manual (local copy) to get all details.

Bitrate/comm settings is 115200 8n1

Login in as user root with password root

top

Configure Wlan with WPA/PSK

Create the file /etc/wpa_supplicant/my_wpa.conf

ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=wheel

network={
  ssid="my_ssid"
  psk="password"
}

Create the file /etc/network.d/my_wpa

CONNECTION='wireless'
DESCRIPTION='A wpa_supplicant configuration based wireless connection'
INTERFACE='wlan0'
SECURITY='wpa-config'
WPA_CONF='/etc/wpa_supplicant/my_wpa.conf'
IP='dhcp'

run netcfg my_wpa

top

Building Kernel Module for Asix AX88772B USB Ethernet Adapter

Download driver source from Asix website, (local copy, 2013-04-10) unpack to a directory of your choice on the OLinuXino.

Change in the Makefile the following variables:

KDIR = /usr/lib/modules/$(CURRENT)/build
DEST = /usr/lib/modules/$(CURRENT)/kernel/$(MDIR)

then run make; make install

The asix module gets automatically loaded when plugging in the USB ethernet adapter.

Create the file /etc/network.d/eth0_dhcp

CONNECTION='ethernet'
DESCRIPTION='A basic dhcp ethernet connection using iproute'
INTERFACE='eth0'
IP='dhcp'

run netcfg eth0_dhcp

top

Getting up Network Interfaces at Boot Time

In the file /etc/rc.conf change the DAEMONS variable:

DAEMONS=(set-olinuxino-mac !hwclock syslog-ng !network net-profiles netfs crond sshd)

i.e disable the static network interfaces configuration (network) and enable net-profiles via netcfg.

top

Problem with Default Package Server URL

I repeatedly had problems with pacman to access the package repositories.

I got error messages like:

error: failed retrieving file 'core.db' from ...

I had to comment the default mirror in /etc/pacman.d/mirrorlist and add a different server instead (like http://ftp.hawo.stw.uni-erlangen.de/archlinux/).

Also see Select a mirror in the Arch Linux Wiki.

top

Setting System Time via ntp (chrony)

Install package chrony via package manager:

pacman -S chrony

package chrony comes without init script (but has systemd based config included).

Edit /etc/chrony.conf, add server lines with appropriate ntp servers. Example (for Switzerland):

server 0.ch.pool.ntp.org
server 1.ch.pool.ntp.org
server 2.ch.pool.ntp.org
server 3.ch.pool.ntp.org

# INITIAL CLOCK CORRECTION
initstepslew 10 0.ch.pool.ntp.org 1.ch.pool.ntp.org 2.ch.pool.ntp.org 3.ch.pool.ntp.org

run /usr/sbin/chronyd

To get the system clock stepped to the time retrieved from an ntp server, start chronyd when taking up network interface. With netcfg this can be done by executing POST_UP command for the interface connected to the time servers (s. netcfg Tips).

i.e. create a file /etc/network.d/interfaces/eth0 containing:

POST_UP="sleep 5; /usr/sbin/chronyd"

more info on Chrony

top

Connecting a MOD-IO2

MOD-IO2 is a chainable microcontroller board with RELAYs and other IO which connects via UEXT connector to the OLinuXino-iMX233.

It uses I2C to communicate, a description of the protocol can be found here.

The source code of the firmware programmed to the MOD-IO2 and an example programm to communicate with it may be downloaded here.

A short howto to setup a linux system to control a MOD-IO2 may be found here.

top

Using GPIO Ports

iMX233 gpio ports may be controlled via the sys file system interface:
(also look at the kernel docs)

Linux GPIO ports 1-7 seem to be available for use, where GPIO0 is shared with SPP2_MISO and GPIO3 is used as UEXT_CS.

Linux GPIO port 16 seems to be available for use, but port 17 is internally used to enable USB power supply, i.e switching this off disables connected USB devices including soldered WLAN module.

Further candidates for GPIO are 51 - 53.

To use a GPIO port it must first be "exported" by writing the port number to /sys/class/gpio/export. For ports 1-7 this seems to be already done in system init.

echo 16 > /sys/class/gpio/export

Then the signal direction must be set for the port by writing either in or out to the direction file of the GPIO port, e.g.:

echo out > /sys/class/gpio/gpio16/direction

To clear and set GPIO output port, write 0 or 1 repectively to the value file of the respective GPIO port, e.g.:

echo 0 > /sys/class/gpio/gpio16/value
echo 1 > /sys/class/gpio/gpio16/value

gpio16 is associated with pin 3 of the GPIO connector of iMX233-OLINUXINO-MINI.

The table below is a combination of the two tables from the OLinuXino-MINI manual (local copy) pp. 29 and 30 listing the GPIO connector signals.
The table highlights signals which may be used as GPIO under linux where the rows highlighted in dark yellow share important on board functions.

The signals highlighted reddish seem to be initialized for I2C bus/SPI and seem not to be usable for GPIO per default.

The table on page 30 of OLinuXino-MINI manual (local copy) lists Linux GPIO20 (UEXT_SPI2_MOSI) on the GPIO connector pin 9. Pin 9 in fact is GPIO5 and there is no pin changing state when writing to GPIO20.

GPIO Connector Pin# Linux GPIO Port# Board Mark Signal Name SoC Pin# shared functions
1 - BAT BAT 103
2 - GND GND 30, 35, 98, 105, 112, 118
3 16 P17 PIN17/LCD_D16 19
4 17 P18 PIN18/LCD_D17/LAN_RES 20 USB_EN
5 7 P16 PIN16/LCD_D15 28
6 54 P19 PIN19/LCD_DOTCLK 17
7 6 P15 PIN15/LCD_D14 29
8 57 P20 PIN20/LCD_VSYNC 16
9 5 P14 PIN14/LCD_D13 26
10 56 P21 PIN21/LCD_HSYNC/I2C_SDA 15 I2C_SDA
11 4 P13 PIN13/LCD_D12 27
12 55 P22 PIN22/LCD_EN/I2C_SCL 11 I2C_SCL
13 3 P12 PIN12/LCD_D11/UEXT_CS 25 UEXT_CS
14 50 P23 PIN23/LCD_DISP 12
15 2 P11 PIN11/LCD_D10 24
16 52 P24 PIN24/LCD_WR 13
17 1 P10 PIN10/LCD_D09 23
18 51 P25 PIN25/LCD_RS 14
19 0 P9 PIN9/LCD_D08/SSP2_MISO 22 SSP2_MISO
20 53 P26 PIN26/LCD_CS 10
21 39 P8 PIN8/LCD_D07 9
22 60 P27 PIN27/PWM2 91
23 38 P7 PIN7/LCD_D06 8
24 25 P28 PIN28/SOFT_SDA 31
25 37 P6 PIN6/LCD_D05 7
26 23 P29 PIN29/SOFT_SCL 34
27 36 P5 PIN5/LCD_D04 6
28 91 P30 PIN30 81
29 35 P4 PIN4/LCD_D03 5
30 92 P31 PIN31 82
31 34 P3 PIN3/LCD_D02 4
32 - P32 PIN32/LRADC1 107
33 33 P2 PIN2/LCD_D01 3
34 - P33 PIN33/LRADC0 108
35 32 P1 PIN1/LCD_D00 2
36 - P34 PIN34/MIC 116
37 - +5V +5VUEXT 102
38 - 3.3V 3.3VREG -
39 - VIN VIN -
40 - GND GND 30, 35, 98, 105, 112, 118

Mapping of Linux GPIO numbers to iMX233-OLINUXINO-Mini Connector Pins

GPIO 40pin Connector with Linux gpio Numbering

So far I successfully tested gpio 1, 2, 4, 5, 6, 7, 16, 23, 25, 32, 33, 34, 35, 36, 37, 38, 39, 50, 51, 52, 53, 54, 57, 60, 91, 92.
This makes a 26 pins, which may be used as gpio outputs with 3.3V and may drive a red LED with a current limiting resistor of 180Ω
Outputs seem to work as open drain and do not drive a LED when switched high.

Links

top

Access Point (hostapd) with RTL8188CUS Wlan Module

hostapd from Arch Linux distro does not seem to work with the RTL8188CUS based wlan module from Olimex.

The reason seems to be the 8192cu driver module not supporting the nl80211 control interface.

When starting hostapd with debugging (-dd) activated I get output like this:

random: Trying to read entropy from /dev/random
Configuration file: /etc/hostapd/hostapd.conf
ctrl_interface_group=0
Could not open file /sys/class/net/wlan0/phy80211/name: No such file or directory
rfkill: Cannot open RFKILL control device
nl80211: RFKILL status not available
netlink: Operstate: linkmode=0, operstate=6
nl80211: Set mode ifindex 6 iftype 2 (STATION)
nl80211: Failed to set interface 6 to mode 2: -19 (No such device)
nl80211 driver initialization failed.

But there is a guy who found the sources of a hostapd modified by Realtek. He compiled this and seemed to have got a working access point.
See his description.

The sources from Realtek may be downloaded here.

Here is an other guy's posting on building a special hostapd supporting RTL8188CUS.

I downloaded the file RTL8192xC_USB_linux_v3.4.4_4749.20121105.zip from the Realtek website (under the RTL8192CU paragraph).
It contained a directory wpa_supplicant_hostapd which contained a file wpa_supplicant_hostapd-0.8_rtw_20120803.zip.
This zip file I unpacked on the target system, where it created a directory wpa_supplicant_hostapd-0.8 which itself contained a directory hostapd.
Changing to that hostapd directory and running make && make install built hostapd and installed it under /usr/local/bin.

As already mentioned, this hostapd does not use nl80211 control interface but rtl871xdrv instead.

This means that hostapd config file must have

driver=rtl871xdrv

instead of

driver=nl80211

A working example /etc/hostapd/hostapd.conf file is here:

interface=wlan0
driver=rtl871xdrv
country_code=756
hw_mode=g
channel=11
ssid=testap
#bridge=br0
logger_syslog=-1
logger_syslog_level=0
logger_stdout=-1
logger_stdout_level=2
dump_file=/tmp/hostapd.dump
ctrl_interface=/var/run/hostapd
ctrl_interface_group=0
beacon_int=100
dtim_period=2
wpa=2
wpa_passphrase=secret pass phrase

More on setting up a full fledged access point with dhcp server and internet routing can be found here.

Olimex has a description on howto build the driver module for the RTL8188CUS from the same Realtek driver zip file mentioned above.

Configure Access Point

To get a working access point, several things and services need to be set up and configured:

First: the wlan interface must be set up and have assigned an ip address.

iwconfig wlan0 mode Master
ifconfig wlan0 192.168.127.1 netmask 255.255.255.0 up

Second: a dhcp server must be listening on the wlan interface and assign address leases to requesting clients.

-> Configure the dhcp server and start it: in /etc/dhcpd.conf

# dhcpd.conf
#
# Sample configuration file for ISC dhcpd
#

# option definitions common to all supported networks...
option domain-name "example.org";
option domain-name-servers ns1.example.org, ns2.example.org;
default-lease-time 600;
max-lease-time 7200;

ddns-update-style none;
ignore client-updates;
authoritative;
option local-wpad code 252 = text;

subnet 192.168.127.0 netmask 255.255.255.0 {
  range 192.168.127.3 192.168.127.13;

  # --- default gateway
  option routers 192.168.127.1;
  # --- Netmask
  option subnet-mask 255.255.255.0;
  # --- Broadcast Address
  option broadcast-address 192.168.127.255;
  # --- Domain name servers, tells the clients which DNS servers to use.
  option domain-name-servers 192.168.127.1;
  option time-offset 0;
  default-lease-time 1209600;
  max-lease-time 1814400;
}

Start dhcpd:

dhcpd -4 -cf /etc/dhcpd.conf wlan0

Third: hostapd must be setup and configured

some helpful links

Making a WiFi Hotspot / Access Point using Linux & wifi lan card/USB adapter
Wlan mit AccessPoint
(W)LAN und Arch Linux
Software Access Point
Hostapd : The Linux Way to create Virtual Wifi Access Point
Creating a wireless access point on Arch Linux

top

Links

line
This site maintained by:
lukas.zimmermann@unibas.ch
My public PGP key
last updated: 2014-06-19 Valid CSS! Valid XHTML 1.0 Strict