LaFonera Hardware SD-Card

From DD-WRT Wiki

(Difference between revisions)
Jump to: navigation, search
Revision as of 21:17, 5 March 2007 (edit)
Foxx (Talk | contribs)
(Cheap SD Card "reader" (floppy cable))
← Previous diff
Current revision (12:10, 14 May 2010) (edit) (undo)
Glenn (Talk | contribs)
(-cat)
 
(35 intermediate revisions not shown.)
Line 1: Line 1:
-[[Category:LaFonera]]+ 
-[[Category:LaFonera_Hardware]]+[[Category:LaFonera_Hardware_(en)]]
-You are here: '''[[Main_Page|DD-WRT wiki mainpage]] / [[LaFonera|LaFonera]] / [[LaFonera_Hardware|Hardware]] / SD-Card'''+You are here: '''[[Main_Page|DD-WRT wiki mainpage]] / [[LaFonera_(en)|LaFonera]] / [[:Category:LaFonera_Hardware_(en)|Hardware]] / SD-Card'''
== LaFonera SD Card Hack == == LaFonera SD Card Hack ==
 +
 +===Caution===
 +
 +JFFS is enabled in 0403 and later builds.
===Purpose=== ===Purpose===
Line 12: Line 16:
A kernel module is required in order to use the MMC hack. A kernel module is required in order to use the MMC hack.
Using Rob Wentworth MMC drivers for [http://uanr.com/mmc/ OpenWRT] or compile [http://fghhgh.150m.com/ these] using the toolchain on your LaFonera. Using Rob Wentworth MMC drivers for [http://uanr.com/mmc/ OpenWRT] or compile [http://fghhgh.150m.com/ these] using the toolchain on your LaFonera.
 +
 +===MMC BETA driver for the LaFonera===
 +A beta MMC Driver for kernel 2.6 is avaible. It uses gpio bitbanging, the code is currently being reworked a bit to make it look nicer.
 +*Known issues: (version 0.1 for fonera)
 + * seg fault on rmmod -- fixed
 + * seg fault when atomic
 + * dev nodes do not get allocated automatically yet
 + * no detailed howto yet
 +These issues will be fixed within the next days. the driver runs stable, as long as you do not insert or remove the card while the driver is loaded.
 +
 +Package and sourcecode of MMC Beta Driver can be downloaded here: http://phrozen.org/fonera.html
===SDIO Pinout=== ===SDIO Pinout===
-Pinout of the LaFonera according to http://kwzs.be/~kevin/ar531x/gpio%20pinout.txt+ 
 +Detailed
 +Pinout of the LaFonera according to http://kwzs.be/~kevin/ar531x/gpio pinout.txt
GPIO Pin on LaFonera GPIO Pin on LaFonera
Line 25: Line 42:
6 RESET button 6 RESET button
7 pin 6 of SW1 7 pin 6 of SW1
 +=== Fonera sd-card hack ===
-===Cheap SD Card "reader" (floppy cable)===+I read on several websites, that some people managed to wire a SD Card (or a MMC) to a Fonera access point. After a little googling, I discover this can be done easily, so I decided to test.. but I run into one issue so I decided to describe the process here.
 + 
 +Here the finished result:
 + 
 +[[Image:LaFonera_Hardware_SD-Card_-_01_overview.jpg|the finished result]]
 + 
 +Let's give it a try:
 + 
 + 
 +==== Solder the sd-card ====
 + 
 +The first step, is to locate the SW pins (near the antenna).. simply solder some wires like this:
 + 
 +<pre>
 +SD Card ----- Fonera
 + DO (pin 7) SW1
 + CLK (pin 5) SW2
 + DI (pin 2) SW5
 + CS (pin 1) SW6
 + Gnd (pin 3) Gnd
 + Vcc (pin 4) Vcc
 +</pre>
 + 
 + 
 +Here you can see the SD Card pinouts at http://pinouts.ru/Memory/sdcard_pinout.shtml
 + 
 +[[Image:LaFonera_Hardware_SD-Card_-_02_sd-card_reader.jpg|sd-card-reader detail]]
 + 
 +You can solder the VCC, and Gnd on the serial pins.
 + 
 + 
 +==== Unsolder the caps ====
 + 
 +In my first tests, I discovered the SD card is detected, so I checked the signals. And discover the clk isn't really clear.. So I decided to remove the capacitor on the SPI bus. (C142, C143, C144, C145)
 + 
 +[[Image:LaFonera_Hardware_SD-Card_-_03_fonera_detail.jpg|LaFonera detail]]
 + 
 + 
 +==== Install software and test ====
 + 
 +Next we need to install the kernel module on OpenWRT. You can find it on the phrozen website (http://phrozen.org/fonera.html) . Simply ipkg install the file and it should be ok. Now, let's try: insert a SD Card, and reboot, you should see something like this in your log.
 + 
 +<pre>
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : MMC Driver for Fonera Version 2.5 (050507) -- '2B|!2B' (john@phrozen.org)
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : Card Found
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : card in op mode
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : SIZE : 241, nMUL : 6, COUNT : 1932, NAME : 256MB
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : Card Initialised
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : The inserted card has a capacity of 253231104 Bytes
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : adding disk
 +Jan 1 00:00:49 OpenWrt user.info kernel: mmc1
 +Jan 1 00:00:49 OpenWrt user.warn kernel: mmc : Card was Found
 +</pre>
 + 
 +So now you can mount it:
 + 
 +<pre>
 +mount /dev/mmc0 /mnt
 +</pre>
 + 
 +This stuff, is working really well, I managed to have around 150Ko/s (reading) which is far enough for my needs. The only issue right now, is that you need to carefully umount the card before removing it, otherwise the fonera will crash.
 + 
 +==== The original idea ====
 +came from http://www.larsen-b.com/Article/262.html
 + 
 +===Mounting the Reader in the Bottom of the Fonera===
 +[[Image:Fonera_card_reader_complete-top.jpg|thumb|center|658px|Fonera with a blue SD card in the card reader]]
 +See [[LaFonera_Hardware_SD-Card/Reader_Position]] for more pictures and instructions.
 + 
 + 
 +===Cheap SD Card "reader" (floppy cable, microSD card adapter)===
http://uanr.com/sdfloppy/ describes how to build a SD card reader from an old 5.25 floppy drive connector. The description is for WRT but maybe this could be used with LaFonera too. http://uanr.com/sdfloppy/ describes how to build a SD card reader from an old 5.25 floppy drive connector. The description is for WRT but maybe this could be used with LaFonera too.
Bastard Sons of Dial-Up Episode 8 (http://BSoDtv.org/episodes.php) explains how to make an SD Card PCB. Bastard Sons of Dial-Up Episode 8 (http://BSoDtv.org/episodes.php) explains how to make an SD Card PCB.
-There is a video on making a Floppy Drive SD Card Connector for embeded devices here: http://bsodtv.wiihost.net/Simple%20SD%20Card%20Connector.avi+There is a video on making a Floppy Drive SD Card Connector for embedded devices here: http://bsodtv.wiihost.net/Simple SD Card Connector.avi
 + 
 +Least expensive way is to connect micro SD card. Those can be bought with SD card adapter (http://en.wikipedia.org/wiki/MicroSD). Solder wires directly to SD card adapter, just be sure that the microSD card is removed at that point. Biggest problem is that you'll get an official micro SD slot for plug-in cards...
===Existing SD Card hacks for other devices=== ===Existing SD Card hacks for other devices===
Line 38: Line 128:
*And this: http://wiki.openwrt.org/PackagesOnExternalMediaHowTo *And this: http://wiki.openwrt.org/PackagesOnExternalMediaHowTo
*Also, there is a SDIO stack from Atheros http://source.mvista.com/~dsingleton/sdio … SDIO-linux which besdes SD cards also intends to support "SDIO USB" which sounds even more interesting :-) *Also, there is a SDIO stack from Atheros http://source.mvista.com/~dsingleton/sdio … SDIO-linux which besdes SD cards also intends to support "SDIO USB" which sounds even more interesting :-)
 +
 +
 +
 +
 +
 +== ucGentoo on fonera.2100 ==
 +
 +
 +an other kernel driver for kernel 2.6.24 to be used with a MMC/SD of 2Gb as rootfs
 +
 +see http://embeddedlinux.movial.fi/Flameman-fonera
 +
 +
 +
 +== OpenWRT Kamikaze 8.09 ==
 +
 +
 + # opk install luci-app-mmc_over_gpio
 + # vi /etc/init.d/mmc_over_gpio
 +
 +edit the line
 + add_device "default" 5 4 3 7 0
 +to
 + add_device "default" 1 3 4 14 0
 + sleep 1
 + remove_device "default"
 + sleep 1
 + add_device "default" 1 3 4 7 0
 +save it with esc+ZZ
 +
 + # /etc/init.d/mmc_over_gpio start
 +
 +then you can see sthg:
 + configfs on /config type configfs (rw)
 + gpio-mmc: Failed to request mmc_spi module.
 + mmc_spi spi32761.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
 + gpio-mmc: MMC-Card "default" attached to GPIO pins di=1, do=3, clk=4, cs=7
 + mmc_spi spi32761.0: can't change chip-select polarity
 + root@OpenWrt:~# mmc0: new SD card on SPI
 + mmcblk0: mmc0:0000 SD01G 1006080KiB
 + mmcblk0: p1
 +
 + # mkdir /mnt/mmc
 + # mount /dev/mmcblk0p1 /mnt/mmc

Current revision

You are here: DD-WRT wiki mainpage / LaFonera / Hardware / SD-Card

Contents

[edit] LaFonera SD Card Hack

[edit] Caution

JFFS is enabled in 0403 and later builds.

[edit] Purpose

It would be nice to be able to attach a SD Card to the LaFonera for storage.

[edit] MMC driver for the LaFonera

A kernel module is required in order to use the MMC hack. Using Rob Wentworth MMC drivers for OpenWRT or compile these using the toolchain on your LaFonera.

[edit] MMC BETA driver for the LaFonera

A beta MMC Driver for kernel 2.6 is avaible. It uses gpio bitbanging, the code is currently being reworked a bit to make it look nicer.

  • Known issues: (version 0.1 for fonera)
   * seg fault on rmmod -- fixed
   * seg fault when atomic
   * dev nodes do not get allocated automatically yet
   * no detailed howto yet

These issues will be fixed within the next days. the driver runs stable, as long as you do not insert or remove the card while the driver is loaded.

Package and sourcecode of MMC Beta Driver can be downloaded here: http://phrozen.org/fonera.html

[edit] SDIO Pinout

Detailed Pinout of the LaFonera according to http://kwzs.be/~kevin/ar531x/gpio pinout.txt

GPIO	        Pin on LaFonera
0		TP3	
1		pin 5 of SW1
2		WLAN LED
3		pin 1 of SW1
4		pin 2 of SW1
5		RESET (!)
6		RESET button
7		pin 6 of SW1

[edit] Fonera sd-card hack

I read on several websites, that some people managed to wire a SD Card (or a MMC) to a Fonera access point. After a little googling, I discover this can be done easily, so I decided to test.. but I run into one issue so I decided to describe the process here.

Here the finished result:

the finished result

Let's give it a try:


[edit] Solder the sd-card

The first step, is to locate the SW pins (near the antenna).. simply solder some wires like this:

SD Card      -----   Fonera
 DO  (pin 7)          SW1
 CLK (pin 5)          SW2
 DI  (pin 2)          SW5
 CS  (pin 1)          SW6
 Gnd (pin 3)          Gnd
 Vcc (pin 4)          Vcc


Here you can see the SD Card pinouts at http://pinouts.ru/Memory/sdcard_pinout.shtml

sd-card-reader detail

You can solder the VCC, and Gnd on the serial pins.


[edit] Unsolder the caps

In my first tests, I discovered the SD card is detected, so I checked the signals. And discover the clk isn't really clear.. So I decided to remove the capacitor on the SPI bus. (C142, C143, C144, C145)

LaFonera detail


[edit] Install software and test

Next we need to install the kernel module on OpenWRT. You can find it on the phrozen website (http://phrozen.org/fonera.html) . Simply ipkg install the file and it should be ok. Now, let's try: insert a SD Card, and reboot, you should see something like this in your log.

Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : MMC Driver for Fonera Version 2.5 (050507) -- '2B|!2B' (john@phrozen.org)
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card Found
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : card in op mode
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : SIZE : 241, nMUL : 6, COUNT : 1932, NAME : 256MB
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card Initialised
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : The inserted card has a capacity of 253231104 Bytes
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : adding disk
Jan  1 00:00:49 OpenWrt user.info kernel: mmc1
Jan  1 00:00:49 OpenWrt user.warn kernel: mmc : Card was Found

So now you can mount it:

mount /dev/mmc0 /mnt

This stuff, is working really well, I managed to have around 150Ko/s (reading) which is far enough for my needs. The only issue right now, is that you need to carefully umount the card before removing it, otherwise the fonera will crash.

[edit] The original idea

came from http://www.larsen-b.com/Article/262.html

[edit] Mounting the Reader in the Bottom of the Fonera

Fonera with a blue SD card in the card reader
Fonera with a blue SD card in the card reader

See LaFonera_Hardware_SD-Card/Reader_Position for more pictures and instructions.


[edit] Cheap SD Card "reader" (floppy cable, microSD card adapter)

http://uanr.com/sdfloppy/ describes how to build a SD card reader from an old 5.25 floppy drive connector. The description is for WRT but maybe this could be used with LaFonera too.

Bastard Sons of Dial-Up Episode 8 (http://BSoDtv.org/episodes.php) explains how to make an SD Card PCB.

There is a video on making a Floppy Drive SD Card Connector for embedded devices here: http://bsodtv.wiihost.net/Simple SD Card Connector.avi

Least expensive way is to connect micro SD card. Those can be bought with SD card adapter (http://en.wikipedia.org/wiki/MicroSD). Solder wires directly to SD card adapter, just be sure that the microSD card is removed at that point. Biggest problem is that you'll get an official micro SD slot for plug-in cards...

[edit] Existing SD Card hacks for other devices



[edit] ucGentoo on fonera.2100

an other kernel driver for kernel 2.6.24 to be used with a MMC/SD of 2Gb as rootfs

see http://embeddedlinux.movial.fi/Flameman-fonera


[edit] OpenWRT Kamikaze 8.09

# opk install luci-app-mmc_over_gpio
# vi /etc/init.d/mmc_over_gpio

edit the line

add_device "default" 5 4 3 7 0

to

add_device "default" 1 3 4 14 0
sleep 1
remove_device "default"
sleep 1
add_device "default" 1 3 4 7 0

save it with esc+ZZ

# /etc/init.d/mmc_over_gpio start

then you can see sthg:

configfs on /config type configfs (rw)
gpio-mmc: Failed to request mmc_spi module.
mmc_spi spi32761.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
gpio-mmc: MMC-Card "default" attached to GPIO pins di=1, do=3, clk=4, cs=7
mmc_spi spi32761.0: can't change chip-select polarity
root@OpenWrt:~# mmc0: new SD card on SPI
mmcblk0: mmc0:0000 SD01G 1006080KiB
 mmcblk0: p1
# mkdir /mnt/mmc
# mount /dev/mmcblk0p1 /mnt/mmc