Frequently Asked Questions
Misc (1)
I like to access my ext2/ext3 formatted SD-Card/USB-Stick from Microsoft Windows. Can I do that?
Yes you can. With the help of this freeware EXT2 IFS ext2 or ext3 formatted partitions can by accessed with all Microsoft Windows operating systems.
It is available for download here:
http://www.fs-driver.org/
Panel-Card (3)
After flashing a new u-boot or after replugging the card my Stamp9261 or my Panel-Card doesn't boot anymore. What should I do?
Description
The processor core of the AT91Sam9261 is operating at 1.8V. The peripherals like flash and SDRAM are operating at 3.3V. During power-up 1.8V are already stable and the processor core starts, but the peripherals aren't ready yet, so the system crashes. Actually, as the watchdog is enabled by default, the system will start after the watchdog timeout, which is 16 seconds, in a sane state.
Solution
This problem is solved by setting the reset register in the processor to user reset and insert a timeout before starting the core after the core voltage is stable. This is done before booting Linux, have a look at the setreset environment variable in u-boot. This register is battery backed-up, so it be will kept during power failures. There are three situations however, when this is not the case:
- When the module was removed from the board
- When the bootloader was newly flashed
- When the battery was empty and replaced with a new one
When one of this situation occurs, you have to wait until the watchdog timeout or disconnect the battery temporarily, e.g. with a slip of paper between battery and connector.
If there is no battery the register doesn't need to be set as the settling time of the slowclock oscillator will guarantee a sane start of the board.
Caveat
If you own a revision of the Panel-Card below four, the manual reset is not needed and won't work. You find the revision number of your board on the LCD-Side of the Panel-Card, like 16.103.4 for revision four or 16.103.3 for revision three.
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
Portux Panel-PC (3)
How can I program the buzzer?
The Portux-Panel-PC has an inductive buzzer, which is connected to processor pin PB06. It can be used by programming a 2KHz PWM signal on Pin PB06. How this can be done is demonstrated in this example program:
http://www.armbedded.eu/download/software/buzzer-portuxpp.tar.gz
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
Portux920T (4)
On Portux920TEU and PortuxG20 the first serial port includes two USARTs: A regular USART with the signals RX/TX and RTS/CTS and a debug UART (DBGU) with it's RX/TX on the regular signals DTR/DSR. Thus the DBGU-Adapter is needed to switch the signals DTR/DSR to RX/TX on your null modem cable.
The DBGU-Adapter is part of the Starterkit, just connect it between the serial port of your Portux and the null modem cable and you will see the console output of Linux on your serial port.
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
I want to add a battery for my Portux920TEU/SW, what type of battery do I need?
You can use a CR1632FH-LF of the swiss company renata batteries with soldering tails.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
PortuxG20 (8)
The toolchain comes with the package manager opkg. You can install the same packages as on the target device with it. To do so, follow these steps:
- Become root using su or sudo on your development computer
- Edit the file /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf. It should look like that:
arch all 1 arch any 6 arch noarch 11 arch arm 16 arch armv4 21 arch armv4t 26 arch armv5te 31 src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/base src/gz debug http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/debug src/gz gstreamer http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/gstreamer src/gz no-arch http://www.angstrom-distribution.org/feeds/2008/ipk/glibc//all src/gz perl http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/perl src/gz python http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/python
All other lines can be removed or commented.
- Execute the command
source /usr/local/angstrom/arm/environment-setup - You can now use the command
opkg-targetas on the target. So you first need to runopkg-target updateand after that you can install the needed packages, most probably the -dev versions to get the header files.
From now on, every time you want to install a new package, repeat steps 1, 3 and 4.
Introduction
You can put your module into two different power states: standby and power-down. In standby mode the PLLs of the AT91SAM9G20 are still running, in power-down modus the PLLs and the 18.432 MHz crystal is shut off. In practice this has some effect with which interrupts the device can wakeup. For example in standby mode you can wake up your device by typing a character on the serial console. In power-down mode this will not work, because without PLL you will not have a correct baudrate.
In this FAQ we will demonstrate how to use power saving features and wake up the device by using the wake alarm of the RTC and the sysfs interface on the console.
Power states
You can put your device in standby mode by writing /sys/power/state:
echo standby > /sys/power/state
or in power-down mode:
echo mem > /sys/power/state
As mentioned above, if you have put your device in power-down mode without setting a wake alarm in your RTC, your device will not wake up anymore.
Setting the wake alarm
The wake alarm is set by writing to /sys/class/rtc/rtc0/wakealarm. You can either write a value from seconds elapsed since epoch (1.1.1970) or a value of seconds from now.
echo "+20" > /sys/class/rtc/rtc0/wakealarm
will issue an interrupt in twenty seconds from now. Prior to setting a new alarm, you have to clear the value already written:
echo "" > /sys/class/rtc/rtc0/wakealarm
Putting it together
So using standby with wake up in twenty seconds can be done like this:
echo "" > /sys/class/rtc/rtc0/wakealarm echo "+20" > /sys/class/rtc/rtc0/wakealarm echo standby > /sys/power/state
and power-down:
echo "" > /sys/class/rtc/rtc0/wakealarm echo "+20" > /sys/class/rtc/rtc0/wakealarm echo mem > /sys/power/state
To compile bootstrap yourself the following steps have to be done:
1) You need an arm-gcc standalone compiler. The delivered arm-linux-gcc won't work for that task. Good ones are obtainable at http://www.codesourcery.com/
2) Extract the archive from your CD or from our download section (http://www.armbedded.eu/downloads) on your development PC. Change to that directory.
3) Edit the Makefile in the directory at91bootstrap to point the variable CROSS_COMPILE to your installed stand-alone cross-compiler, e.g.:
CROSS_COMPILE=/develop/arm-2008q3/bin/arm-none-eabi-
4) Now issue make in the at91bootstrap directory with the following options:
make CHIP=at91sam9g20 BOARD=at91sam9g20-ek ORIGIN=nandflash DESTINATION=sdram BIN_SIZE=0x30000 FROM_ADDR=0x20000 DEST_ADDR=0x23F00000 OP_BOOTSTRAP=on STR_DESCR=\\\"appli\\\" TRACE_LEVEL=1
5) Now you find your binary in at91bootstrap/bin directory:
boot-at91sam9g20-ek-nandflash2sdram.bin
. Bootstrap has to be flashed via SAM-BA. It cannot be flashed with u-boot or linux. To do that see this how-to: http://www.armbedded.eu/node/8
On Portux920TEU and PortuxG20 the first serial port includes two USARTs: A regular USART with the signals RX/TX and RTS/CTS and a debug UART (DBGU) with it's RX/TX on the regular signals DTR/DSR. Thus the DBGU-Adapter is needed to switch the signals DTR/DSR to RX/TX on your null modem cable.
The DBGU-Adapter is part of the Starterkit, just connect it between the serial port of your Portux and the null modem cable and you will see the console output of Linux on your serial port.
Example error messages:
ifup: can't open '/var/run/ifstate': No such file or directory
shutdown: warning: cannot open /var/run/shutdown.pid
Some files in /var are located in RAM and must be recreated on every boot. Additionally /tmp is a symlink to /var/tmp. The files in /etc/default/volatile/ describe, which files, directories or symlinks have to be created. To speed up the boot, a file called /etc/volatile.cache is created. In the event of an unclean shutdown, this file might get corrupted and the creation of these files might not work. To resolve this issue simply delete /etc/volatile.cache.
This happens because NAND flash can have bad blocks. Every program not able to handle bad blocks can trigger messages like that. This is not a real problem with the flash, just with the application.
While booting the offending application is udev. It scans each block device for partitions including the MTD partitions. If the MTD partition has a bad block in the scanning region, the read will fail and this message is printed. To work around it, you can skip the scan for mtd devices by editing the file /etc/udev/rules.d/60-persistent-storage.rules. Replace the line
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"
with
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*|mtd*", GOTO="persistent_storage_end"
and the messages should go away.
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
Stamp9261 (3)
After flashing a new u-boot or after replugging the card my Stamp9261 or my Panel-Card doesn't boot anymore. What should I do?
Description
The processor core of the AT91Sam9261 is operating at 1.8V. The peripherals like flash and SDRAM are operating at 3.3V. During power-up 1.8V are already stable and the processor core starts, but the peripherals aren't ready yet, so the system crashes. Actually, as the watchdog is enabled by default, the system will start after the watchdog timeout, which is 16 seconds, in a sane state.
Solution
This problem is solved by setting the reset register in the processor to user reset and insert a timeout before starting the core after the core voltage is stable. This is done before booting Linux, have a look at the setreset environment variable in u-boot. This register is battery backed-up, so it be will kept during power failures. There are three situations however, when this is not the case:
- When the module was removed from the board
- When the bootloader was newly flashed
- When the battery was empty and replaced with a new one
When one of this situation occurs, you have to wait until the watchdog timeout or disconnect the battery temporarily, e.g. with a slip of paper between battery and connector.
If there is no battery the register doesn't need to be set as the settling time of the slowclock oscillator will guarantee a sane start of the board.
Caveat
If you own a revision of the Panel-Card below four, the manual reset is not needed and won't work. You find the revision number of your board on the LCD-Side of the Panel-Card, like 16.103.4 for revision four or 16.103.3 for revision three.
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
Stamp9G20 (7)
The toolchain comes with the package manager opkg. You can install the same packages as on the target device with it. To do so, follow these steps:
- Become root using su or sudo on your development computer
- Edit the file /usr/local/angstrom/arm/arm-angstrom-linux-gnueabi/etc/opkg.conf. It should look like that:
arch all 1 arch any 6 arch noarch 11 arch arm 16 arch armv4 21 arch armv4t 26 arch armv5te 31 src/gz base http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/base src/gz debug http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/debug src/gz gstreamer http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/gstreamer src/gz no-arch http://www.angstrom-distribution.org/feeds/2008/ipk/glibc//all src/gz perl http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/perl src/gz python http://www.angstrom-distribution.org/feeds/2008/ipk/glibc/armv5te/python
All other lines can be removed or commented.
- Execute the command
source /usr/local/angstrom/arm/environment-setup - You can now use the command
opkg-targetas on the target. So you first need to runopkg-target updateand after that you can install the needed packages, most probably the -dev versions to get the header files.
From now on, every time you want to install a new package, repeat steps 1, 3 and 4.
Introduction
You can put your module into two different power states: standby and power-down. In standby mode the PLLs of the AT91SAM9G20 are still running, in power-down modus the PLLs and the 18.432 MHz crystal is shut off. In practice this has some effect with which interrupts the device can wakeup. For example in standby mode you can wake up your device by typing a character on the serial console. In power-down mode this will not work, because without PLL you will not have a correct baudrate.
In this FAQ we will demonstrate how to use power saving features and wake up the device by using the wake alarm of the RTC and the sysfs interface on the console.
Power states
You can put your device in standby mode by writing /sys/power/state:
echo standby > /sys/power/state
or in power-down mode:
echo mem > /sys/power/state
As mentioned above, if you have put your device in power-down mode without setting a wake alarm in your RTC, your device will not wake up anymore.
Setting the wake alarm
The wake alarm is set by writing to /sys/class/rtc/rtc0/wakealarm. You can either write a value from seconds elapsed since epoch (1.1.1970) or a value of seconds from now.
echo "+20" > /sys/class/rtc/rtc0/wakealarm
will issue an interrupt in twenty seconds from now. Prior to setting a new alarm, you have to clear the value already written:
echo "" > /sys/class/rtc/rtc0/wakealarm
Putting it together
So using standby with wake up in twenty seconds can be done like this:
echo "" > /sys/class/rtc/rtc0/wakealarm echo "+20" > /sys/class/rtc/rtc0/wakealarm echo standby > /sys/power/state
and power-down:
echo "" > /sys/class/rtc/rtc0/wakealarm echo "+20" > /sys/class/rtc/rtc0/wakealarm echo mem > /sys/power/state
To compile bootstrap yourself the following steps have to be done:
1) You need an arm-gcc standalone compiler. The delivered arm-linux-gcc won't work for that task. Good ones are obtainable at http://www.codesourcery.com/
2) Extract the archive from your CD or from our download section (http://www.armbedded.eu/downloads) on your development PC. Change to that directory.
3) Edit the Makefile in the directory at91bootstrap to point the variable CROSS_COMPILE to your installed stand-alone cross-compiler, e.g.:
CROSS_COMPILE=/develop/arm-2008q3/bin/arm-none-eabi-
4) Now issue make in the at91bootstrap directory with the following options:
make CHIP=at91sam9g20 BOARD=at91sam9g20-ek ORIGIN=nandflash DESTINATION=sdram BIN_SIZE=0x30000 FROM_ADDR=0x20000 DEST_ADDR=0x23F00000 OP_BOOTSTRAP=on STR_DESCR=\\\"appli\\\" TRACE_LEVEL=1
5) Now you find your binary in at91bootstrap/bin directory:
boot-at91sam9g20-ek-nandflash2sdram.bin
. Bootstrap has to be flashed via SAM-BA. It cannot be flashed with u-boot or linux. To do that see this how-to: http://www.armbedded.eu/node/8
Example error messages:
ifup: can't open '/var/run/ifstate': No such file or directory
shutdown: warning: cannot open /var/run/shutdown.pid
Some files in /var are located in RAM and must be recreated on every boot. Additionally /tmp is a symlink to /var/tmp. The files in /etc/default/volatile/ describe, which files, directories or symlinks have to be created. To speed up the boot, a file called /etc/volatile.cache is created. In the event of an unclean shutdown, this file might get corrupted and the creation of these files might not work. To resolve this issue simply delete /etc/volatile.cache.
This happens because NAND flash can have bad blocks. Every program not able to handle bad blocks can trigger messages like that. This is not a real problem with the flash, just with the application.
While booting the offending application is udev. It scans each block device for partitions including the MTD partitions. If the MTD partition has a bad block in the scanning region, the read will fail and this message is printed. To work around it, you can skip the scan for mtd devices by editing the file /etc/udev/rules.d/60-persistent-storage.rules. Replace the line
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*", GOTO="persistent_storage_end"
with
KERNEL=="ram*|loop*|fd*|nbd*|gnbd*|dm-*|md*|mtd*", GOTO="persistent_storage_end"
and the messages should go away.
When mounting an NFS share, the mount command hangs for some time. What is wrong?
Busybox is not capable of mounting NFS shares with locking enabled. Use the option -o nolock for NFS mounts.
How can I read/write registers and physical memory regions under Linux?
This tar archive contains a simple tool providing reading and writing at physical addresses under Linux. Source code as well as binaries for OABI and EABI are included.
