LaFonera Hardware SD-Card

From DD-WRT Wiki

Revision as of 11:59, 16 February 2009 by Flameman (Talk | contribs)
Jump to: navigation, search

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

Contents

LaFonera SD Card Hack

Caution

JFFS is enabled in 0403 and later builds.

Purpose

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

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.

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

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

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:


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.


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


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.

The original idea

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

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 embeded 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 pron is that you'll get an official micro SD slot for plugin cards...

Existing SD Card hacks for other devices



ucGentoo on fonera.2100

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









.

Card Reader Mounting Methods

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.