iMX233-OLinuXino: Current State

This post is work in process so print it into an PDF file if you want to keep an older version as reference.

The Kernel

Please have a look at Building a kernel 3.x for the iMX233-OLinuXino for more detailed build instructions.

You can use a kernel straight from https://www.kernel.org/:

[chris@thinkpad OLinuXino]$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/stable/linux-stable.git linux-stable.git
[chris@thinkpad OLinuXino]$ cd linux-stable.git/
[chris@thinkpad linux-stable.git]$ git checkout v3.12
[chris@thinkpad linux-stable.git]$

Note

There is also linux-next with some more bleeding edge kernels:

[chris@thinkpad OLinuXino]$ git clone git://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git linux-next.git
[chris@thinkpad linux-next.git]$ git checkout next-20130909

To add support for i2c we need to apply the following patch:

[chris@thinkpad linux-stable.git]$ wget https://raw.github.com/koliqi/imx23-olinuxino/3.12-rc2/kernel/0001-ARM-imx23-olinuxino-Add-i2c-support.patch
[chris@thinkpad linux-stable]$ patch -p1 < 0001-ARM-imx23-olinuxino-Add-i2c-support.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
patching file arch/arm/boot/dts/imx23.dtsi
Hunk #1 succeeded at 306 with fuzz 2 (offset -1 lines).
Hunk #2 succeeded at 472 (offset -1 lines).
[chris@thinkpad linux-stable.git]$

And to get a spi device we need to apply the following patch:

[chris@thinkpad linux-stable.git]$ curl -L http://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.12-rc3/0005-ARM-imx23-olinuxino-Add-spidev.patch/download -o 0005-ARM-imx23-olinuxino-Add-spidev.patch
[chris@thinkpad linux-stable.git]$ patch -p1 < 0005-ARM-imx23-olinuxino-Add-spidev.patch
patching file arch/arm/boot/dts/imx23-olinuxino.dts
[chris@thinkpad linux-stable]$

Now lets configure and build the kernel:

[chris@thinkpad linux-stable.git]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- mxs_defconfig
  HOSTCC  scripts/basic/fixdep
  HOSTCC  scripts/kconfig/conf.o
  SHIPPED scripts/kconfig/zconf.tab.c
  HOSTCC  scripts/kconfig/zconf.tab.o
  HOSTLD  scripts/kconfig/conf
#
# configuration written to .config
#
[chris@thinkpad linux-stable.git]$

Note

You can start with my kernel configuration if you want, then you don’t have to change anything when running menuconfig:

[chris@thinkpad linux-stable.git]$ curl -L http://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.12/dotconfig/download -o .config
[chris@thinkpad linux-stable.git]$ cp .config dotconfig
[chris@thinkpad linux-stable.git]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- oldconfig
...
[chris@thinkpad linux-stable.git]$
[chris@thinkpad linux-stable.git]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- menuconfig

Note

To be sure to built all modules directly into the kernel and not as loadable modules you can execute the following command: sed -i 's/=m/=y/g' .config

[chris@thinkpad linux-stable.git]$ diff .config dotconfig
1233c1233
< CONFIG_GPIO_GENERIC_PLATFORM=m
---
> CONFIG_GPIO_GENERIC_PLATFORM=y
[chris@thinkpad linux-stable.git]$ sed -i 's/=m/=y/g' .config
[chris@thinkpad linux-stable.git]$ diff .config dotconfig
[chris@thinkpad linux-stable.git]$
[chris@thinkpad linux-stable.git]$ make -j4 ARCH=arm CROSS_COMPILE=arm-none-eabi- zImage modules
scripts/kconfig/conf --silentoldconfig Kconfig
  WRAP    arch/arm/include/generated/asm/auxvec.h
...
    CC      arch/arm/boot/compressed/fdt.o
    CC      arch/arm/boot/compressed/atags_to_fdt.o
    SHIPPED arch/arm/boot/compressed/lib1funcs.S
    AS      arch/arm/boot/compressed/lib1funcs.o
    SHIPPED arch/arm/boot/compressed/ashldi3.S
    AS      arch/arm/boot/compressed/ashldi3.o
    LD      arch/arm/boot/compressed/vmlinux
    OBJCOPY arch/arm/boot/zImage
    Kernel: arch/arm/boot/zImage is ready
    Building modules, stage 2.
    MODPOST 0 modules
[chris@thinkpad linux-stable.git]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- imx23-olinuxino.dtb
  CC      scripts/mod/devicetable-offsets.s
  GEN     scripts/mod/devicetable-offsets.h
  HOSTCC  scripts/mod/file2alias.o
  HOSTLD  scripts/mod/modpost
  DTC     arch/arm/boot/dts/imx23-olinuxino.dtb
[chris@thinkpad linux-stable.git]$

Now you have two files arch/arm/boot/zImage (the kernel) and arch/arm/boot/dts/imx23-olinuxino.dtb (device tree blob) which is everything you need to run the kernel on the OLinuXino.

Note

If you want to repeat this procedure, start with clean-up:

[chris@thinkpad linux-stable.git]$ make ARCH=arm CROSS_COMPILE=arm-none-eabi- distclean

You will find these files under: http://sourceforge.net/projects/janncc/files/olinuxino/kernel/3.12

U-Boot

Please have a look here.

Installing

U-Boot

[chris@thinkpad OLinuXino]$ curl -L http://sourceforge.net/projects/janncc/files/olinuxino/u-boot/uboot_v2013.07_sjtag/u-boot.sb/download -o u-boot.sb
[chris@thinkpad OLinuXino]$ curl -L http://sourceforge.net/projects/janncc/files/olinuxino/u-boot/uboot_v2013.07_sjtag/MD5SUM.TXT/download -o MD5SUM.TXT
[chris@thinkpad OLinuXino]$ md5sum -c MD5SUM.TXT
u-boot.sb: OK
[chris@thinkpad OLinuXino]$ sudo dd if=u-boot.sb of=/dev/mmcblk0p1 bs=512 seek=4
[chris@thinkpad OLinuXino]$ sudo mount /dev/mmcblk0p2 /mnt/olinuxino/
[chris@thinkpad OLinuXino]$ sudo vim /mnt/olinuxino/boot/uEnv.txt
[chris@thinkpad OLinuXino]$ cat /mnt/olinuxino/boot/uEnv.txt
#These are the default settings for some useful u-boot variables:
#Uncomment to override...

fdt_file=/boot/imx23-olinuxino.dtb
optargs=
mmcroot=/dev/mmcblk0p2 rw
mmcrootfstype=ext4 rootwait fixrtc

[chris@thinkpad u-boot.git]$

The Kernel

[chris@thinkpad ~]$ cd local/OLinuXino/linux-stable.git/
[chris@thinkpad linux-stable.git]$ sudo cp arch/arm/boot/zImage /mnt/olinuxino/boot/
[chris@thinkpad linux-stable.git]$ sudo cp arch/arm/boot/dts/imx23-olinuxino.dtb /mnt/olinuxino/boot/
[chris@thinkpad linux-stable.git]$ sudo umount /mnt/olinuxino
[chris@thinkpad linux-stable.git]$

Now it should boot.

...
[  OK  ] Found device /dev/ttyAMA0.
         Starting Serial Getty on ttyAMA0...
[  OK  ] Started Serial Getty on ttyAMA0.
[  OK  ] Started Login Service.

Arch Linux 3.12.0-dirty (ttyAMA0)

olinuxino login:
[  OK  ] Started OpenNTP Daemon.

Arch Linux 3.12.0-dirty (ttyAMA0)

olinuxino login: root
Password:
Last login: Wed Dec 31 18:02:20 on ttyAMA0
[root@olinuxino ~]#

I haven’t tested everything yet so if you encounter a problem with the new kernel just leave a comment.

WiFi is working at least:

[root@olinuxino ~]#
[ 2301.080000] usb 1-1: new high-speed USB device number 2 using ci_hdrc
[ 2301.270000] usb 1-1: ath9k_htc: Firmware htc_7010.fw requested
[ 2301.460000] usb 1-1: ath9k_htc: Transferred FW: htc_7010.fw, size: 72992
[ 2301.540000] ath9k_htc 1-1:1.0: ath9k_htc: HTC initialized with 45 credits
[ 2301.950000] ath9k_htc 1-1:1.0: ath9k_htc: FW Version: 1.3
[ 2302.000000] ieee80211 phy0: Atheros AR9287 Rev:2
[root@olinuxino ~]# wifi-menu
:: Scanning for networks  [ BUSY ]
:: wlan0-AndroidAP up  [ BUSY ]
Successfully initialized wpa_supplicant
rfkill: Cannot open RFKILL control device
[ 2473.460000] wlan0: authenticate with 02:1a:11:f4:b8:ba
[ 2474.150000] wlan0: send auth to 02:1a:11:f4:b8:ba (try 1/3)
[ 2474.170000] wlan0: authenticated
[ 2474.180000] wlan0: associate with 02:1a:11:f4:b8:ba (try 1/3)
[ 2474.200000] wlan0: RX AssocResp from 02:1a:11:f4:b8:ba (capab=0x411 status=0 aid=2)
[ 2474.230000] wlan0: associated
 [ DONE ]
[root@olinuxino ~]# ping google.de
PING google.de (173.194.41.151) 56(84) bytes of data.
64 bytes from lhr08s03-in-f23.1e100.net (173.194.41.151): icmp_seq=1 ttl=51 time=72.9 ms
64 bytes from lhr08s03-in-f23.1e100.net (173.194.41.151): icmp_seq=2 ttl=51 time=83.3 ms

--- google.de ping statistics ---
2 packets transmitted, 2 received, 0% packet loss, time 1001ms
rtt min/avg/max/mdev = 72.937/78.156/83.375/5.219 ms
[root@olinuxino ~]#

Testing the Hardware

First we need to have a look at the pinout:

iMX233-OLinuXino-Micro pinout

iMX233-OLinuXino-Micro pinout (Red means you might break something else if you use it (usb, debug UART), and blue means that the physical pin is used in multiple places. Source: https://docs.google.com/spreadsheet/ccc?key=0AspkrcYcY5bWdFB6WC1xRlp5bFRjc1hwVnlQZDVmeUE)

GPIO

We will start with something simple like toggling the GPIO pin 4 on Connector 1 pin 15. For this purpose we write a little bash script that first exports the GPIO pin and then toggles it in an endless loop:

[root@olinuxino ~]# vim toggle.sh
[root@olinuxino ~]# cat toggle.sh
#!/bin/bash

echo 4 > /sys/class/gpio/export
echo out > /sys/class/gpio/gpio4/direction

# toggle gpio4 with maximum frequency (not memory mapped)
while :
do
  echo 1 > /sys/class/gpio/gpio4/value
  #sleep 1
  echo 0 > /sys/class/gpio/gpio4/value
  #sleep 1
done

[root@olinuxino ~]# chmod +x toggle.sh
[root@olinuxino ~]# ./toggle.sh

With this simple script we can toggle the pin with a maximum frequency of about 300 Hz:

iMX233-OLinuXino-Micro maximum toggle speed (bash script, scope)

iMX233-OLinuXino-Micro maximum toggle speed (bash script, scope)

iMX233-OLinuXino-Micro maximum toggle speed (bash script, logic analyzer)

iMX233-OLinuXino-Micro maximum toggle speed (bash script, logic analyzer)

If we are using memory mapped access we get mush higher toggling speeds of around 5.6 MHz. Have a look here.

[root@olinuxino ~]# curl -kL https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/iMX233/gpio-mmap.h -o gpio-mmap.h
[root@olinuxino ~]# vim toggle.c
[root@olinuxino ~]# cat toggle.c
#include "gpio-mmap.h"

int main(void)
{
    gpio_map();
    gpio_output(0,4); // bank 0 bit 4 = GPIO4
                      // 4/32 = 0 remainder 4 -> bank 0, pin 4

    while(1)
    {
      GPIO_WRITE_PIN(4,1);
      GPIO_WRITE_PIN(4,0);
    }
}
[root@olinuxino ~]# gcc toggle.c -o toggle
[root@olinuxino ~]# ./toggle

And the result:

iMX233-OLinuXino-Micro maximum toggle speed (memory mapped access, scope)

iMX233-OLinuXino-Micro maximum toggle speed (memory mapped access, scope)

iMX233-OLinuXino-Micro maximum toggle speed (memory mapped access, logic analyzer)

iMX233-OLinuXino-Micro maximum toggle speed (memory mapped access, logic analyzer)

I2C

It looks good, I have a i2c device:

[root@olinuxino ~]# ls /dev/i2*
/dev/i2c-0
[root@olinuxino ~]# pacman -S i2c-tools
[root@olinuxino ~]# i2cdetect -l
i2c-0   i2c             MXS I2C adapter                         I2C adapte
[root@olinuxino ~]# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- [  154.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  155.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  156.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  157.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- [  158.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  159.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  160.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  161.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  162.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  163.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  164.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  165.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
--
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[root@olinuxino ~]#

Now I will try to control Olimex’s MOD-IO2 via i2c that I’ve already used with the Raspberry Pi.

First we need to compile i2c-tool which is a simple program that can be used to send some bytes over i2c:

[root@olinuxino ~]# curl -kL https://github.com/OLIMEX/OLINUXINO/raw/master/SOFTWARE/iMX233/I2C/MOD-IO2/i2c-tool.c -o i2c-tool.c
[root@olinuxino ~]# gcc i2c-tool.c -o i2c-tool
[root@olinuxino ~]# ./i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x03
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x128F008
/dev/i2c-0 OPENDED!
[ 3789.040000] mxs-i2c 80058000.i2c: PIO: Failed to finish WRITE cmd!
WRITE:SUCCESS
[root@olinuxino ~]#

So far so good, I can execute the i2c-tool and I hope I get the “Failed to finish WRITE cmd” error because nothing is connected to the i2c pins.

Now we have to find the correct pins on the board, i2c support gets added by the patch 0001-ARM-imx23-olinuxino-Add-i2c-support.patch which adds 3 different pin mappings to imx23.dtsi:

iMX233-OLinuXino i2c pin mappings patch

iMX233-OLinuXino i2c pin mappings patch

from which i2c_pins_b (MX23_PAD_LCD_ENABLE__I2C_SCL, MX23_PAD_LCD_HSYNC__I2C_SDA) gets selected in the device tree (imx23-olinuxino.dts):

iMX233-OLinuXino i2c device tree

iMX233-OLinuXino i2c device tree

Now if we look into the iMX233 Reference Manual (17 MB) and search for LCD_ENABLE we will find Table 36-3. 128-Pin LQFP Pin Definitions by Pin Number which tells us that LCD_ENABLE is connected to processor pin 11 and LCD_HSYNC is connected to processor pin 15 and both have i2c as alternate function.

After looking into the OLinuXino-MICRO USER’S MANUAL we know that processor pin 11 (I2C_SCL) is available at CON1.24 and processor pin 15 (I2C_SDA) was routed to CON1.23.

Since the MOD-IO2 uses a UEXT connector have a look at the UEXT pinout specification:

UEXT pinout specification

UEXT pinout specification

Now connect SDA with SDA, SCL with SCL and GND with GND:

iMX233-OLinuXino-Micro and MOD-IO2

iMX233-OLinuXino-Micro and MOD-IO2

But i2cdetect still does not detect the MOD-IO2 (unlike on the Raspberry Pi where it finds it at address 0x48):

[root@olinuxino ~]# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- [  154.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  155.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  156.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  157.710000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- [  158.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  159.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  160.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  161.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  162.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  163.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  164.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
-- -- [  165.760000] mxs-i2c 80058000.i2c: Failed to get PIO reg. write descriptor.
--
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[root@olinuxino ~]#

It should look like this:

[root@alarmpi ~]# i2cdetect 0
WARNING! This program can confuse your I2C bus, cause data loss and worse!
I will probe file /dev/i2c-0.
I will probe address range 0x03-0x77.
Continue? [Y/n] y
    0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- 48 -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- -- -- --
[root@alarmpi ~]# i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x01 #REL 1 on
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x12A3008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS
[root@alarmpi ~]#

And since I’ve tried it again on the Raspberry Pi, I’m sure everything is connected correctly and the hardware is OK:

MOD-IO2 on Raspberry Pi

MOD-IO2 on Raspberry Pi

Using i2cdetect -r 0 makes also no difference.

But nevertheless I can switch on and off the relays on the MOD-IO2:

[root@olinuxino ~]# ./i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x03 #REL 1&2 on
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x8DC008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS
[root@olinuxino ~]# ./i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x00 #REL 1&2 off
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x18AF008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS
[root@olinuxino ~]# ./i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x01 #REL 1 on
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x1D09008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS
[root@olinuxino ~]# ./i2c-tool -w 0 0x48 4 0x02 0xA0 0x40 0x02 #REL 2 on
SLAVE ADDRESS: 0x48
NUMBER OF BYTES TO WRITE: 4
MEMORY ALLOCATED AT ADDRESS: 0x46F008
/dev/i2c-0 OPENDED!
WRITE:SUCCESS
[root@olinuxino ~]#
Turning on the relays on my Olimex MOD-IO2 via i2c (logic analyzer)

Turning on the relays on my Olimex MOD-IO2 via i2c (logic analyzer)

Success! :)

SPI

After applying the 0005-ARM-imx23-olinuxino-Add-spidev.patch patch your arch/arm/boot/dts/imx23-olinuxino.dts file should have a ssp1 section that looks like this:

ssp1: ssp@80034000 {
  #address-cells = <1>;
  #size-cells = <0>;
  compatible = "fsl,imx23-spi";
  pinctrl-names = "default";
  pinctrl-0 = <&spi2_pins_a>;
  clock-frequency = <1000000>;
  status = "okay";

  spidev: spidev@0 {
    compatible = "spidev";
    spi-max-frequency = <1000000>;
    reg = <0>;
  };
};

Now you should find a spi device under /dev:

[root@olinuxino ~]# ls /dev/spi*
/dev/spidev1.1
[root@olinuxino ~]# dmesg | grep spi
[    1.240000] mxs-spi 80034000.ssp: registered master spi1
[    1.240000] spi spi1.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[    1.250000] mxs-spi 80034000.ssp: registered child spi1.1
[root@olinuxino ~]#

The spidev uses the pins spi2_pins_a which are defined in arch/arm/boot/dts/imx23.dtsi:

spi2_pins_a: spi2@0 {
  reg = <0>;
  fsl,pinmux-ids = <
    0x0182 /* MX23_PAD_GPMI_WRN__SSP2_SCK */
    0x0142 /* MX23_PAD_GPMI_RDY1__SSP2_CMD */
    0x0002 /* MX23_PAD_GPMI_D00__SSP2_DATA0 */
    0x0032 /* MX23_PAD_GPMI_D03__SSP2_DATA3 */
  >;
  fsl,drive-strength = <1>;
  fsl,voltage = <1>;
  fsl,pull-up = <1>;
};

Pin definitions from the IMX23RM and OLinuXino-MICRO USER’S MANUAL:

MX23_PAD_GPMI_WRN__SSP2_SCK   = PIN33 = CON2.11 SSP2_SCK
MX23_PAD_GPMI_RDY1__SSP2_CMD  = PIN21 = CON2.10 SSP2_MOSI
MX23_PAD_GPMI_D00__SSP2_DATA0 = PIN22 = CON1.11 SSP2_MISO
MX23_PAD_GPMI_D03__SSP2_DATA3 = PIN25 = CON1.14 LCD_D11 ??? (always high)
iMX233-OLinuXino-Micro pinout

Oscilloscope connected to SPI

Now we can try the spidev_test program from https://www.kernel.org/doc/Documentation/spi/spidev_test.c:

[root@olinuxino ~]# curl -k https://www.kernel.org/doc/Documentation/spi/spidev_test.c -o spidev_test.c
[root@olinuxino ~]# gcc spidev_test.c -o spidev_test
[root@olinuxino ~]# ./spidev_test --help
./spidev_test: unrecognized option '--help'
Usage: ./spidev_test [-DsbdlHOLC3]
  -D --device   device to use (default /dev/spidev1.1)
  -s --speed    max speed (Hz)
  -d --delay    delay (usec)
  -b --bpw      bits per word
  -l --loop     loopback
  -H --cpha     clock phase
  -O --cpol     clock polarity
  -L --lsb      least significant bit first
  -C --cs-high  chip select active high
  -3 --3wire    SI/SO signals shared

[root@olinuxino ~]# ./spidev_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)
can't send spi message: Invalid argument
Aborted (core dumped)
[root@olinuxino ~]# dmesg |tail
[ 1508.410000] wlan0: authenticated
[ 1508.420000] wlan0: associate with 84:9c:a6:02:4e:88 (try 1/3)
[ 1508.450000] wlan0: RX AssocResp from 84:9c:a6:02:4e:88 (capab=0x411 status=0 aid=2)
[ 1508.510000] wlan0: associated
[ 1709.760000] spidev spi1.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[ 1709.760000] spidev spi1.1: spi mode 00
[ 1709.760000] spidev spi1.1: setup mode 0, 8 bits/w, 1000000 Hz max --> 0
[ 1709.760000] spidev spi1.1: 8 bits per word
[ 1709.760000] spidev spi1.1: setup mode 0, 8 bits/w, 500000 Hz max --> 0
[ 1709.760000] spidev spi1.1: 500000 Hz (max)
[root@olinuxino ~]#

The reason for the can't send spi message: Invalid argument is that the imx23 supports only half duplex hw spi, so we have to zero either tx or rx buffer in the datagram struct spi_ioc_transfer tr, then it will work:

[root@olinuxino ~]# sed -i 's/rx_buf = (unsigned long)rx/rx_buf = 0/g' spidev_test.c
[root@olinuxino ~]# gcc spidev_test.c -o spidev_test
[root@olinuxino ~]# ./spidev_test
spi mode: 0
bits per word: 8
max speed: 500000 Hz (500 KHz)

00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00 00 00 00 00
00 00
[root@olinuxino ~]#

Now attach your logic analyzer or oscilloscope and see if something gets sent:

Running ./spidev_test

Running ./spidev_test

And another experiment:

[root@olinuxino ~]# echo -n "test" > /dev/spidev1.1
Sending "test" ``echo -n "test" > /dev/spidev1.1`` (scope)

Sending “test” echo -n "test" > /dev/spidev1.1 (scope)

Sending "test" ``echo -n "test" > /dev/spidev1.1`` (logic analyzer)

Sending “test” echo -n "test" > /dev/spidev1.1 (logic analyzer)

Workbench with OLinuXino, Oscilloscope and lost of wires

Workbench with OLinuXino, Oscilloscope and a lot of wires