Recent site activity

SD_MMC_Howto


This document tries to collate all the bits and pieces related to adding a SD/MMC card to the biffboard.

,
Still fits perfetctly well in the original case!
Ignore the other "floating" wires in the pictures -- it's my "floating" serial connector, that can be folded back in the case.


As of today 22/10/09:
  • The card can be used to boot a kernel, but there are no tools to prepare cards to do so - it needs a "lilo" lke block list that is not practical to use. 
  • There is no support for having the root filesystem on the SD card as of today, however a pivot-root is possible, but it's impractical since it would need another root file sytem somewhere to pivot, from.
  • It is still possible to use a card for storage, without locking up the USB port.

Prerequisites

  • Kynar wire.
  • JTAG must be disabled -- see below
  • biffboot requires a particular pinout to recognize the card
  • You need reasonably good soldering skills

Kynar wire

Some people want to use piece of electrical wire they have around, but really, for board patching, you need Kynar Wire. It's 30awg insulated wire that is easy to route, easy to solder, easy to mess up, easy to melt the insulation of etc etc, however, it's essential. You can pick a roll on eBay for a few bucks. It'll last for years and years.

Unrelated: I often do complete prototyping bits with just kynar wire. You need some, go and get it.


Disabling JTAG

There are various documents related to this, but I'll duplicate it here because it's a prerequisite, and to show how I did it on my board. The key to it is R19. I removed it by heating one side with the iron and pulling gently on the resistor with tweezers. After a couple of seconds the heat is enough to soften the solder on the other side of the resistor and it is easy to remove.
I attached some Kynar to the pad and route it to a GND pin from the nearby connector.
I used a 1.5K pulldown (the "152" in the picture); it's a 0805 SMD resitor, if you don't have any you can find whole kits of 0805 for next to nothing on eBay -- check "surelectronics" seller, for example. 



How I added the resistor: 
The idea is to melt the solder on the pad/pin, and approach/slide the resitor with tweezers, then remove the iron once one end of the resitor is in the melted solder. 
Once that is done, add a tiny amount of solder to the other side of the resistor, and approach the end of the kynar wire. There you go, clean pulldown.


Pinout

SD card

From Biffboot page, you get some information on that, it's for straight MMC card in SPI mode, the microSD is similar.


Pin2:   CLK          GPIO 11
Pin3:   MISO        GPIO 13
Pin4:   CS            GPIO 9
Pin5:   MOSI        GPIO 12

MicroSD

The pinout is very similar, you get a couple of unused pins and one less GND to connect:

MicroSD Slot fitting

I used the cheapest PCB micro-sd slot available (£0.44 at farnell). I buy these because they are 1) cheap 2) smallest footprint -- they are not the fancy ones with push/push insert/eject etc, but they do the job for small amount of card manipulation. The fancy ones will probalby work too.

What I did was to superglue it, wrong side up to the memory IC. Use a single small drop of superglue, you don't want it to spill. The base of the slot (where the wires are) are at the top, easy to solder onto. The MicroSD is sticking out so it is easy to remove once you do the cutout in the case.



Ignore the 4 wires to the left, it's my serial port header 


Without the card inserted, note I offseted the slot some too, to have a wide gap to the CPU heatsink.


Linux Configuration

Work in progress, we need a platform driver for this; right now it uses the configfs method, that is not ideal.

Install necessary modules

# modprobe gpiommc
gpiommc: Unknown symbol spi_gpio_next_id
# modprobe rdc321x_gpio
RDC321x GPIO driver: 'bank1' enabled
RDC321x GPIO driver: 'bank2' enabled

Mount configfs, if needed

# mkdir /config
# mount -t configfs configfs /config

Configure the gpiommc module

# mkdir /config/gpiommc/card
# cd /config/gpiommc/card/
# ls
gpio_chipselect            max_bus_speed
gpio_chipselect_activelow  register
gpio_clock                 spi_delay
gpio_data_in               spi_mode
gpio_data_out

# echo 11 >gpio_clock
# echo 13 >gpio_data_out
# echo 9 >gpio_chipselect
# echo 12 >gpio_data_in

# echo 3 >spi_mode

Start / register the card to the kernel

# echo 1 >register
mmc_spi spi32765.0: ASSUMING 3.2-3.4 V slot power
mmc_spi spi32765.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
gpio-mmc: MMC-Card "card" attached to GPIO pins di=12, do=13, clk=11, cs=9
mmc_spi spi32765.0: can't change chip-select polarity
mmc0: host does not support reading read-only switch. assuming write-enable.
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 SD01G 982 MiB
 mmcblk0: p1 p2

Remind busybox to create the device files

# mdev -s
# mount /dev/mmcblk0p1 /mnt/
kjournald starting.  Commit interval 5 seconds
EXT3 FS on mmcblk0p1, internal journal
EXT3-fs: recovery complete.
EXT3-fs: mounted filesystem with writeback data mode.
# df
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 9647      2780      6379  30% /
mdev                     14904         0     14904   0% /dev
none                     14904         0     14904   0% /dev/shm
/dev/mmcblk0p1            4039      2872       963  75% /mnt

Thats All Folks!

Comments