Xiao BLE Sense Zephyr SD Access Through Expansion Board

Hello All,

I have been trying to get the Xiao BLE Sense with the nrf52840 chip in conjunction with the expansion board to access the SD card using the FatFS example from zephyr. All my processes and files where I got my information will be linked at bottom with references during explanation.

1. I know that the Xiao BLE Sense (1) does not have inherent capabilities with SD card access, to do this I am using the xiao expansion board (2) this uses a micro SD card so I do not know if that interferes with capabilities

2. I downloaded the FatFS sample from the zephyr GitHub after following the setup guide for zephyr on my machine (3)

3. Within the example and on the read me there is no inherent support for the Xiao BLE Sense or the expansion board from what I saw, so I made the decision that an overlay is in order. Below is the overlay I made and some explanations for decisions I made and things I have tested

&spi2 {
    status = "okay";
    cs-gpios = <&gpio0 0x1c GPIO_ACTIVE_LOW>;
    pinctrl-0=<&spi2_default>;
    pinctrl-1=<&spi2_sleep>;
    pinctrl-names="default", "sleep";
    sdhc0: sdhc@0 {
            compatible = "zephyr,sdhc-spi-slot";
            reg = <0>;
            status = "okay";
            mmc {
                compatible = "zephyr,sdmmc-disk";
                status = "okay";
            };
            spi-max-frequency = <24000000>;
    };
};

Within this code there are things to point out that I have tested and have found no luck with. After reviewing the schematics of both the Xiao BLE Sense and the expansion board, I found that the mosi miso and sck pins are 15,14,13 respectively, so I felt the need to not change them as those are the pin descriptions from the actual chip (4), which match up to the pin ctrl for the Xiao BLE sense. Within this document as well I see that there is a pin called P0.28_AIN4_LOW_A2_D2 which has the description of d2 at the end. Logically I went to the expansion board schematic (5) (within this schematic it also states the PIN numbers 8.9.10 as mosi miso and sck pins and tried those as well and nothing landed) and found that this had the same ending as the start of the D2_SD_CS which I assume is the chip select pin for the SD card through the expansion board with the corresponding PIN number of 28. which is identified as p0.28 or 0x1c.

here is the prj.conf file as well.

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

I have not been able to get this working and the errors I get are the SD card storage init error and failure to mount the file system.

if anyone has any insight as to what the error I have made may be I would greatly appreciate it.

Thanks.

References:

1. https://wiki.seeedstudio.com/XIAO_BLE

2. https://wiki.seeedstudio.com/Seeeduino-XIAO-Expansion-Board/

3. https://github.com/zephyrproject-rtos/zephyr/tree/main/samples/subsys/fs/fat_fs

4. https://files.seeedstudio.com/wiki/XIAO-BLE/Seeed-Studio-XIAO-nRF52840-Sense-v1.1.pdf

5. https://files.seeedstudio.com/wiki/Seeeduino-XIAO-Expansion-Board/document/Seeeduino%20XIAO%20Expansion%20board_v1.0_SCH_200824.pdf

Parents Reply Children
Related