1. My goal is: Make a file system on a sd card in a reader connected via SPI bus, and then mount, and read files
2. My actions are:
Connected SD card creader via SPI pin out:
CS -> gpio5
SCK -> gpio18
MOSI -> gpio23
MISO -> gpio19
GND -> GND
VCC -> 3.3V
Empty App and added following to mos.yml:
config_schema:
- [“app”, “o”, {title: “My application”}]
- [“spi.enable”, true]
- [“sys.esp32_adc_vref”, 3300] # ADC Vref is 3.3V
- [“spi.mosi_gpio”, 23]
- [“spi.miso_gpio”, 19]
- [“spi.sclk_gpio”, 18]
- [“spi.freq”, 20000000]
- [“spi.cs0_gpio”, 5] # VFS Flash
libs:
- origin: https://github.com/mongoose-os-libs/boards
- origin: https://github.com/mongoose-os-libs/ca-bundle
- origin: https://github.com/mongoose-os-libs/rpc-service-config
- origin: https://github.com/mongoose-os-libs/rpc-service-fs
- origin: https://github.com/mongoose-os-libs/rpc-uart
- origin: https://github.com/mongoose-os-libs/mjs
- origin: https://github.com/mongoose-os-libs/mqtt
- origin: https://github.com/mongoose-os-libs/dash
- origin: https://github.com/mongoose-os-libs/vfs-dev-spi-flash
- origin: https://github.com/mongoose-os-libs/vfs-fs-spiffs
- origin: https://github.com/mongoose-os-libs/vfs-common
build_vars:
MGOS_ENABLE_SPI_GPIO: 1 # for SPI flash
Build, and flash app. Then use RPC to call:
mos call FS.Mkfs ‘{“dev_type”: “spi_flash”, “dev_opts”: “{“freq”: 20000000, “cs”: 0}”, “fs_type”: “SPIFFS”, “fs_opts”: “{“size”: 1000}”}’
3. The result I see is:
On bootup:
mgos_spi_gpioo.c:72 SPI GPIO init ok (MISO:19, MOSI: 23, SCLK:18; CS0/1/2: 5/0/0)
When running the command:
Error: Context deadline exceeded
Then mongoose OS crashes and reboots
4. My expectation & question is: What am I missing to make this work?