NRF52840 fs_sample SD fs_close error on NCS 2.7.0

I am getting an fs_close() -5 error (-EIO) when I write to an SD card using fatfs. I determined this error was associated with FR_DISK_ERR in fat_fs.c.

Additional info

  • I'm using a custom board.
  • I didn't have these problems with NCS 2.5.0
  • The contents are actually being written to the card.
  • The file closes successfully If I open the file but don't write to it.

DTS

/**
 * The NRF52 documentation states that SPIM0-2 are limited to 8Mbps
 * datarates. SPIM3 is used because its capable of a max throughput
 * of 32 Mbps (32 MHZ).
 */
&spi3 {
	compatible = "nordic,nrf-spim";
	status = "okay";
	pinctrl-0 = <&spi3_default>;
	pinctrl-1 = <&spi3_sleep>;
	pinctrl-names = "default", "sleep";
	cs-gpios = <&gpio1 0 GPIO_ACTIVE_LOW>;
	sdhc0: sdhc@0 {
		compatible = "zephyr,sdhc-spi-slot";
		reg = <0>;
		status = "okay";
		mmc {
			compatible = "zephyr,sdmmc-disk";
			status = "okay";
		};
		spi-max-frequency = <32000000>;
		pwr-gpios = <&gpio0 25 GPIO_ACTIVE_LOW>;
	};
};

prj.conf

CONFIG_DISK_ACCESS=y
CONFIG_LOG=y
CONFIG_FILE_SYSTEM=y
CONFIG_FAT_FILESYSTEM_ELM=y
CONFIG_PRINTK=y
CONFIG_MAIN_STACK_SIZE=2048

CONFIG_SPI=y
CONFIG_DISK_DRIVER_SDMMC=y


Related