I have tested the sdmmc driver yesterday with both, CS Pin tied directly and via an external i2c port expander. TCA6408A.
Worked like charm, but today I wanted to to some further tests but I can't compile with the port expander pin as CS pin in the device tree. I only commited the devicetree for the direct pin connection but i am sure i did it like that yesterday. Maybe there is some small typo or something, maybe someone can spot the mistake.
DTS
&i2c1 { compatible = "nordic,nrf-twi"; /* Cannot be used together with spi1. */ status = "okay"; sda-pin = <15>; scl-pin = <17>; tca6408a: tca6408a@20 { compatible = "ti,tca6408a"; status = "okay"; reg = <0x20>; label = "GPIO_I2C"; gpio-controller; #gpio-cells = <2>; ngpios = <8>; int-gpios = <&gpio0 6 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>; }; }; &spi0 { compatible = "nordic,nrf-spi"; status = "okay"; sck-pin = <04>; mosi-pin = <41>; miso-pin = <05>; cs-gpios = <&tca6408a 0 GPIO_ACTIVE_LOW>; sdhc0: sdhc@0 { compatible = "zephyr,mmc-spi-slot"; reg = <0>; status = "okay"; label = "SDHC0"; spi-max-frequency = <32000000>; }; };
And the linking error:
FAILED: zephyr/zephyr_prebuilt.elf zephyr/zephyr_prebuilt.map : && ccache /home/rico/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/arm-none-eabi-gcc zephyr/CMakeFiles/zephyr_prebuilt.dir/misc/empty_file.c.obj -o zephyr/zephyr_prebuilt.elf -fuse-ld=bfd -Wl,-T zephyr/linker_zephyr_prebuilt.cmd -Wl,-Map=/home/rico/projects/mst/firmware-ncs/application/build_xxx_nrf52833/zephyr/zephyr_prebuilt.map -Wl,--whole-archive app/libapp.a zephyr/libzephyr.a zephyr/arch/common/libarch__common.a zephyr/arch/arch/arm/core/aarch32/libarch__arm__core__aarch32.a zephyr/arch/arch/arm/core/aarch32/cortex_m/libarch__arm__core__aarch32__cortex_m.a zephyr/arch/arch/arm/core/aarch32/mpu/libarch__arm__core__aarch32__mpu.a zephyr/lib/libc/minimal/liblib__libc__minimal.a zephyr/lib/posix/liblib__posix.a zephyr/soc/arm/common/cortex_m/libsoc__arm__common__cortex_m.a zephyr/soc/arm/nordic_nrf/nrf52/libsoc__arm__nordic_nrf__nrf52.a zephyr/subsys/fs/libsubsys__fs.a zephyr/subsys/random/libsubsys__random.a zephyr/drivers/disk/libdrivers__disk.a zephyr/drivers/clock_control/libdrivers__clock_control.a zephyr/drivers/console/libdrivers__console.a zephyr/drivers/gpio/libdrivers__gpio.a zephyr/drivers/sensor/nrf5/libdrivers__sensor__nrf5.a zephyr/drivers/spi/libdrivers__spi.a zephyr/drivers/entropy/libdrivers__entropy.a zephyr/drivers/timer/libdrivers__timer.a modules/nrf/lib/fatal_error/lib..__nrf__lib__fatal_error.a modules/fatfs/lib..__modules__fs__fatfs.a modules/hal_nordic/nrf_802154/libnrf-802154-platform.a modules/hal_nordic/nrf_802154/nrf_802154/driver/libnrf-802154-driver.a modules/hal_nordic/nrf_802154/nrf_802154/sl/sl_opensource/libnrf-802154-sl.a modules/hal_nordic/nrfx/libmodules__hal_nordic__nrfx.a modules/segger/libmodules__segger.a -Wl,--no-whole-archive zephyr/kernel/libkernel.a zephyr/CMakeFiles/offsets.dir/./arch/arm/core/offsets/offsets.c.obj -L"/home/rico/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/thumb/v7e-m/nofp" -L/home/rico/projects/mst/firmware-ncs/application/build_xxx_nrf52833/zephyr -lgcc zephyr/arch/common/libisr_tables.a modules/hal_nordic/nrf_802154/libnrf-802154-platform.a modules/hal_nordic/nrf_802154/libnrf-802154-platform.a modules/hal_nordic/nrf_802154/nrf_802154/sl/sl_opensource/libnrf-802154-sl.a -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfp16-format=ieee -Wl,--gc-sections -Wl,--build-id=none -Wl,--sort-common=descending -Wl,--sort-section=alignment -Wl,-u,_OffsetAbsSyms -Wl,-u,_ConfigAbsSyms -nostdlib -static -no-pie -Wl,-X -Wl,-N -Wl,--orphan-handling=warn && cd /home/rico/projects/mst/firmware-ncs/application/build_xxx_nrf52833/zephyr && /home/rico/cmake/cmake-3.20.5-linux-x86_64/bin/cmake -E echo /home/rico/gnuarmemb/gcc-arm-none-eabi-9-2019-q4-major/bin/../lib/gcc/arm-none-eabi/9.2.1/../../../../arm-none-eabi/bin/ld.bfd: zephyr/drivers/disk/libdrivers__disk.a(sdmmc_spi.c.obj):(.rodata.sdhc_spi_cfg_0+0x18): undefined reference to `__device_dts_ord_60' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.