This project is designed as an example of a STM32CubeIDE-generated system with FreeRTOS multitask feautures and FatFs File System for controlling an SPI-connected MMC/SD memory card .
For more information you can take a look here
- MultiTask
- Mutexes & Thread Safety
- CMSIS-RTOS API Version 1
- FatFs Application Interface
- Memory state
- Manipulation of folders/files
- Error Messages
I was created 3 task with different priority and sizes with safe access via mutex to SD card.
- Blink: Simple Task for Blinking LED
- SDinfo: Give infomation about SD Card and files
- Usage Memory, Free Space, List of Files/Folders with details (Date, Type, Path, Name)
- SDManager: Create, Read, Write, Find Folders/Files
This example was built based on Tutorial created by @kiwih For more information Tutorial: An SD card over SPI.
Original code FatFs without FreeRTOS : Cubeide-sd-card
This example was created using Stm32f072 discovery kit + Waveshare SD card module In addition, I used Converter USB-UART with PL2303HX to read UART messages
Since the SPI2 is connected to ST MEMS motion senso ( One of the properties 32F072BDISCOVERY) So I used SPI1 and defined SD_SPI_HANDLE to SPI1
#define SD_SPI_HANDLE hspi1
Finally, In table form the connections are as follows:
SD Adapter side | Stm32f072 side |
---|---|
MISO | PB4 |
MOSI | PB5 |
SCLK | PA5 |
CS | PB3 |
3V | 3.3V |
GND | GND |
Creative Commons Zero v1.0 Universal