FelipeMdeO opened a new pull request, #20004:
URL: https://github.com/apache/nuttx/pull/20004
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
```
- Real Testing
```
nsh> mount -t vfat /dev/mmcsd0 /mnt
fat_checkbootrecord: WARNING: Signature: aa55 FS sectorsize: 0 HW
sectorsize: 512
nsh> mount
/etc type romfs
/mnt type vfat
/proc type procfs
nsh> echo "hello sd card 61680_FW" > /mnt/test.txt
nsh> ls -l /mnt
/mnt:
drw-rw-rw- 0 RUN00001/
drw-rw-rw- 0 RUN00002/
drw-rw-rw- 0 RUN00003/
-rw-rw-rw- 23 test.txt
drw-rw-rw- 0 System Volume Information/
nsh> cat /mnt/test.txt
hello sd card 61680_FW
nsh> umount /mnt
nsh> mount -t vfat /dev/mmcsd0 /mnt
fat_checkbootrecord: WARNING: Signature: aa55 FS sectorsize: 0 HW
sectorsize: 512
nsh> cat /mnt/test.txt
hello sd card 61680_FW
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]