OpenWrt Forum Archive

Topic: mmc_over_gpio with SD-Card - write/read speed extremely slow (25kb/s)

The content of this topic has been archived on 26 Apr 2018. There are no obvious gaps in this topic, but there may still be some posts missing at the end.

Hi,

i attached a SD-Card to my Linksys WRT54GL 1.1. The following gpio's are used:

2 = data-in
4 = data-out
3 = clock
7 = chip select

The installed OpenWRT version is KAMIKAZE 8.09.1, r16278 (kernel 2.6). I installed these packages:

kmod-mmc    2.6.25.20-brcm47xx-1
kmod-mmc-over-gpio    2.6.25.20-brcm47xx-2
kmod-mmc-spi    2.6.25.20-brcm47xx-1
luci-app-mmc_over_gpio    0.8.7-1

To get the card working i had to modify the mmc_over_gpio startup script. The gpio for data-in was set to 5, but i use gpio 2.

The invocation of '/etc/init.d/mmc_over_gpio start' results then in the following output from dmesg:

gpio-mmc: Failed to request mmc_spi module.
mmc_spi spi32766.0: ASSUMING 3.2-3.4 V slot power
mmc_spi spi32766.0: SD/MMC host mmc0, no DMA, no WP, no poweroff
gpio-mmc: MMC-Card "default" attached to GPIO pins di=2, do=4, clk=3, cs=7
mmc_spi spi32766.0: can't change chip-select polarity
mmc0: new SD card on SPI
mmcblk0: mmc0:0000 NCard 1948672KiB
 mmcblk0: p1

Mounting the card is no problem, after

kmod-fs-vfat    2.6.25.20-brcm47xx-1
kmod-nls-cp437    2.6.25.20-brcm47xx-1
kmod-nls-iso8859-1    2.6.25.20-brcm47xx-1

are present.

mount -t vfat /dev/mmcblk0p1 /mnt/mmc -o rw

Now i am able to read and write onto the card. But the speed is a great problem.
I had to adjust the test scripts (which are available on the net) to write only 500kb instead of 32Mb.
The writing of 500kb takes 20 seconds.
The reading of 500kb (after a fresh remount) takes also almost 20s.

That means data is written or read only at approx. 25kb/s.

What are possible reasons for these extreme low transfer rates? Is there anything i can do to improve the speed?

I hope, someone can give me some hints to solve the problem.

Greetings Joe

Hi,

because i got no hints how to improve the speed with kernel 2.6 and the mentioned packages, i decided to switch to kernel 2.4 image of 8.09.1 for the WRT54GL 1.1.

I used the mmc driver and instructions from thread Problem with SDHC card#21.

The modification of the configuration was no problem. You only have to ensure that "dbg" is set to something different than 0.

dmesg gives me:

[INF] sdhc: Version: 2.0.1  Parms: major=0 din=2 dout=4 clk=3 cs=7 maxsec=32 rahead=2 dbg=0001
[DBG] sdhc: init: power on/insertion initialization...
[DBG] sdhc: init: CMD0 - reset...
[DBG] sdhc: init SD: CMD8 - CIC voltage range check...
[DBG] sdhc: init SD: CMD58 - OCR voltage range check...
[DBG] sdhc: init SD: ACMD41 - card initialization...
[DBG] sdhc: init SD: CMD58 - Card Capacity Status check...
[DBG] sdhc: init SD: CMD10 - Card Identification Register read...
[DBG] sdhc: init SD: CMD9 - Card Specific Data read...
[DBG] sdhc: init SD: ACMD51 - SD Config Register read...
[INF] sdhc: SD Card detected & initialized
[DBG] sdhc: init - CMD16 - set 512 byte blocksize...
[INF] sdhc: Assigned dynamic major number 254
 /dev/sdcard: p1
[INF] sdhc: Module loaded

This driver also includes a speed test which can be invoked by "/etc/init.d/sdcard test":

Running write test - 32MB file
real    0m 42.03s
user    0m 0.14s
sys     0m 6.39s
Running read test - 32MB file
real    1m 17.88s
user    0m 0.07s
sys     0m 56.63s
Divide 32768 by elapsed seconds (real) to get throughput in KB/s

As you can see the results are much better (compared to the values achieved with kernel 2.6 and default driver).
write speed: 780kb/s
read speed: 420kb/s

This is more than 10 times faster.

So there is still the question, why kernel 2.6 with standard mmc driver only achieves 25kb/s. Is there something wrong with that driver or do you have to do more than adjusting the gpios for configuration?

Greetings Joe

Well i encountered exactly the same problem with the mmc_over_gpio modul and kernel 2.6. I also switched back to 2.4...

It would be interesting to know if someone was able to get his sdmod working with reasonable speed under kernel 2.6...

(Last edited by resus on 23 Oct 2009, 23:53)

Get a router with USB if you need extra storage...

The discussion might have continued from here.