SD card FAT32 example?

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
GuGa_1322886
Level 4
Level 4
5 solutions authored 25 sign-ins First comment on KBA

Is there an example of SD card read / write using FAT32 somewhere?

0 Likes
1 Solution

Actually, after getting more familiarized with Mbed OS, it does support an SD interface with FAT file system, but, here is the catch: the current implementation only supports single line (MOSI/MISO) SPI interface to the SD card. In order to use the SDHC interface of PSoC 6 there are two possible routes:

a. Modify the SDBlockDevice class to use the HAL Interface to the SDHC instead of SPI, or...

b. Thanks to the layered design of Mbed OS, create a new BlockDevice derived class for SDHC using Cypress HAL library.

Any file system in Mbed OS can then use this peripheral interface class.

Option b. seems to be more logical approach and the route of less effort, I think. Working on it now...

View solution in original post

0 Likes
6 Replies

Thanks Rodolfo, however that is not what I´m looking for. I want to implement an SD card file Read/Write using the CY8CPROTO-062-4343W prototyping kit. I will use the the FAT32 file system available in Mbed OS so the file can be later read in a PC or Mac system.

I guess I will have to start from scratch.

0 Likes

If you are using mbed, you can refer to this one:

https://github.com/ARMmbed/mbed-os-example-filesystem

Both examples use a file system:

mbed: LittleFsSystem

ModusToolbox: FatFS

I'm not sure about the mbed, but the ModusToolbox one uses FAT32.

0 Likes

Adding to Rudolfo's comment, you can modify the filesystem used in the GitHub - ARMmbed/mbed-os-example-filesystem: The Mbed OS file system example from LittleFS to FatFS. Refer to the section "Changing the File System" in the Readme.md file in the repository for more information on how to do this.

Regards,
Dheeraj

0 Likes

Actually, after getting more familiarized with Mbed OS, it does support an SD interface with FAT file system, but, here is the catch: the current implementation only supports single line (MOSI/MISO) SPI interface to the SD card. In order to use the SDHC interface of PSoC 6 there are two possible routes:

a. Modify the SDBlockDevice class to use the HAL Interface to the SDHC instead of SPI, or...

b. Thanks to the layered design of Mbed OS, create a new BlockDevice derived class for SDHC using Cypress HAL library.

Any file system in Mbed OS can then use this peripheral interface class.

Option b. seems to be more logical approach and the route of less effort, I think. Working on it now...

0 Likes

Glad to hear that you are able to move forward. Please do create a new thread if you face any issues during the implementation. Marking this one as resolved as it answers the original question of how to begin with SD card implementation in Mbed.

Regards,

Dheeraj

0 Likes