Mounting of SD card on custom board

Go To Last Post
10 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I am working once again on my custom board, which is based on the NGW100 evaluation kit. The flash memories and SDRAM on are the same as the NGW100. The custom board includes SD-card slot and USB, as well as the image sensor interface.

Having used the official version of Atmel buildroot, I managed to flash u-boot and subsequently transfer the file system created by buildroot onto the board. :D

I have been trying without success to access the SD CARD on this custom board. I am using a 512 MB SanDisk SD Card, which works very well on my Ubuntu laptop and on the NGW100 evaluation kit.

When I insert an SD card into the slot on the NGW100, the card is detected and I am able to access files on the card by looking in the /media directory.

However, on my custom board, there are no files for the SD card listed in the /media directory.

Furthermore, I cannot load the mass-storage driver by following the instructions on the AVRfreaks wiki.

Running

make xconfig ARCH=avr32

in my Linux buildroot directory shows that I have compiled the atmel-mmc drivers as modules.

Does anyone know what I can do to get the SD card to mount in the /media directory?

Which compilation options should I use when running buildroot?

What do I compile as a module and what do I compile into the kernel itself?

Here is the output of the startup on my custom board:

U-Boot 1.3.0.atmel.2 (Feb 10 2008 - 19:41:08)

U-Boot code: 00000000 -> 00010260  data: 00016128 -> 0004c798
SDRAM: 32 MB at address 0x10000000
Testing SDRAM...OK
malloc: Using memory from 0x11f73000 to 0x11fb3000
DMA: Using memory from 0x11f6f000 to 0x11f73000
Flash:  8 MB at address 0x00000000
DRAM Configuration:
Bank #0: 10000000 32 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0, macb1
Press SPACE to abort autoboot in 1 seconds
### JFFS2 loading '/boot/uImage' to 0x90300000
Scanning JFFS2 FS: ........ done.
### JFFS2 load complete: 1062594 bytes loaded to 0x90300000
## Booting image at 90300000 ...
   Image Name:   Linux-2.6.23
   Image Type:   AVR32 Linux Kernel Image (gzip compressed)
   Data Size:    1062530 Bytes =  1 MB
   Load Address: 10000000
   Entry Point:  90000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel at 90000000 (params at 11f73008)...

Linux version 2.6.23 (nkinar@dawn) (gcc version 4.2.1-atmel.1.0.3) #7 Sun Feb 10 21:59:34 CST 2008
CPU: AP7000 [01] revision 0 (AVR32B revision 1)
CPU: MMU configuration: Shared TLB
CPU: features: dsp simd ocd perfctr java
CPU: Running at 140.000 MHz
Physical memory:
  10000000-11ffffff
Reserved memory:
  10000000-101658ad: Kernel code
  101658ae-101cdce7: Kernel data
Exception vectors start at 90010000
CPU: Paging enabled
Node 0: start_pfn = 0x10000, low = 0x12000
Node 0: mem_map starts at 901d0000
Built 1 zonelists in Zone order.  Total pages: 8128
Kernel command line: console=ttyS0 root=/dev/mtdblock1 rootfstype=jffs2
PID hash table entries: 128 (order: 7, 512 bytes)
timer: AT32AP system timer/counter at 0xfff00c00 irq 22
console [ttyS0] enabled
Dentry cache hash table entries: 4096 (order: 2, 16384 bytes)
Inode-cache hash table entries: 2048 (order: 1, 8192 bytes)
Memory: 30632k/30632k available (1366k kernel code, 2136k reserved, 103k data, 64k init)
SLUB: Genslabs=20, HWalign=32, Order=0-1, MinObjects=4, CPUs=1, Nodes=1
Calibrating delay using timer specific routine.. 280.54 BogoMIPS (lpj=561087)
Mount-cache hash table entries: 512
NET: Registered protocol family 16
pdc pdc.0: Atmel Peripheral DMA Controller enabled
at32_eic at32_eic.0: External Interrupt Controller at 0xfff00100, IRQ 19
at32_eic at32_eic.0: Handling 4 external IRQs, starting with IRQ 64
smc smc.0: Atmel Static Memory Controller at 0xfff03400
Generic PHY: Registered new driver
dmac0: DesignWare DMA controller at 0xff200000 irq 2
Time: avr32 clocksource has been installed.
NET: Registered protocol family 2
IP route cache hash table entries: 1024 (order: 0, 4096 bytes)
TCP established hash table entries: 1024 (order: 1, 8192 bytes)
TCP bind hash table entries: 1024 (order: 0, 4096 bytes)
TCP: Hash tables configured (established 1024 bind 1024)
TCP reno registered
audit: initializing netlink socket (disabled)
audit(1167609600.283:1): initialized
JFFS2 version 2.2. (NAND) © 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler cfq registered (default)
atmel_usart.0: ttyS0 at MMIO 0xffe00c00 (irq = 6) is a ATMEL_SERIAL
atmel_usart.1: ttyS1 at MMIO 0xffe01000 (irq = 7) is a ATMEL_SERIAL
atmel_usart.2: ttyS2 at MMIO 0xffe01400 (irq = 8) is a ATMEL_SERIAL
atmel_usart.3: ttyS3 at MMIO 0xffe01800 (irq = 9) is a ATMEL_SERIAL
physmap platform flash device: 00800000 at 00000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0041
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x00000000-0x00020000 : "u-boot"
0x00020000-0x007f0000 : "root"
0x007f0000-0x00800000 : "env"
Generic platform RAM MTD, (c) 2004 Simtec Electronics
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xffe00000 (irq 3)
at32ap700x_rtc at32ap700x_rtc.0: rtc core: registered at32ap700x_rtc as rtc0
at32ap700x_rtc at32ap700x_rtc.0: Atmel RTC for AT32AP700x at fff00080 irq 21
at32_wdt at32_wdt.0: AT32AP700X WDT at 0xfff000b0, timeout 2 sec (nowayout=0)
TCP cubic registered
Initializing XFRM netlink socket
NET: Registered protocol family 1
NET: Registered protocol family 10
IPv6 over IPv4 tunneling driver
NET: Registered protocol family 17
NET: Registered protocol family 15
at32ap700x_rtc at32ap700x_rtc.0: setting the system clock to 1970-01-01 00:00:00 (0)
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 64K (90000000 - 90010000)
Mounting virtual filesystems:
  /proc mounted
  /sys mounted
  /dev mounted
  /dev/pts directory made
  /dev/pts mounted
  /dev/shm directory made
  /config mounted
  /tmp mounted
  /var/run mounted
  /var/log mounted
Setting up mdev: done
Setting hostname: 'ngw.example.net'
Starting syslogd: done
Log messages to syslog: done
Starting klogd: done
Probing modules:
Starting portmap: done
Mounting local filesystems: mount: mounting /dev/mtdblock3 on /usr failed: No such file or directory
failed
Network interfaces: udhcpc: SIOCGIFINDEX: No such device
ifconfig: SIOCGIFFLAGS: No such device
ifconfig: SIOCSIFADDR: No such device
failed
Starting dnsmasq: missing
/etc/init.d/S22iptables: line 3: which: not found
Enable NAT:
  IPv4 forwarding: done
  iptables postrouting: missing
Starting telnetd: missing
Starting inetd: missing
Starting httpd: missing
Starting ntpdate: missing
  WARNING: could not syncronize clock, edit NTPSERVERS in /etc/default/ntpdate.
Mounting remote filesystems: done
Starting SMB services: /etc/init.d/S91smb: line 102: smbd: not found
failed
Starting NMB services: /etc/init.d/S91smb: line 102: nmbd: not found
failed

NGW100 ready



BusyBox v1.7.2 (2008-02-10 13:57:59 CST) built-in shell (ash)
Enter 'help' for a list of built-in commands.

#


This is to be contrasted with the startup currently running on my NGW100 starter kit:



U-Boot 1.3.1 (Feb 10 2008 - 12:42:42)

U-Boot code: 00000000 -> 00010a60  data: 00016998 -> 0004cf90
SDRAM: 32 MB at address 0x10000000
Testing SDRAM...OK
malloc: Using memory from 0x11f73000 to 0x11fb3000
DMA: Using memory from 0x11f6f000 to 0x11f73000
Flash:  8 MB at address 0x00000000
DRAM Configuration:
Bank #0: 10000000 32 MB
*** Warning - bad CRC, using default environment

In:    serial
Out:   serial
Err:   serial
Net:   macb0, macb1
Press SPACE to abort autoboot in 5 seconds
### JFFS2 loading 'uImage' to 0x10400000
Scanning JFFS2 FS: ....... done.
### JFFS2 load complete: 912671 bytes loaded to 0x10400000
## Booting image at 10400000 ...
   Image Name:   Linux-2.6.18-atngw
   Image Type:   AVR32 Linux Kernel Image (gzip compressed)
   Data Size:    912607 Bytes = 891.2 kB
   Load Address: 10000000
   Entry Point:  90000000
   Verifying Checksum ... OK
   Uncompressing Kernel Image ... OK

Starting kernel at 90000000 (params at 11f73008)...

pdc pdc.0: Atmel Peripheral DMA Controller enabled
EIM: External Interrupt Module at 0xfff00000, IRQ 19
EIM: Handling 4 external IRQs, starting with IRQ 64
smc smc.0: Atmel Static Memory Controller at 0xfff03400
pio0: Atmel Port Multiplexer at 0xffe02800 (irq 13)
pio0: Handling 32 external IRQs, starting with IRQ 96
pio1: Atmel Port Multiplexer at 0xffe02c00 (irq 14)
pio1: Handling 32 external IRQs, starting with IRQ 128
pio2: Atmel Port Multiplexer at 0xffe03000 (irq 15)
pio2: Handling 32 external IRQs, starting with IRQ 160
pio3: Atmel Port Multiplexer at 0xffe03400 (irq 16)
pio3: Handling 32 external IRQs, starting with IRQ 192
pio4: Atmel Port Multiplexer at 0xffe03800 (irq 17)
pio4: Handling 32 external IRQs, starting with IRQ 224
dmac0: DesignWare DMA controller at 0xff200000 irq 2
NET: Registered protocol family 2
IP route cache hash table entries: 256 (order: -2, 1024 bytes)
TCP established hash table entries: 1024 (order: 0, 4096 bytes)
TCP bind hash table entries: 512 (order: -1, 2048 bytes)
TCP: Hash tables configured (established 1024 bind 512)
TCP reno registered
JFFS2 version 2.2. (NAND) (C) 2001-2006 Red Hat, Inc.
io scheduler noop registered
io scheduler cfq registered (default)
Serial: Atmel USART3 driver
usart.1: ttyS0 at MMIO 0xffe01000 (irq = 7) is a USART3
loop: loaded (max 8 devices)
physmap platform flash device: 00800000 at 00000000
physmap-flash.0: Found 1 x16 devices at 0x0 in 16-bit bank
 Amd/Fujitsu Extended Query Table at 0x0041
number of CFI chips: 1
cfi_cmdset_0002: Disabling erase-suspend-program due to code brokenness.
cmdlinepart partition parsing not available
RedBoot partition parsing not available
Using physmap partition information
Creating 3 MTD partitions on "physmap-flash.0":
0x00000000-0x00020000 : "u-boot"
0x00020000-0x007f0000 : "root"
0x007f0000-0x00800000 : "env"
atmel_spi atmel_spi.0: Atmel SPI Controller at 0xffe00000 (irq 3)
mtd_dataflash spi0.0: AT45DB642x (8448 KBytes)
ip_conntrack version 2.4 (256 buckets, 2048 max) - 204 bytes per conntrack
ip_tables: (C) 2000-2006 Netfilter Core Team
TCP bic registered
NET: Registered protocol family 1
NET: Registered protocol family 17
Time: avr32 clocksource has been installed.
VFS: Mounted root (jffs2 filesystem).
Freeing init memory: 56K (90000000 - 9000e000)
init started:  BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) multi-call binary
 * mounting virtual filesystems: /proc /sys /dev /dev/pts /config /tmp /var/run /var/lib/samba /var/log
 * set mdev hotplug ...          [ OK ]
 * mdev ...                      [ OK ]
 * setting hostname ...          'ngw.example.net'
 * network loopback ...          [ OK ]
 * starting syslogd ...          [ OK ]
 * log messages to syslog ...    [ OK ]
 * starting klogd ...            [ OK ]
 * probing modules ...           vfat loaded, mmc_block loaded, atmel-mci loaded, [ OK ]
 * mounting filesystems:         /usr
 * setup eth0 ...                [ FAILED ]
 * Network ...                   [ FAILED ]
 * get board type for GPIO ...   'NGW'
 * setup GPIO boot LED ...       [ OK ]
 * setup GPIO LED A ...          [ OK ]
 * setup GPIO LED B ...          [ OK ]

Network Gateway ready



BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) Built-in shell (ash)
Enter 'help' for a list of built-in commands.

~ #

Note that the filesystems are being mounted at the very end. Is there a script that I can run to do the same on my custom board?

Nicholas

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why is there a "bad CRC" being listed at the startup of u-boot?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nkinar wrote:
in my Linux buildroot directory shows that I have compiled the atmel-mmc drivers as modules.

You should change this to compiled in (y)

nkinar wrote:
Does anyone know what I can do to get the SD card to mount in the /media directory?

Yes first the option above ( or load the module )
But if your root filesystem rely on the sd card then there you will fin the sd card as / (root)
If you

nkinar wrote:
Which compilation options should I use when running buildroot?

You could use atngw100-base_defconfig or atngw100_defconfig.
Loop under the subfolders target/device/Atmel
for the baseic buildroot config and the under the subfolder with the same name for more configs

nkinar wrote:
What do I compile as a module and what do I compile into the kernel itself?

That you have to figure out.. But if you need more that on serial gadget driver you meed to keep them as a module so you can unload one before loading the next one.

nkinar wrote:
Why is there a "bad CRC" being listed at the startup of u-boot?

This is because you have never issued a saveenv command that writed the env settings in u-boot to the desired sector together with an crc check of the values.

Life's to short for waiting on slow CPU's

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Thank you so much for this reply, eaanon01! I will change the compilation and try again. I'll post my results here in this forum thread. It will work this time!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

nkinar wrote:
Why is there a "bad CRC" being listed at the startup of u-boot?
Probably because you haven't 'saveenv'd since you last reprogrammed uboot. Just pause startup at the uboot prompt, run 'saveenv' then 'boot' as usual.

-S.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I tried all of the suggestions given above, and each suggestion is correct---

but it seems that the problem here is that 'init' is not starting with busybox. From the logs given above, it is apparent that the following version of the startup is not present on my custom board:

(or is the startup present?)

This is part of the startup on the NGW100:

init started:  BusyBox v1.4.2 (2007-04-17 15:34:55 CEST) multi-call binary
 * mounting virtual filesystems: /proc /sys /dev /dev/pts /config /tmp /var/run /var/lib/samba /var/log
 * set mdev hotplug ...          [ OK ]
 * mdev ...                      [ OK ]
 * setting hostname ...          'ngw.example.net'
 * network loopback ...          [ OK ]
 * starting syslogd ...          [ OK ]
 * log messages to syslog ...    [ OK ]
 * starting klogd ...            [ OK ]
 * probing modules ...           vfat loaded, mmc_block loaded, atmel-mci loaded, [ OK ]
 * mounting filesystems:         /usr
 * setup eth0 ...                [ FAILED ]
 * Network ...                   [ FAILED ]
 * get board type for GPIO ...   'NGW'
 * setup GPIO boot LED ...       [ OK ]
 * setup GPIO LED A ...          [ OK ]
 * setup GPIO LED B ...          [ OK ] 

Does anyone know how to turn on 'init'? Note that in the custom startup on my board, none of the modules are being probed!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

For comparison, my custom board startup does not show probing of any modules:

Setting up mdev: done
Setting hostname: 'ngw.example.net'
Starting syslogd: done
Log messages to syslog: done
Starting klogd: done
Probing modules:
Starting portmap: done 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I have a sneaking suspicion that this problem could be due to more recent versions of the Atmel kernel having the modules "built-in." After all, the instructions for starting the mass storage device on the SD Card date back to June 2007:

https://www.avrfreaks.net/wiki/in...

I would like to be able to use the SD card as a mass storage device, but I wonder if the instructions presented at the above web address are for the recent version of Atmel buildroot.

As I type this, I am downloading the oldest version of Atmel buildroot (June 2007) from the archive at:

http://www.atmel.no/buildroot/so...

I'll try compiling this and see if it works.

How would you start up the mass storage device on more recent versions of the kernel built by the current Atmel buildroot?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Mass storage is not built in but are as a module. You chould check and is the scripts are ran but the output migth not be seen. Try adding a script under /etc/init.d/ called S85StartTest
And make it do something that you can check aterwords. ( eg: mkdir /testInit ). If you compile mass srage in the kernel then you will not be able to use the usb for a lot of things... you should leave it as a module

Life's to short for waiting on slow CPU's

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hi everyone--

Thank you so much for your help, eaanon01 and thank you for clarifying, Squidgit.

I went back to the current version of buildroot (revision 2.1.0, updated 20071213) and built both the sdcard and g_file_storage drivers as modules.

It worked! (I then realized that there was a signal integrity problem with the USB bus lines, which I rectified.)

So thank you for your suggestions!