nuttx/boards/xtensa
Felipe Moura 61c30d881c boards/xtensa/esp32s3/esp32s3-xiao: add SD card support over SPI2
The XIAO ESP32-S3 Sense's onboard microSD slot (Seeed XIAOML Kit) is
wired to SPI2 through the GPIO matrix: SCK=GPIO7, MOSI=GPIO9,
MISO=GPIO8 (confirmed against espressif/arduino-esp32's
XIAO_ESP32S3/pins_arduino.h) and CS=GPIO21 (confirmed against this
project's own working xiaoml_bench_logger.ino, which tries CS
candidates {21, 3} in that order -- GPIO3 is a documented fallback,
not the real pin; a Seeed wiki page that names GPIO3 as CS turned out
to be wrong and was the initial, unsuccessful attempt here).

Wires up board_sdmmc_spi_initialize() (common esp32s3 board code,
CONFIG_MMCSD_SPI) into this board's bringup, and adds the
esp32s3_spi2_status() callback (SPI_STATUS_PRESENT for SPIDEV_MMCSD(0))
that esp32s3-devkit and other in-tree boards already provide -- the
esp32s3-xiao board had no SPI board file at all before this.

Validated on the bench: CMD0/CMD41/CMD58 handshake succeeds, SD ver2
card identified (SanDisk 32GB, 62333952 sectors), mounts as vfat,
survives umount+remount with a written file intact.

Needed board defconfig additions (not included in this NuttX-tree
commit; see the 61680_FW project repo for the board config that turns
this on):
  CONFIG_ESP32S3_SPI2=y
  CONFIG_ESP32S3_SPI2_CSPIN=21
  CONFIG_ESP32S3_SPI2_CLKPIN=7
  CONFIG_ESP32S3_SPI2_MOSIPIN=9
  CONFIG_ESP32S3_SPI2_MISOPIN=8
  CONFIG_MMCSD=y
  CONFIG_NSH_MMCSDSPIPORTNO=2
  CONFIG_FS_FAT=y
  CONFIG_FAT_LFN=y
  CONFIG_FAT_LCNAMES=y

Assisted-by: Claude <noreply@anthropic.com>
Signed-off-by: Felipe Moura <mouraf@fiteclabs.org.br>
2026-08-31 02:32:39 +08:00
..
esp32 xtensa/esp32: Let a protected build boot from simple boot. 2026-08-12 00:37:18 +08:00
esp32s2 !arch/arm: Use r9 as the PIC base register. 2026-08-06 01:38:23 +08:00
esp32s3 boards/xtensa/esp32s3/esp32s3-xiao: add SD card support over SPI2 2026-08-31 02:32:39 +08:00