This application provides an example of FileX stack usage on STM32L4R9I-Discovery board, running in standalone mode (without ThreadX). It demonstrates how to create a Fat File system on the SD card memory using FileX API.
The application is designed to execute file operations on the SD card, it provides all required software code for properly managing it.
The application's main calls the MX_FileX_Init() function in order to Initialize FileX, format the SD memory as FAT and open the sdio_disk driver. The resulting file system is a FAT32 compatible, with 512 bytes per sector.
Upon successful opening of the created SDIO-Disk media, FileX continues with creating a file called "STM32.TXT" into the root directory by calling MX_FileX_Process(void) function, then writes into it some predefined data. The file is re-opened in read only mode and content is checked.
As stated earlier, the present application runs in standalone mode without ThreadX, for this reason, the standalone variant of fileX is used, plus the following flags need to be set in fx_user.h:
- #define FX_SINGLE_THREAD
- #define FX_STANDALONE_ENABLE
- A file named STM32.TXT should be visible in the root directory of the SD card.
- A blinking green LED light marks the success of the file operations.
- On failure, the orange LED should start blinking.
- Error handler is called at the spot where the error occurred.
None.
No SD card insertion/removal mechanisms are implemented.
- Before starting the application, the SD card should be present in the SD card connector and formatted initially by user.
FileX, File system, SDMMC, FAT32
- This application runs on STM32L4R9xx devices.
- This application has been tested with STMicroelectronics STM32L4R9I-Discovery boards Revision: MB1311 C-01. and can be easily tailored to any other supported device and development board.
In order to make the program work, you must do the following :
- Open your preferred toolchain
- Rebuild all files and load your image into target memory
- Run the application