# Any tools for diagnosing SD card problems?

## VinzC

Hi all.

I'm using an 4GB SD card that I bought for my camera, which didn't recognize the card. My laptop has an SD card reader (a Ricoh device) and each time I plug my card into my laptop I get numerous error messages like this:

```
[126664.679024] end_request: I/O error, dev mmcblk0, sector 7

[126664.681064] mmc0: Got data interrupt 0x00600000 even though no data operation was in progress.

[126664.681066] sdhci: =========== REGISTER DUMP (mmc0)===========

[126664.681069] sdhci: Sys addr: 0xb8951000 | Version:  0x00000400

[126664.681072] sdhci: Blk size: 0x00007200 | Blk cnt:  0x00000000

[126664.681075] sdhci: Argument: 0x00000000 | Trn mode: 0x00000033

[126664.681078] sdhci: Present:  0x010f0000 | Host ctl: 0x00000007

[126664.681081] sdhci: Power:    0x0000000f | Blk gap:  0x00000000

[126664.681084] sdhci: Wake-up:  0x00000000 | Clock:    0x00000007

[126664.681088] sdhci: Timeout:  0x00000009 | Int stat: 0x00000000

[126664.681091] sdhci: Int enab: 0x02ff00cb | Sig enab: 0x02ff00cb

[126664.681094] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000

[126664.681097] sdhci: Caps:     0x01e021a1 | Max curr: 0x00000040

[126664.681098] sdhci: ===========================================

...

[126664.683196] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x400b00

[126664.683198] end_request: I/O error, dev mmcblk0, sector 0

[126664.685252] mmcblk0: error -110 sending read/write command, response 0x0, card status 0x400b00

[126664.685254] end_request: I/O error, dev mmcblk0, sector 1

[126664.687287] mmc0: Got data interrupt 0x00600000 even though no data operation was in progress.

[126664.687288] sdhci: =========== REGISTER DUMP (mmc0)===========

[126664.687291] sdhci: Sys addr: 0xb8950200 | Version:  0x00000400

[126664.687295] sdhci: Blk size: 0x00007200 | Blk cnt:  0x00000001

[126664.687298] sdhci: Argument: 0x00000002 | Trn mode: 0x00000013

[126664.687301] sdhci: Present:  0x010f0000 | Host ctl: 0x00000007

[126664.687305] sdhci: Power:    0x0000000f | Blk gap:  0x00000000

[126664.687309] sdhci: Wake-up:  0x00000000 | Clock:    0x00000007

[126664.687312] sdhci: Timeout:  0x00000009 | Int stat: 0x00000000

[126664.687315] sdhci: Int enab: 0x02ff00cb | Sig enab: 0x02ff00cb

[126664.687318] sdhci: AC12 err: 0x00000000 | Slot int: 0x00000000

[126664.687322] sdhci: Caps:     0x01e021a1 | Max curr: 0x00000040

[126664.687323] sdhci: ===========================================

...
```

I unlpugged the card and plug it back in, there is no more error message and its partitions were mounted properly. I unmounted its filesystems, unplugged the card and plugged it back in and now I get this message:

```
[127260.855656] mmc0: error -110 whilst initialising SD card
```

plus the fact that the card doesn't get mounted anymore... I already had that message and it looked like I could use the card after I rebooted my laptop.

EDIT: Oops... I spoke too early! I made yet another attempt and now I can use it again. It doesn't produce any error message... Weird... Could it be because I'm putting my laptop in suspend mode instead of powering it off?

As I don't know what to suspect (I'm using kernel 2.6.37-gentoo-r6), are there any tools for checking SD cards and if it's in good state?

----------

## NeddySeagoon

VinzC,

The device names for SD cards change at suspend, so you should unmount it first.

There is a kernel option to disable this device renaming, from my kernek

```
# CONFIG_MMC_UNSAFE_RESUME is not set
```

The name speaks for itself.

----------

## VinzC

Thanks NeddySeagoon. That option is not set in my kernel configuration. BTW I also unmount my external devices before I set my laptop to suspend mode.

I also found out that unloading all sdhci and mmc modules and running udevadm trigger after resuming seems to avoid those error messages. But I guess it's only a workaround...

----------

