Narzędzia użytkownika

Narzędzia witryny


elektronika:blueboard-arm-at91rm9200

NGX blueboard ARM9

A couple of notes on NGX blueboard ARM9.

Introduction

NGX Technologies produces relatively cheap boards with AT91RM9200 ARM processor from Atmel, in April 2010 you could get one for 62 USD. Board comes with preloaded Linux kernel 2.6.21.6 (with patches). With board you get tools to build kernel and, small, ready to use file system that you put on SD card and of course schematics.

Board is slightly modified Free ECB_AT91 V1, so all informations from their wiki is valid for this board as well (it has lots of useful information), since I would have to, almost, copy everything from that wiki I will place here my comments on the board and certain procedures.

The board version I got needs some fixing due to non functional USB port:

  • USB data lines need 15k pull-down resistor (and a capacitor) - they're missing, see p. 600 (schematics) and p. 596 (warning what will happen if you don't have pull-down resistors) in AT91RM9200 CPU documentation.
  • USB socket is connected to ground - in my case CPU reset after touching the socket with metal object; I removed connection with ground. I'm not sure if you need to do that.

Here are photos of the board:

Kernel

Compiling new kernel

As of writing this text newest kernel is 2.6.34, I compiled and tried versions: 2.6.21 (ecb patches) and 2.6.33.4 (at91 patches).

Linux4SAM has a good guide how to build your kernel, also, earlier mentioned, ECB_AT91. Some knowledge about configuring and building kernel is essential.

Since I was trying different things I created small scripts to automate some tasks:

build-kernel.sh
#!/bin/bash
 
# you need working uboot
 
# make sure you your build tools are in PATH, you can also put full path
# below, but remember to give full path to "arm-linux-objcopy" below as well
crossmake="make ARCH=arm CROSS_COMPILE=arm-linux-"
 
echo Menuconfig...
sleep 1
$crossmake menuconfig
 
echo Compiling kernel...
sleep 1
# change "2" to number of processors/cores you have
$crossmake -j 2 vmlinux
 
echo Creating loadable image...
sleep 1
arm-linux-objcopy -O binary -R .note.gnu.build-id -R .comment -S vmlinux linux.bin
gzip -c -9 linux.bin > linux.bin.gz
mkimage -A arm -O linux -T kernel -C gzip -a 0x20008000 -e 0x20008000 -n "Linux Kernel Image" -d linux.bin.gz ngx_at91.img
 
# start tftpd server
echo Starting tftpd server as root...
sleep 1
sudo ./simpletftpd.pl
build-modules.sh
#!/bin/bash
 
# Script builds kernel modules and install them in _modules directory
 
crossmake="make ARCH=arm CROSS_COMPILE=arm-linux-"
 
mkdir -p _modules
$crossmake -j 2 modules
INSTALL_MOD_PATH=./_modules $crossmake modules_install

Please note that for older kernels (prior 2.6.21?) „.note.gnu.build-id” section name is „.note” in vmlinux ELF file. If your compressed image is a little bit and it takes a lot of time to create than mentioned section wasn't removed.

I also use another script as simple TFTP server, it's almost a copy from module example. You'll need Perl and Net::TFTPd (install using „cpan” command as root), you'll need to start this script as root (sudo) since it requires lower port numbers:

simpletftpd.pl
#!/usr/bin/perl
 
use strict;
use Net::TFTPd;
 
my $tftpdOBJ = Net::TFTPd->new('RootDir' => './')
		or die "Error creating TFTPd listener: %s\n", Net::TFTPd->error;
 
my $tftpRQ = $tftpdOBJ->waitRQ(100)
	or die "Error waiting for TFTP request: %s\n", Net::TFTPd->error;
 
$tftpRQ->processRQ()
	or die "Error processing TFTP request: %s\n", Net::TFTPd->error;
 
printf "%u bytes has been transferred\n", $tftpRQ->getTotalBytes() || 0;

On ECB patched kernel everything works as expected, but for newer kernels MMC controller doesn't work as well as Ethernet controller, here are the fixes:

  • Ethernet: you need to change file drivers/net/arm/at91_ether.h, find line containing „MII_KS8721_ID” and change the id to „0x00221600” or else Ethernet port will not work (PHY chip is not detected).
  • SD/MMC: change SD/MMC clock speed from 400k Hz to 150k Hz (I tried 350k and 300k Hz - still too high): drivers/mmc/core/core.c around line 915, change value from 400000 to 150000.

You can find 2.6.33.4 binary kernel + modules + kernel config file in Resources section. It works.

Trying new kernel

To try new kernel you don't need to flash anything (yet), the easiest method is to download new kernel, using uboot, through TFTP, everything is well explained on ECB_AT91 wiki. This is good to try new functionality in kernel, disadvantage is that you need to load the kernel every time you reset the board. You can put new kernel permanently on flash chip which is connected through SPI bus.

Troubleshooting

Potential bugs in kernel:

  • USB doesn't work if SLOB allocator is used (not confirmed),
  • kernel doesn't boot if using SLUB allocator (not confirmed),
  • kernel doesn't boot if multimedia subsystem is enabled (not confirmed),
  • during Debian installation process, if you get „Illegal instruction” after „chroot” command (second stage) you may have forgotten to enable NWFPE emulation.

Installing Debian

You can easily install Debian using debootstrap, Ubuntu has it in its repositories. After fetching base system some small adjustments must be made, read on. I assume you have stock NGX filesystem on your card (needed for second stage). For newer Debian systems you need EABI enabled kernel (as well as tools to build it).

First get base system (you can do that on x86 machine):

sudo debootstrap --foreign --arch=armel squeeze Debian http://ftp.us.debian.org/debian/

This command will install Debian base system in „Debian” directory. „armel” means EABI, for older distributions use „arm”. You can change distribution name („squeeze”) and mirror to suite your needs.

Copy whole „Debian” directory to root of stock NGX filesystem. Boot it using EABI kernel.

Run second stage (it will take some time to unpack and configure everything) on ARM9 Blueboard:

chroot ./Debian /debootstrap/debootstrap --second-stage

If you get „Segmentation fault” it means, most probably, that you are not using EABI kernel.

Now move somehow all files from „Debian” to root of filesystem (I copied it somewhere, removed everything from card and copied „Debian/*” back). Remember to use „cp -a” to preserve file attributes and owner.

Some things need to be adjusted:

  1. /etc/hostname - change to name of your machine
  2. /etc/network/interfaces - setup loopback and DHCP for eth0
    interfaces
    # loopback interface
    auto lo
    iface lo inet loopback
     
    # dhcp on eth0
    auto eth0
    iface eth0 inet dhcp
  3. /etc/fstab - filesystems (change ext4 to file system type you're using)
    fstab
    proc /proc proc nodev,noexec,nosuid 0 0
    /dev/mmcblk0p1 / ext4 noatime 0 1
  4. /etc/inittab - enable console on serial ports
    # comment out following lines
    T0:23:respawn:/sbin/getty -L ttyS0 115200 vt100
    T1:23:respawn:/sbin/getty -L ttyS1 115200 vt100
  5. Configure timezone:
    dpkg-reconfigure tzdata
  6. Add repository do /etc/apt/sources.list:
    sources.list
    deb http://ftp.de.debian.org/debian squeeze main

After everything is ready you can easily update your system („apt-get update; apt-get upgrade”) and install new software („apt-get install some-program”) just like on „normal” Linux.

Resources

elektronika/blueboard-arm-at91rm9200.txt · ostatnio zmienione: 2014-02-27 02:02 (edycja zewnętrzna)