Skip to content

Contributed by 黎明将至!, organized by Ai-Thinker

Ai-WB2-32S SPI Writing to an SD Card ​

Preface ​

This article explains how to use the SPI peripheral to write files to an SD card. Here is the source code link: Baidu Netdisk (extraction code: 1234)https://pan.baidu.com/s/1lCu8Ejf9bgUP782HrzzLTw Extraction code: 1234. Click to view the flashing process. The following mainly introduces the usage process.

1. Preparation ​

  • Six Dupont wires

  • An SD card reader module

  • An Ai-WB2-32S module (note: the module must be of the built-in Flash type)

  • An SD card

  • A Type-C cable

  • A card reader

2. Porting Steps ​

Step 1. Download the code files ​

Step 2. Copy the compressed file to the virtual machine and unzip it ​

Step 3. Copy the spi files to ​

Step 4. Flash the firmware (since the internal files have already been compiled, you only need to flash) ​

You can view the firmware flashing process in step 5 of the link.

3. Testing ​

Step 1. Connect the module to the host ​

Step 2. Open the serial port debugging assistant ​

Step 3. Connect the 32S module and the SD card reader module ​

Wiring correspondence Ai-WB2-32S SD card reader module IO3 CLK IO17 MISO IO4 CS IO12 MOSI GND GND 5V VCC

Step 4. Press the RST key on the Ai-WB2-32S module (reset) ​

Step 5. Check the serial port debugging assistant ​

Step 6. Wait for the write to complete ​

Step 7. Put the SD card into the card reader, connect it to the host, and check the TEST.txt file content ​

Original link: <https://blog.csdn.net/qq_54193285/article/details/135992108?spm=1001.2014.3001.5501>

Released under the MIT License. Build Time 2026-09-30 17:31:25