Erste Schritte mit dem iMX233-OLinuXino-Micro

Zuerst folgen wir mal der Anleitung von http://archlinuxarm.org/platforms/armv5/olinuxino und richten die SD-Karte ein, zum Glück habe ich noch eine alte 1GB MicroSD Karte herumliegen, die sollte für den Anfang ausreichen.

Update

Die Erstellung einer bootfähigen SD Karte wurde vereinfacht, bitte direkt der Anleitung von http://archlinuxarm.org/platforms/armv5/olinuxino folgen.

[chris@thinkpad ~]$ sudo fdisk /dev/mmcblk0

Command (m for help): o
Building a new DOS disklabel with disk identifier 0xabf1e7d7.
Changes will remain in memory only, until you decide to write them.
After that, of course, the previous content won't be recoverable.

Warning: invalid flag 0x0000 of partition table 4 will be corrected by w(rite)

Command (m for help): p

Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes
103 heads, 43 sectors/track, 447 cylinders, total 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xabf1e7d7

        Device Boot      Start         End      Blocks   Id  System

Command (m for help): n
Partition type:
  p   primary (0 primary, 0 extended, 4 free)
  e   extended
Select (default p): p
Partition number (1-4, default 1):
Using default value 1
First sector (2048-1983999, default 2048):
Using default value 2048
Last sector, +sectors or +size{K,M,G} (2048-1983999, default 1983999): +16M

Command (m for help): t
Selected partition 1
Hex code (type L to list codes): 53
Changed system type of partition 1 to 53 (OnTrack DM6 Aux3)

Command (m for help): n
Partition type:
  p   primary (1 primary, 0 extended, 3 free)
  e   extended
Select (default p): p
Partition number (1-4, default 2):
Using default value 2
First sector (34816-1983999, default 34816):
Using default value 34816
Last sector, +sectors or +size{K,M,G} (34816-1983999, default 1983999):
Using default value 1983999

Command (m for help): w
The partition table has been altered!

Calling ioctl() to re-read partition table.
Syncing disks.
[chris@thinkpad ~]$

So jetzt kann die SD-Karte kurz entfernt und wieder eingesteckt werden, danach können wir mit fdisk die Partitionen auflisten um zu sehen ob alles funktioniert hat:

[chris@thinkpad ~]$ sudo fdisk -l
...
Disk /dev/mmcblk0: 1015 MB, 1015808000 bytes
4 heads, 16 sectors/track, 31000 cylinders, total 1984000 sectors
Units = sectors of 1 * 512 = 512 bytes
Sector size (logical/physical): 512 bytes / 512 bytes
I/O size (minimum/optimal): 512 bytes / 512 bytes
Disk identifier: 0xabf1e7d7

        Device Boot      Start         End      Blocks   Id  System
/dev/mmcblk0p1            2048       34815       16384   53  OnTrack DM6 Aux3
/dev/mmcblk0p2           34816     1983999      974592   83  Linux
[chris@thinkpad ~]$

Danach können wir weiter fortfahren, da wir wissen, dass die SD-Karte die beiden Partitionen /dev/mmcblk0p1 und /dev/mmcblk0p2 hat.

[chris@thinkpad ~]$ sudo mkfs.ext3 /dev/mmcblk0p2
mke2fs 1.41.14 (22-Dec-2010)
Filesystem label=
OS type: Linux
Block size=4096 (log=2)
Fragment size=4096 (log=2)
Stride=0 blocks, Stripe width=0 blocks
60928 inodes, 243648 blocks
12182 blocks (5.00%) reserved for the super user
First data block=0
Maximum filesystem blocks=251658240
8 block groups
32768 blocks per group, 32768 fragments per group
7616 inodes per group
Superblock backups stored on blocks:
        32768, 98304, 163840, 229376

Writing inode tables: done
Creating journal (4096 blocks): done
Writing superblocks and filesystem accounting information: done

This filesystem will be automatically checked every 21 mounts or
180 days, whichever comes first.  Use tune2fs -c or -i to override.
[chris@thinkpad ~]$ sudo mkdir /mnt/olinuxino
[chris@thinkpad ~]$ sudo mount /dev/mmcblk0p2 /mnt/olinuxino
[chris@thinkpad ~]$ sudo tar -zxf /home/chris/data/Elektrotechnik/Embedded_Linux/OLinuXino/SD-Card-Images/ArchLinuxARM-olinuxino-latest.tar.gz -C /mnt/olinuxino/
[chris@thinkpad ~]$ sudo dd if=/mnt/olinuxino/boot/oli-*.sb of=/dev/mmcblk0p1 ibs=512 seek=4 conv=sync,notrunc
dd: opening `/mnt/olinuxino/boot/oli-*.sb': No such file or directory
[chris@thinkpad ~]$ sudo dd if=/mnt/olinuxino/boot/oli-2.6.35-5-ARCH+.sb of=/dev/mmcblk0p1 ibs=512 seek=4 conv=sync,notrunc
3695+1 records in
3696+0 records out
1892352 bytes (1.9 MB) copied, 1.13418 s, 1.7 MB/s
[chris@thinkpad ~]$ sudo umount /mnt/olinuxino/
[chris@thinkpad ~]$

Die Kommunikation mit dem OLinuXino-Micro erfolgt über eine serielle Schnittstelle, da ich nur einen 5V und keinen 3,3V USB-Serial-Wandler habe ist noch eine Pegelanpassung erforderlich, außerdem muss verhindert werden, dass der iMX233 vom USB-Serial-Wandler über die Datenleitung mit Spannung versorgt wird, eventuell schon startet und in einem undefinierten Zustand landet da so die MicroSD-Karte beschädigt werden kann:

the problem is that our USB-CABLE provide enough power to start the processor in some unknown mode so the processor lock somehow the cards. some USB-RS232 converters are with weak drivers and can’t power the iMX233, you can solve the issue with the diode or with 1K resistor which to reduce the current source capability of the USB-SERIAL cable (http://tech.groups.yahoo.com/group/olinuxino/message/1103?threaded=1&var=1&p=11)

Die nächste Revision des OLinuXino-Micro soll dann die Diode oder den Widerstand bereits eingebaut haben.

In der App Note 3.3V DSP for Digital Motor Control.pdf, von TI sind ab Seite 7 einige immer wieder nützliche Schaltungen zur Pegelanpassung zwischen CMOS/TTL, 3,3V/5V zu finden.

5V CMOS Output to 3.3V DSP CMOS Input

5V CMOS Output to 3.3V DSP CMOS Input.

3.3V DSP CMOS Output to 5V CMOS Input

3.3V DSP CMOS Output to 5V CMOS Input.

Die Diode und der Widerstand können auch weggelassen werden, da der USB-Serial-Wandler auch niedrigere Pegel erkennt und da die RX Leitung am Wandler nur durch einen schwachen Pullup Widerstand auf 5V gezogen wird. Der 18k Widerstand verhindert gleich mit das der iMX233 mit genügend Strom versorgt wird, so das es da keine Probleme geben sollte.

Wenn RX und TX vom Wandler nun direkt verbunden werden sollten alle übertragenen Buchstaben direkt wieder empfangen werden.

So jetzt können wir die MicroSD-Karte in das OLinuXino stecken, und ein 5V 1A Netzteil anstecken, dabei sollte der Stecker so gepolt sein, dass innen + und außen - ist, dann wird das USB-Serial-Kabel angesteckt und wir können uns mit einem Terminal Programm verbinden und uns einloggen.

Baud Rate: 115200bps, Data Bits: 8, Stop Bits: 1, Parity: None
Benutzername: root Passwort: root
Versuchsaufbau OLinuXino, Steckbrett und USB-Serial-Wandler

Versuchsaufbau OLinuXino, Steckbrett und USB-Serial-Wandler

Arch Linux GtkTerm

Arch Linux ARM Login in GtkTerm

So, dass waren meine ersten Versuche mit dem OLinuXino, die Hardware scheint in Ordnung zu sein, jetzt warten erst mal andere Aufgaben auf mich.