Can see SD card but can't read/write

Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Hardware DIY / Hardware Mods
Author Message
Johny5
DD-WRT Novice


Joined: 02 Dec 2009
Posts: 23

PostPosted: Fri Mar 05, 2010 20:08    Post subject: Can see SD card but can't read/write Reply with quote
I'm running dd-wrt v24-sp2 (10/10/09) std-nokaid (build 13064) on a wrt54gl. I actually had the SD card mod up and running, but assuming I could always repeat the process, I changed firmwares, and now I have a problem.

I am using the same SD card that worked before (and have tried with 4 differnt cards as well, including a 128mb, 512mb, and 2 gig, and I have tried this on two differnt wrt54gl's. I pre-format the cards each time, and have tried both ext2 and ext3. I have also tried different firmware versions, but now I am back to the one that I know works because it worked before.

When I run df, I can see the card:

/dev/root 2688 2688 0 100% /
/dev/mtdblock/4 128 128 0 100% /jffs
/dev/mmc/disc0/part1 484266 10543 448718 2% /mmc

I can cd /mmc, and when I try to mkdir /mmc/opt I don't get an error, but if I try to cd /mmc/opt it gives me the following:

-sh: cd: can't cd to /mmc/opt

When I try ls, it doesn't show /mmc/opt as being in /mmc. Even if I stick the card in my linux machine and create /mmc/opt, when I stick it back in the router, I still can't see /mmc/opt.

My conclusion is that while I can see the card, the router is having a problem reading and writing to the card. Has anyone had this problm? I've had many other problems along the way, and have figured them out, but I've been working on this for a week and I can't identify the problem. I've changed every variable I can think of, and tested every gpio through the card holder, so I know it's not a hardware problem. Any and all suggestions are welcome. It may just be something small I'm overlooking. HELP!
Sponsor
DHC_DarkShadow
DD-WRT Guru


Joined: 22 Jun 2008
Posts: 2440
Location: Am now Dark_Shadow

PostPosted: Fri Mar 05, 2010 20:38    Post subject: Reply with quote
did you mount /opt?
_________________
The New Me
Johny5
DD-WRT Novice


Joined: 02 Dec 2009
Posts: 23

PostPosted: Fri Mar 05, 2010 21:06    Post subject: Reply with quote
I telenet into the router and use df to make sure the card is there. The card (dev/mmc/disc0/part1) is automaticly mounted to /mmc.

From there nothing works. I cd /mmc and try to mkdir /mmc/opt and then mount /mmc/opt /opt. I don't get any errors when running the above commands, but using df I can't see /opt, and using ls in /mmc I still can't see /mmc/opt.

I also realized that I am unable to create a directory in /jffs, which is also mounted. When I cd /jffs and mkdir /jffs/opt, I don't get an error, but if I try to cd /jffs/opt it acts like it is not there.

Am I missing something obvious? It sure seems like I am.
Johny5
DD-WRT Novice


Joined: 02 Dec 2009
Posts: 23

PostPosted: Sun Mar 07, 2010 21:09    Post subject: Reply with quote
Darkshadow and barryware... help!

I've read the thread "TM -SD mod..Another one - problem" about 4 times now because I seem to be having a lot of the same complications and I have been troubleshooting along the same lines. Which fimware version did you end up using? Right now I'm sticking with std-nokaid (13064) because I've had my SD card up and running on this firmware, loaded optware, and succesfully stored a script to the sd card encorporating msmtp, which is an optware package, so I know it all worked once and it is possible. Since I started over form scratch (differnt wrt54gl) I keep having an input output problem. I had this same problem on my first one and somehow must have gotten past it, but I don't remember how. (the first one is no longer working as pushing the gpio4 button (using 2,0,3,7 gpio for mmc mod) seemed to format the card and I've never been able to get it working again))

When I use vi to create a text file in /mmc it fails and tells me there is an "input/output" error.

Sending the command dmesg|grep mmc I get the following:


Code:
mmc: starting module with: SD_DI=0x4, SD_DO=0x1, SD_CLK=0x8, SD_CS=0x80
 mmca: p1
mmc: error in mmc_read_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 1030
mmc: error in mmc_read_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 1030
mmc: error in mmc_read_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 1030
mmc: error in mmc_read_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 1030
mmc: error in mmc_write_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 2
EXT2-fs error (device mmc(121,1)): ext2_readdir: bad page in #2
mmc: error in mmc_write_block (1)
end_request: I/O error, dev 79:01 (mmc), sector 524


I'm far from being a Linux guru so any advice on this welcome. I'm not necessarily looking for a solution, just a direction to troubleshoot in.

One other thing, I can't mount /mmc/jffs to /jffs or /mmc/opt to /opt becaue the router can't seem to read that they exist, but I can mount /mmc directly to /jffs. df then gives the following output:

Code:
Filesystem           1K-blocks      Used Available Use% Mounted on
/dev/root                 2688      2688         0 100% /
/dev/mtdblock/4         484266      2318    456943   1% /jffs
/dev/mmc/disc0/part1    484266      2318    456943   1% /mmc
/dev/mmc/disc0/part1    484266      2318    456943   1% /jffs


...but of course I still can write to /jffs because I can't write to the card. I know it's not just a read error becasue if I mkdir /mmc/opt on a blank card and then stick it back in my linux machine the foler is not there.

I am at a loss, but I can't help but spend all my free time troubleshooting this. Somebody help so I can return to normal life! Confused
Johny5
DD-WRT Novice


Joined: 02 Dec 2009
Posts: 23

PostPosted: Sun Mar 07, 2010 21:39    Post subject: Reply with quote
One other thing I noticed, the Data In and Data Out pins of the card go to gpio2 and gpio0 respectivly, which both have LEDs attached. Data In is wired to the cathode of the "white cisco LED" and Data Out is wired to the cathode of the wlan LED, so I can see the lights blinking when there is activity on those pins. Data In only flashes twice quickly on start-up, and then never lights again. Data Out flashes a good bit, but sometimes the flashing resembles the activity of the wlan light under normal funtioning. Could the wlan light still be trying to do it's normal function as well as function as Data Out? If so, is there a way to diable it's natural function?

The "amber cisco LED" is always solid, but it's wired to clock, so that makes sense (it's really flashing, but it's doing it so fast it appears solid).

The DMZ LED is wired to card select, which has a little activity at start-up, but then remains off. It seems like when I did this mod before there was more activity on the card select gpio.

Is there anyway that the gpios that are used for the diffent card ports could matter? I wouldn't think so. I've tried different combos. The only one that I seem to have trouble with is gpio4 (which is the "cisco button"). Every time I disable gpio4 (push the button or telenet gpio disable 4) it seems to also disable gpio2 (turns on the white cisco LED), which is what it does if you do not enable "MMC/SC Card Support". Is it possible that the gpios are still trying to do their original function while also acting as ports on the SD card?

I might be way off here. It's just a guess. The hardware tests out, so I know it's not just a bad soldering job.

I'm going to start from scratch again and try some differnt firmwares. Anyone succesfully running an SD card mod, please let me know what firmware version you are running. I only have 4mb of flash, and I've only been able to get this woking with jffs enabled (even if I don't use it) so I need something that leaves room for /jffs on 4mb (std-nokaid 13064 is the one I've had the best luck with)
Johny5
DD-WRT Novice


Joined: 02 Dec 2009
Posts: 23

PostPosted: Mon Mar 08, 2010 4:13    Post subject: Reply with quote
IT WORKS!!! ...for now at least.

Unfortunately I have no clue what I did differently this time that worked. Since my last post I've switched firmwares 6 times, unsoldered the gpio points and switched them around twice, tried 4 different sd cards, and even reconnected the ribon cable to the card-edge-connector that serves as the sd card holder. Nothing worked! Then, randomly, it worked. I ended up back on the v24-sp2 std-nokaid (13064). I was using the following gpio settings: DI:0 DO:4 CLK:3 CS:7 (although I'm pretty sure this doesn't matter since last time I got it to work I was using the following: DI:0 DO:2 CLK:3 CS:7). I inserted the sd card, changed the jffs settings to active and clean, changed the mmc card settings and manually specified the gpio, hit the save key, waited, hit the apply key, waited....and then it worked! I could tell right away because of the LEDs that it was doing something different. I power cycled, telneted in, cd /mmc, and then ls. When it returned "lost+found" instead of nothing I knew it was working because I was able to read from the card. Everything mounted fine and I'm currently installing the optware packages via the directions in "optware - the right way".


Bottom Line... I'm sure that I've followed the same procedure several times identically to this on the same firmware and it didn't work. This time it just happened to work. I think that's the trick. Keep reformatting and starting over until it works. It doesn't fit my view of how logic should work, but I had the same problems on two different routers, and then finally it just worked both times. I was using diferent gpio pins, but the same firmware. I think it's just very touchy.

Anyways, I'm happy now, I can relax. I'd still appreciate comments about anybody else who had a similar problem. I'd like to figure out exactly why it wasn't working when it wasn't and what made it work when it did.
kurochkin
DD-WRT User


Joined: 18 Mar 2010
Posts: 51
Location: Ukraine

PostPosted: Thu Mar 18, 2010 17:06    Post subject: Reply with quote
Well, I experienced the very same problem.
I did a SD/MMC mod on my Linksys WRT150N about a year ago, and it was running smoothly until I decided to upgrade to a newer build a month ago. No changes to hardware, the very same microSD card etc...

After an upgrade to build 13525 - 12/28/2009 STD-Nokaid - I got the same error messages as above. The card info (link serial number, manufacturer name and date, size etc.) on the "Management" tab is complete and accurate, but no data can be written or read.

I checked the wiring, reformatted the card with no result. Then I did a 30-30-30 reset, and tested the other 2 cards I had, following the guide at "Optware, the right way..." After about a dozen failures one of the cards suddenly worked, but it was too small to fit the Optware, so I kept experimenting with the others. BTW, after a reboot this card stopped working too.

Finally, when I was just about to give up, I plugged in a 2 GB SanDisk microSD (via an adapter) from my cell phone. It was formatted in FAT32. After a minute or so the router stopped blinking the LEDs and mounted the card. Obviously it also formatted the card to EXT2. After that everything worked fine with this particular card - I removed it and re-partitioned with GParted live CD into 3 partitions (1 for data, 1 for Optware and another one for swap), it has been running fine for about a week now.

Cards that used to work with previous build (but fail to work with #13525) are:
Toshiba 64 MB SD
NoName (possibly PQI) 512 MB microSD
SanDisk 1 GB microSD

working fine is SanDisk 2 GB microSD

I really wish someone from the more DD-WRT literate folks could comment on this, as it actually goes against any logic.
cyberde
DD-WRT Guru


Joined: 07 Jun 2006
Posts: 1488
Location: the Netherlands

PostPosted: Thu Jul 01, 2010 18:11    Post subject: Reply with quote
Well just upgraded to Release: 06/30/10 (SVN revision: 14684) and my MMC mod stopped working :(

Code:
root@WRTCYBERDE:~# dmesg | grep mmc
[INF] mmc: Version: 2.0.1  Parms: major=0 din=2 dout=4 clk=3 cs=7 maxsec=32 rahead=2
[INF] mmc: SD Card detected & initialized
[INF] mmc: Assigned dynamic major number 254
 mmca: p1
[INF] mmc: Module loaded


but when I navigate to /mmc nothing's there, neither can I create files or folders on it...

Also the status page tells me this:
Space Usage
MMC
2,816.00 KB / 0

but its just a 64MB card :P

Has something changed between this one and 2010-04-23 (SVN revision: 14311)???

Cheers

[edit]
Okay went back to 14311 and just noticed that the new build totally raped my sd-card... All files are lost Sad Thank god I had made a backup.

_________________
Firmware: DD-WRT v24-sp2 (latest available) mega
WRT320N

Donater
Display posts from previous:    Page 1 of 1
Post new topic   Reply to topic    DD-WRT Forum Forum Index -> Hardware DIY / Hardware Mods All times are GMT

Navigation

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You cannot attach files in this forum
You cannot download files in this forum