Skip to content
This repository was archived by the owner on Sep 15, 2025. It is now read-only.
This repository was archived by the owner on Sep 15, 2025. It is now read-only.

How to use the SD card reader to read/write files #25

@jfm92

Description

@jfm92

This guide is focus in the Olimex-Stm32-e407 board, which have SD card reader interfaced throw SDIO.
First, use the next config profile:
olimex-stm32-e407/sd
This profile have the proper configuration to use the SD card reader.

Important to know:

Make the SD card reader could produce a lower startup of the system. I'm still investigating the reasons of that. But I think that the possible reason of this, is because it take some time to read the entire structure.
Another thing, is that this board doesn't have SD card insertion pin detector, so you must introduce it before the startup of the system.

Once the console is ready, check if the driver as initialize correctly, typing:
ls/dev
And you should see like: mmcsd0
Then you must type:
mount -t vfat /dev/mmcsd0 /mnt
To mount the fat file system.

You can use the SD card in the console and with an App.

Console:

If you want to read a file:
cat /mnt0/name_of_your_file

If you want to write in already create file or create a new one and write inside:
echo "Content of the file" > /mnt0/name_of_your_file

App:

You must make available the fat file system before of use the files, so you can do the previous command in the console or use this to type from the App:
system("mount -t vfat /dev/mmcsd0 /mnt");

Then the treatment of the files is exactly the same as in linux, that you work with: fopen, fread and fwrite.
In the newest version of the telemetry app, you can see an example of how it works.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions