Porting FatFs to PSoC 6

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

cross mob
lock attach
Attachments are accessible only for community members.
DaDo_4625751
Level 1
Level 1
First like received

Hello,

I am working on a master thesis project where basically I need to create a stand alone datalogger. While connection to the different sensors is not an issue, I cannot find an "easy" way to save the data somewhere and read it on a PC (best would be to generate a csv file).

I am trying now to save the data on a SD card using SPI communication and FatFs. However, it seems there is no code working "out of the box" and my experience is very limited, so I ask for help to the community.

I have found the following GitHub

GitHub - hackingchips/PSoC_FatFs: Port of ELM-CHAN FatFs library to Cypress PSoc microcontrollers.

I've tried to modify the sdcard.c and main file (my files in attachment) to match PSoC 6 macros, but I always get a "sdcard not ready" error.

I have also tried to use the workaround code given in emFile component for PSoC 6 . I can read the files on the card, but the code does not include any writing capability and implement it myself is out of my league.

Can I get help from somebody? Or perhaps, does anybody already have a working code?

BTW, I am using Clicker 2 for PSoC® 6 with a microSD click.

Thanks a lot

Davide

0 Likes
1 Solution
6 Replies
DaDo_4625751
Level 1
Level 1
First like received

After some debugging, it seems that the first wait_ready function called during initialization (sdcard.c) exits due to timeout (also increasing the limit). I am pretty sure there is something wrong with the porting of some commands, but I am not sure what.

0 Likes
CaKu_4284131
Level 5
Level 5
50 replies posted 25 replies posted 10 likes received

I am working on something similar. In my case I'm on a CY8C6347BZI-BLD53, so I need to use an SPI interface. I decided to use SDFilesystem (SDFileSystem - A re-written SDFileSystem library with improved... | Mbed) as a starting point. (Also, see SDBlockDevice - APIs | Mbed OS 5 Documentation.) I am currently porting it from C++/mbed to C/FreeRTOS+FAT (FreeRTOS+FAT DOS Compatible Embedded FAT File System ).

0 Likes
Rakshith
Moderator
Moderator
Moderator
250 likes received 1000 replies posted 750 replies posted

Hi,

Please refer to this thread - Re: SD Card Library for PSoC 6 using PSoC Creator 4.3

Hope this helps,

Thanks and Regards,

Rakshith M B

Thanks and Regards,
Rakshith M B
0 Likes
joto_4512981
Level 1
Level 1

Hi,

I am getting the same as Davide - "sdcard not ready" error.

I have also used the code linked above from the thread https://community.cypress.com/servlet/JiveServlet/download/228512-53153/SPI_SDcard_FatFS.cydsn.zip and I am getting the same result.

My setup is a PSoC 6 pioneer board and I broke off the microSD Card from the PSoC 6 Wi-Fi BT Prototyping Kit (CY8CPROTO-062-4343W). I have tried multiple SD Cards and cannot get any response from the MISO/DAT0 line. The signal seems to remain high regardless of the CMD I send. Also, the SPI slave select was changed from pin 9.3 to 9.4 for the pioneer board.

Regards,

Jordan

0 Likes

Hi all,

We have a new code example that uses FatFS on MicroSD card. Here is the link:

GitHub - cypresssemiconductorco/mtb-example-psoc6-usb-msc-file-system: This example demonstrates how...

0 Likes