LaFonera Hardware SD-Card

From DD-WRT Wiki

Jump to: navigation, search

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


[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:

[edit] SDIO Pinout

Detailed Pinout of the LaFonera according to pinout.txt

GPIO	        Pin on LaFonera
0		TP3	
1		pin 5 of SW1
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

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 ( . 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' (
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 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

[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) 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 ( explains how to make an SD Card PCB.

There is a video on making a Floppy Drive SD Card Connector for embedded devices here: SD Card Connector.avi

Least expensive way is to connect micro SD card. Those can be bought with SD card adapter ( 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


[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


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