USB MSC example with SD Card fails during initialization

Hello, and thanks for reading.

I am trying to get your example for USB mass storage class working with my NRF52840 dongle and an SD card. I have wired the SD card to the dongle and want to use SPI to communicate with it, with the goal of having it show up to my computer as a 32Gb usb drive. This will then be part of a larger project.

I get the following error message when I try to run the example:

[00:00:00.425,964] <err> sd: Failed to query card OCR
[00:00:00.425,964] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init

This is especially odd, because a few moments later I get:

[00:00:03.475,097] <inf> main: Block count 62357504
Sector size 512
Memory Size(MB) 30448
Disk mounted.

Listing dir /SD: ...
[DIR ] SYSTEM~1

This information is correct, so clearly I have the correct settings and overlay for the SD card and it is mounting correctly.

I have zipped and attached the entire project, and would be much obliged if you could take a look and try to see why its not working. To the best of my knowledge it's your example as it should be, with the only additions being related to routing the debug to usb.

Thank you!

MSC_Testing.zip

Parents
  • Hello and thanks for answering.

    Firstly, please accept my apologies, I accidentally uploaded the wrong zip file. Please find attached the correct file.

    3426.MSC_Testing.zip

    I have indeed made the changes for the pins for SPI directly; Please see the image below from the Devicetree GUI tool:

    EDIT: As an experiment, I tried commenting out

    //  / {
    //      msc_disk0 {
    //          status="okay";
    //          compatible = "zephyr,flash-disk";
    //          partition = <&storage_partition>;
    //          disk-name = "SD";
    //          /* cache-size == page erase size */
    //          cache-size = <4096>;
    //      };
    //  };

    And got a slightly different error message:

    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.634,338] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
    [00:00:03.482,604] <inf> sd: Maximum SD clock is under 25MHz, using clock of 400000Hz
    Mount /SD:: 0
    /SD:: bsize = 512 ; frsize = 32768 ; blocks = 973952 ; bfree = 973948
    /SD: opendir: 0
      D 0 SYSTEM~1
    End of files
    [00:00:13.608,551] <err> main: Failed to enable USB -120

Reply
  • Hello and thanks for answering.

    Firstly, please accept my apologies, I accidentally uploaded the wrong zip file. Please find attached the correct file.

    3426.MSC_Testing.zip

    I have indeed made the changes for the pins for SPI directly; Please see the image below from the Devicetree GUI tool:

    EDIT: As an experiment, I tried commenting out

    //  / {
    //      msc_disk0 {
    //          status="okay";
    //          compatible = "zephyr,flash-disk";
    //          partition = <&storage_partition>;
    //          disk-name = "SD";
    //          /* cache-size == page erase size */
    //          cache-size = <4096>;
    //      };
    //  };

    And got a slightly different error message:

    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.634,338] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
    [00:00:03.482,604] <inf> sd: Maximum SD clock is under 25MHz, using clock of 400000Hz
    Mount /SD:: 0
    /SD:: bsize = 512 ; frsize = 32768 ; blocks = 973952 ; bfree = 973948
    /SD: opendir: 0
      D 0 SYSTEM~1
    End of files
    [00:00:13.608,551] <err> main: Failed to enable USB -120

Children
No Data
Related