You are not logged in.

#1 2019-02-14 18:18:48

schard
Forum Moderator
From: Hannover
Registered: 2016-05-06
Posts: 1,985
Website

[workaround] microSD card not working.

I bought a brand new SanDisk Extreme PRO microSDXC™ UHS-I 64GB card.
Unfortunately the device is not recognized on either of my Linux systems:

1) ThinkPad (Arch Linux without adapter)

[   61.606084] mmc0: error -110 whilst initialising SD card
[   63.085689] mmc0: error -110 whilst initialising SD card
[   64.526080] mmc0: error -110 whilst initialising SD card

No block device will show.

2) MSI Notebook (Windows 10 with adapter)
I can partition, format, write to and read from the card.

3) Same MSI Notebook, same adapter, Arch Linux live:

mmc0: error -110 whilst initialising SD card

So the same as on the thinkpad with identical hardware as with windows.

So it's not a hardware issue but must be a driver issue.
I already tried

options sdhci debug_quirks2=0x2

via modprobe.d. Does not change the issue.
Also LTS kernel shows same behaviour.
How can I get the card to work?

Update:
For background: I want to use the card for my Raspberry PI 2.
So I had a hunch and took the *working* SD card from my RasPI 2 (with Arch Linux ARM) and inserted it with another adapter into my several (vanilla) Arch Linux systems (the two notebooks mentioned above and a ZOTAC ZBOX Nano).
Guess what:

[   30.733223] mmc0: error -110 whilst initialising SD card
[   33.498832] mmc0: error -110 whilst initialising SD card
[   36.258734] mmc0: error -110 whilst initialising SD card
[   39.388536] mmc0: error -110 whilst initialising SD card
[   42.141305] mmc0: error -110 whilst initialising SD card

Is there a generic problem with µSD cards on the current Arch kernels or did I fck up all three of my systems? o.O
The latter card *does work* in the RasPi 2.

Update 2
After a few reboots, the old card gets recognized without any errors with either (the new or the old adapter).

[   54.676695] mmc0: new ultra high speed SDR50 SDHC card at address e624
[   54.692373] mmcblk0: mmc0:e624 SL16G 14.8 GiB
[   54.698107]  mmcblk0: p1 p2
[   67.468473] mmc0: card e624 removed
[   76.720827] mmc0: error -110 whilst initialising SD card
[   80.480412] mmc0: error -110 whilst initialising SD card
[   84.240590] mmc0: error -110 whilst initialising SD card
[   89.013932] mmc0: error -110 whilst initialising SD card
[   92.773654] mmc0: error -110 whilst initialising SD card
[   94.082459] mmc0: error -123 whilst initialising SD card
[  111.020313] mmc0: new ultra high speed SDR50 SDHC card at address e624
[  111.021809] mmcblk0: mmc0:e624 SL16G 14.8 GiB (ro)
[  111.028481]  mmcblk0: p1 p2

I'm going to try Fedora live and check whether it recognizes the SD card.
But there sure is something odd going on here.

Update 3
Same issue with Fedora.
I think I'm going to exchange it tomorrow.
I just tested it in my smartphone (HTC U11 Life / AndroidOne 9).
It works there just like on windows. I'll use it there and keep my RasPi as it is for now.

Update 4
For others maybe having this issue I also found this: http://www.linuxforums.org/forum/coffee … cards.html

Update 5:
I wrote a script to test all single debug_quirks{,2} of sdhci:

$ cat ./testmod.sh
#! /usr/bin/env python3

from subprocess import CalledProcessError, check_call


MODULE = 'sdhci'


def lsblk():
    """Sleeps for gracetime and prints lsblk."""

    input('Press enter to lsblk: ')
    check_call(('/usr/bin/lsblk'))


def rmmod():
    """Removes the module."""

    return check_call(('/usr/bin/rmmod', MODULE))


def modprobe(debug_quirks=None, debug_quirks2=None):
    """Loads the module with the respective params."""

    command = ['/usr/bin/modprobe', MODULE]

    if debug_quirks is not None:
        command.append(f'debug_quirks=0x{debug_quirks:x}')

    if debug_quirks2 is not None:
        command.append(f'debug_quirks2=0x{debug_quirks2:x}')

    return check_call(command)


def main():

    for debug_quirks in range(32):
        debug_quirks = (1<<debug_quirks)

        input(f'Press enter to load {MODULE} with debug_quirks=0x{debug_quirks:x}: ')

        try:
            rmmod()
        except CalledProcessError as cpe:
            print(cpe)

        modprobe(debug_quirks=debug_quirks)
        lsblk()

    for debug_quirks2 in range(19):
        debug_quirks2 = (1<<debug_quirks2)

        input(f'Press enter to load {MODULE} with debug_quirks2=0x{debug_quirks2:x}: ')

        try:
            rmmod()
        except CalledProcessError as cpe:
            print(cpe)

        modprobe(debug_quirks2=debug_quirks2)
        lsblk()


if __name__ == '__main__':
    main()

Unfortunately none worked.
Testing all possible combinations would be infeasible.

Final update:
After the allegedly unsuccessful run of my script above, I had a look in dmesg and found this:

[ 2440.294914] sdhci: Secure Digital Host Controller Interface driver
[ 2440.294915] sdhci: Copyright(c) Pierre Ossman
[ 2444.671087] mmc0: new ultra high speed SDR50 SDXC card at address aaaa
[ 2444.690134] mmcblk0: mmc0:aaaa SR64G 59.5 GiB
[ 2444.692332]  mmcblk0: p1
[ 2446.169056] sdhci: Secure Digital Host Controller Interface driver
[ 2446.169059] sdhci: Copyright(c) Pierre Ossman
[ 2446.298105] mmc0: card aaaa removed

So at some point the card obviously got recognized.
From the amount of driver loads and unloads (34) I was able to trace back with which setting it probably worked:

#define SDHCI_QUIRK_BROKEN_CARD_DETECTION		(1<<15)

But I was not able to reproduce this. Also not with the surrounding codes from (1<<12) to (1<<18) or the combination of those.
I'm giving up on this now.

Workaround:
I managed to get the card to work with ArchLinuxARM in my Raspi2.
Since the card got recognized under Windows 10, I installed VirtualBox on Windows and installed a vallia Arch in a VM.
Then I followed this tutorial to pass the SD card to the VM.
There I could format it and playback the image from my RasPI2.
Iniside the RasPI2 the card works just fine.

Last edited by schard (2019-03-19 23:04:02)


macro_rules! yolo { { $($tokens:tt)* } => { unsafe { $($tokens)* } }; }

Offline

Board footer

Powered by FluxBB