USB Mass Storage with SD card Example Works in NCS 2.6 but Fails in NCS 2.8/2.9

Description:
I am working with the USB mass storage example provided in github.com/.../mass

The example works as expected when built and flashed using NCS v2.6. However, when I attempt to build and run the same example using NCS v2.8 or v2.9, the functionality no longer works.

the NCS 2.6.0 output 

*** Booting nRF Connect SDK v3.5.99-ncs1 ***
[00:00:00.308,410] <inf> sd: Maximum SD clock is under 25MHz, using clock of 24000000Hz
Mount /SD:: 0
/SD:: bsize = 512 ; frsize = 32768 ; blocks = 973584 ; bfree = 973579
/SD: opendir: 0
  F 0 SOME.DAT
  D 0 SOME
  D 0 SYSTEM~1
End of files
[00:00:00.367,309] <inf> main: The device is put in USB mass storage mode.

the NCS 2.9.0 output

*** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
*** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
[00:00:00.274,047] <inf> sd: Card does not support CMD8, assuming legacy card
[00:00:00.275,543] <err> usb_msc: Storage init ERROR !!!! - Aborting USB init
[00:00:00.295,043] <inf> sd: Card does not support CMD8, assuming legacy card
[00:00:00.296,508] <err> fs: fs mount error (-5)
[00:00:00.296,508] <err> main: Failed to mount filesystem
[00:00:00.296,691] <inf> main: The device is put in USB mass storage mode.

add two files to example for SD Card 

sd.overlay


&spi4 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	cs-gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
        pinctrl-0 = <&spi4_default>;
	pinctrl-1 = <&spi4_sleep>;
	pinctrl-names = "default", "sleep";
	sdhc0: sdhc@0 {
		compatible = "zephyr,sdhc-spi-slot";
		reg = <0>;
		status = "okay";
		sdmmc {
			compatible = "zephyr,sdmmc-disk";
			status = "okay";
		};

		spi-max-frequency = <24000000>;
	};

};

&pinctrl{
    spi4_default: spi4_default {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
				<NRF_PSEL(SPIM_MISO, 0, 10)>,
				<NRF_PSEL(SPIM_MOSI, 0, 9)>;
		};
	};

	spi4_sleep: spi4_sleep {
		group1 {
			psels = <NRF_PSEL(SPIM_SCK, 0, 8)>,
				<NRF_PSEL(SPIM_MISO, 0, 10)>,
				<NRF_PSEL(SPIM_MOSI, 0, 9)>;
			low-power-enable;
		};
	};
};

sd.conf 

CONFIG_SPI=y


CONFIG_MAIN_STACK_SIZE=2048
CONFIG_COMMON_LIBC_MALLOC_ARENA_SIZE=8192

CONFIG_DISK_ACCESS=y
CONFIG_DISK_DRIVERS=y
CONFIG_DISK_DRIVER_SDMMC=y

CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y

CONFIG_APP_MSC_STORAGE_SDCARD=y

Flash the firmware to the nRF device (nRF5340 DK) 

Are there any known changes or breaking updates in NCS 2.8/2.9 that could affect the USB mass storage functionality?

Thank you for your assistance!

Parents Reply
  • Could you zip and upload both versions of your projects, i.e v2.6 and v2.9? P0.10 is cts to the netcore on the nRF5340DK, so there might be a change to how to overwite how to disable this so you can use it for the SD card instead. Alternatively use a different GPIO than P0.10 (for instance P0.12) and verify if you see the same or not (if you see the same we would like the two versions of your firmware anyways).

    Kind regards,
    Andreas

Children
Related