LinuxSoftware

Coding and tramping in Aotearoa / New Zealand

The Mini2440 ARM9

Mini2440 ARM9 Board FriendlyARM Mini2440 Single-Board Computer with 400 MHz Samsung S3C2440A ARM9 processor, 64 MB of SDRAM, 128 MB of NAND Flash and 2 MB of NOR Flash. (ARM920T)

Specification

  • Dimension: 100 x 100 mm
  • CPU: 400 MHz Samsung S3C2440A ARM920T (Max freq. 533 MHz)
  • RAM: 64 MB SDRAM, 32 bit 100 MHz Bus
  • 128 MB NAND Flash in 2048 byte pages
  • 2 MB NOR Flash with BIOS
  • EEPROM: 1024 Byte 24C08 (I2C)
  • Ext. Memory: SD-Card socket
  • Serial Ports: 1x DB9 connector (RS232), total: 3x serial ports on the PCB
  • USB: 1x USB-A Host, 1x USB-B Device
  • Audio Output: 3.5 mm stereo jack
  • Audio Input: on PCB + condenser microphone
  • Ethernet: RJ-45 10/100M (DM9000)
  • RTC: Real Time Clock with battery
  • Beeper: PWM buzzer
  • Camera: 20 pin Camera interface
  • LCD Interface
    • STN Displays:
      • + 4 bit dual scan, 4 bit single scan or 8 bit single scan display type + monochrome, 4 gray levels, 16 gray levels, 256 colors or 4096 colors + Max: 1024x768, 4096 colors
    • TFT Displays:
      • + 1, 2, 4 or 8 bpp palletized color displays + 16 or 24 bpp non-palletized true-color displays + Max: 1024x768, 64k colors
    • Connector for 3,5" and 7" FriendlyARM Displays
  • Touch Panel: 4 wire resistive
  • User Inputs: 6x push buttons and 1x A/D pot
  • User Outputs: 4x LEDs
  • Expansion: 40 pin System Bus, 34 pin GPIO (2.0mm)
  • Debug: 10 pin JTAG (2.0mm)
  • Power: 5V with switch and LED

Deploying U-Boot

Connect the USB cable.

Supervivi> load ram 0x31000000 239016 u
USB host is connected. Waiting a download. 

On another shell window, use following command to download u-boot into the RAM of mini2440

$ sudo ./s3c2410_boot_usb u-boot.bin 

Now we are ready to write u-boot from the RAM to NAND flash. Execute the code starting at RAM location 0x31000000:

Supervivi> go 0x31000000
go to 0x31000000
  argument 0 = 0x00000000
  argument 1 = 0x00000000
  argument 2 = 0x00000000
  argument 3 = 0x00000000

MINI2440 # nand info

Device 0: NAND 64MiB 3,3V 8-bit, page size 512, sector size 16 KiB

Erase everything on the NAND flash:

MINI2440 # nand scrub

NAND scrub: device 0 whole chip
Warning: scrub option will erase all factory set bad blocks!
         There is no reliable way to recover them.
         Use this command only for testing purposes if you
         are sure of what you are doing!

Really scrub this NAND flash? <y/N>
Erasing at 0x3ffc000 -- 100% complete.
Bad block table not found for chip 0
Bad block table not found for chip 0
OK

Please enter a lower case y and press Enter when prompted.

Now create a new partition table

MINI2440 # nand createbbt
Create BBT and erase everything ? 
Skipping bad block at  0x03ff0000                                            
Skipping bad block at  0x03ff4000                                            
Skipping bad block at  0x03ff8000                                            
Skipping bad block at  0x03ffc000                                            

Creating BBT. Please wait ...Bad block table not found for chip 0
Bad block table not found for chip 0
Bad block table written to 0x03ffc000, version 0x01
Bad block table written to 0x03ff8000, version 0x01

and partition the NAND flash using u-boot default configuration. Each partition shall be given a name.

MINI2440 # mtdparts                    

device nand0 <mini2440-nand>, # parts = 4
 #: name                        size            offset          mask_flags
 0: u-boot              0x00040000      0x00000000      0
 1: env                 0x00020000      0x00040000      0
 2: kernel              0x00500000      0x00060000      0
 3: root                0x03aa0000      0x00560000      0

active partition: nand0,0 - (u-boot) 0x00040000 @ 0x00000000

defaults:
mtdids  : nand0=mini2440-nand
mtdparts: <NULL>

Now write u-boot to NAND flash

MINI2440 # nand write 0x31000000 u-boot

NAND write: device 0 offset 0x0, size 0x40000
 262144 bytes written: OK

Reset the on-board switch to NAND flash and reboot mini2440 Step 3: Downloading Linux Kernel

Now you shall see all u-boot informations on the minicom window. Hit any key when you see the promption "Hit any key to stop autoboot."

Now set a NAND flash offset since later you won't want to write stuffs on the area that contains u-boot.

MINI2440 # dynenv set 40000
device 0 offset 0x40000, size 0x3fc0000
45 4e 56 30 - 00 00 04 00
MINI2440 # nand erase kernel

NAND erase: device 0 offset 0x60000, size 0x500000
Erasing at 0x55c000 -- 100% complete.
OK

Copy the Linux kernel image onto an SD card and insert the SD card to the card reader of mini2440. Now initialize the SD card.

MINI2440 # mmcinit
trying to detect SD Card...
Manufacturer:       0x02, OEM "TM"
Product name:       "SD01G", revision 2.3
Serial number:      2486075243
Manufacturing date: 1/2002
CRC:                0x72, b0 = 1
READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=365
size = 1642070016

Suppose the Linux kernel image has the filename "uImage." Now load it to the RAM first.

MINI2440 # fatload mmc 0:1 0x31000000 uImage
reading uImage

1945804 bytes read

Write the Linux kernel from RAM to the NAND flash partition called "kernel."

MINI2440 # nand write 0x31000000 kernel

NAND write: device 0 offset 0x60000, size 0x500000
 5242880 bytes written: OK

Deploying Kernel

Now connect PC with mini2440's USB device port, via a USB cable. Make the compiled u-boot image handy. Tell vivi that you need 239016 Bytes space in the RAM to load something from the USB, starting at 0x31000000

Supervivi> load ram 0x31000000 239016 u USB host is connected. Waiting a download.

On another shell window, use following command to download u-boot into the RAM of mini2440

$ sudo ./s3c2410_boot_usb u-boot.bin

Enter root password when prompted, and you shall see this output on the shell

csum = 0xd542 send_file: addr = 0x33f80000, len = 0x0003a5a8 Error downloading program

Please ignore the error.

Now go back to vivi. You shall see follows

Now, Downloading [ADDRESS:31000000h,TOTAL:239026] RECEIVED FILE SIZE: 239026 (233KB/S, 1S) Downloaded file at 0x31000000, size = 239016 bytes

Now we are ready to write u-boot from the RAM to NAND flash. Execute the code starting at RAM location 0x31000000:

Supervivi> go 0x31000000 go to 0x31000000

  • argument 0 = 0x00000000 argument 1 = 0x00000000 argument 2 = 0x00000000 argument 3 = 0x00000000

U-Boot 1.3.2-dirty-moko12 (Apr 16 2009 - 18:14:52)

I2C: ready DRAM: 64 MB Flash: 2 MB NAND: Bad block table not found for chip 0 Bad block table not found for chip 0 64 MiB Found Environment offset in OOB.. USB: S3C2410 USB Deviced In: serial Out: serial Err: serial MAC: 08:08:11:18:12:27 Hit any key to stop autoboot: 0

When seeing "Hit any key to stop autoboot," press any key on the keyboard. The prompt shall change from Supervivi> to MINI2440 #. Get the information about the NAND flash:

MINI2440 # nand info

Device 0: NAND 64MiB 3,3V 8-bit, page size 512, sector size 16 KiB

Erase everything on the NAND flash:

MINI2440 # nand scrub

NAND scrub: device 0 whole chip Warning: scrub option will erase all factory set bad blocks!

  • There is no reliable way to recover them. Use this command only for testing purposes if you are sure of what you are doing!

Really scrub this NAND flash? <y/N> Erasing at 0x3ffc000 -- 100% complete. Bad block table not found for chip 0 Bad block table not found for chip 0 OK

Please enter a lower case y and press Enter when prompted.

Now create a new partition table

MINI2440 # nand createbbt Create BBT and erase everything ? Skipping bad block at 0x03ff0000 Skipping bad block at 0x03ff4000 Skipping bad block at 0x03ff8000 Skipping bad block at 0x03ffc000

Creating BBT. Please wait ...Bad block table not found for chip 0 Bad block table not found for chip 0 Bad block table written to 0x03ffc000, version 0x01 Bad block table written to 0x03ff8000, version 0x01

and partition the NAND flash using u-boot default configuration. Each partition shall be given a name.

MINI2440 # mtdparts

device nand0 <mini2440-nand>, # parts = 4

  • #: name size offset mask_flags 0: u-boot 0x00040000 0x00000000 0 1: env 0x00020000 0x00040000 0 2: kernel 0x00500000 0x00060000 0 3: root 0x03aa0000 0x00560000 0

active partition: nand0,0 - (u-boot) 0x00040000 @ 0x00000000

defaults: mtdids : nand0=mini2440-nand mtdparts: <NULL>

Now write u-boot to NAND flash

MINI2440 # nand write 0x31000000 u-boot

NAND write: device 0 offset 0x0, size 0x40000

  • 262144 bytes written: OK

Reset the on-board switch to NAND flash and reboot mini2440

Now you shall see all u-boot informations on the minicom window. Hit any key when you see the promption "Hit any key to stop autoboot."

Now set a NAND flash offset since later you won't want to write stuffs on the area that contains u-boot.

MINI2440 # dynenv set 40000 device 0 offset 0x40000, size 0x3fc0000 45 4e 56 30 - 00 00 04 00 MINI2440 # nand erase kernel

NAND erase: device 0 offset 0x60000, size 0x500000 Erasing at 0x55c000 -- 100% complete. OK

Copy the Linux kernel image onto an SD card and insert the SD card to the card reader of mini2440. Now initialize the SD card.

MINI2440 # mmcinit trying to detect SD Card... Manufacturer: 0x02, OEM "TM" Product name: "SD01G", revision 2.3 Serial number: 2486075243 Manufacturing date: 1/2002 CRC: 0x72, b0 = 1 READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=365 size = 1642070016

Suppose the Linux kernel image has the filename "uImage." Now load it to the RAM first.

MINI2440 # fatload mmc 0:1 0x31000000 uImage reading uImage

1945804 bytes read

Write the Linux kernel from RAM to the NAND flash partition called "kernel."

MINI2440 # nand write 0x31000000 kernel

NAND write: device 0 offset 0x60000, size 0x500000

  • 5242880 bytes written: OK

Deploying RootFS

follow the same steps that you did for downloading Linux kernel. Just write to NAND partition "root" instead of "kernel."

Initialize SD card

MINI2440 # nand erase root MINI2440 # mmcinit trying to detect SD Card... Manufacturer: 0x02, OEM "TM" Product name: "SD01G", revision 2.3 Serial number: 2486075243 Manufacturing date: 1/2002 CRC: 0x72, b0 = 1 READ_BL_LEN=15, C_SIZE_MULT=7, C_SIZE=365 size = 1642070016

Load GPE image to RAM, supposing the filename is gpe-image-micro2440.jffs2.

MINI2440 # fatload mmc 0:1 0x31000000 gpe-image-micro2440.jffs2 reading gpe-image-micro2440.jffs2

39239680 bytes read

Since the GPE image is compiled in JFFS2 filesystem, you need to write it as a JFFS2 image.

MINI2440 # nand write.jffs2 0x31000000 root ${filesize}

NAND write: device 0 offset 0x560000, size 0x256c000

Writing data at 0x2acbe00 -- 100% complete.

  • 39239680 bytes written: OK

Finalization

Now you are pretty much done. Just do the two last things as follows

MINI2440 # setenv bootcmd nboot.e kernel \; bootm MINI2440 # saveenv Saving Environment to NAND... Erasing Nand...Writing to Nand... done

Now reset your mini2440 and enjoy!

Challenges

Our version of the 2440 has 128 MB NAND Flash with 2KB blocks and 128KB erase blocks. Most of the instructions and Das U-Boot images are for 64MB with 512 byte blocks and 16KB erase blocks. See here.

Edited openembedded/conf/machine/mini2440.conf