Elm-Chan FatFs

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

cross mob
FrGr_1435126
Level 1
Level 1

Hi all,

   

Just wondering if anyone has had any success porting Elm-chan's FatFS SD card file system library (http://elm-chan.org/fsw/ff/00index_e.html) to a PSoC 4. This is my first attempt at porting low level code like this and I'm a little lost, I'd love it if anyone could share any example source code they may have for my reference.

   

Thanks.

0 Likes
15 Replies
EvPa_264126
Level 7
Level 7
500 replies posted 250 replies posted 100 likes received

Perhaps it will help to start...
http://blog.livedoor.jp/sibu1/archives/767512.html

0 Likes

Is there an English version?

   

Also, I couldn't be sure but it looks like there isn't a code example for the PSoC port of FatFs itself.

0 Likes
Anonymous
Not applicable

You can look here:

   

https://github.com/hackingchips/PSoCFatFs

   

I have started porting the library two days ago. It needs more changes and testing but i think porting will be a bit slow. It´s dificult for me to stay too much time in front of my computer with a broken ankle.

0 Likes
ThBa_282891
Level 3
Level 3
First like received First like given

thanks for the port!

0 Likes
SaRa_1313076
Level 1
Level 1

Could someone kindly confirm whether jesusrcc's porting (https://github.com/hackingchips/PSoCFatFs) works for microSD cards >4gb in size?

0 Likes
Anonymous
Not applicable

I have tested the demos in github with a Sandisk Ultra microSDHC I  16Gb card and with a Qilive microSCHC I 32Gb, and the PSoC4 dev kit, and they work, but there is an issue with f_getfree() function (look issues at github).

   

Actually i am using the 16Gb card on a personal project without problems apart of f_getfree issue.

0 Likes

jesusrcc, thank you for the response and for the porting work! 

   

I tried your application (PSoC 5LP version) on the PSoC 5LP prototyping kit with a Sandisk (normal) microSDHC 4Gb card (formatted to both FAT32 and exFAT), but I constantly keep getting the FR_NOT_READY error. I tried to figure out the root of the problem and it seems to be that the STA_NOINIT (drive not initialised) flag is thrown up.

   

I tried a few things:

   

(1) played the following constants, plugging in different values:

   

CS_DELAY_US         
M_DELAY_US          

   

(2)  played with the bit rate setting of the SPI master component

   

(3) connected SPI master component to an external clock (instead of an internal clock) and ran it off clock speeds from 4 MHz - 20 MHz 

   

None of these worked.

   

What I am wondering is whether I am missing on something that I am supposed to do? For example, in the function you call:

   

resultF = f_mount(&fatFs, "", 1);

   

am I supposed to replace the "" (second parameter) with something (a logical drive number to be mounted/unmounted -- I don't know where I can find this though :/)

   

I am a newbie to working with SD cards so your help would be greatly appreciated! I will try to do some further debugging if you need more information. 

0 Likes
Anonymous
Not applicable

How are you connecting the sd card to the prototyping kit? Directly? Any commercial sdcard prototyping kit or shield?

   

What it the 5LP prototyping kit you are using?

0 Likes

I am using the CY8CKIT-059  prototpying kit .I am interfacing the microSD card via a 5V breakout board - the board uses a simple voltage divider circuit to reduce voltage from 5V to 3.3V, however I just noticed that the MISO pin is 3.3V output connected directly to the PSoC. I will purchase a new breakout board with integrated logic converter chip and see what happens from there!

   

I will get back to you if I have any problems. Thanks!

0 Likes
Anonymous
Not applicable

A few days ago, i helped a person with a similar problem and it was the MISO signal and a PSOC working at 5V.
 Maximun voltage in MISO for high level voltage is 3.3V while (from datasheet) the minimun voltage at a gpio pin of PSOC working at 5V is 0.7*VDDIO = 3.5

0 Likes

Yes that makes sense. Thank you!

   

Also, seeing that you got fatFs working on the CY8CKIT-042 kit, have you tested the library on the PSoC 4 BLE kit (CY8CKIT-042-BLE)? If not, are you aware of its compatibiliy?

   

And as a general question, would you recommend implementing the fatFs file system with a Cortex M0 mcu (CY8CKIT-042 or CY8CKIT-042-BLE?) . Most forums tend to suggest that an M0 is not really capable of implementing a file system? Or does the capability vary from mcu to mcu, depending on the amount of RAM avaiable?

0 Likes
Anonymous
Not applicable

I think it have to work with BLE modules too but i have not tested it. I don't have any BLE modules.

   

I friend of me will use it in a BLE module but until now, i don't have news from him.

   

I am not very experienced with the library. I have ported it and i am using it in two personal projects without problems. I have seen the same library working in a lot of other platforms, from tiny 8 bit microcontrollers to embedded systems. I can not figure out why a M0 core will no be able to manage the file system. I supose it depends on what we expect from it.

0 Likes
lock attach
Attachments are accessible only for community members.

Hello,

I am quite new to the PSoC community and I am trying to port your project to PSoC 6. I have modified the sdcard.c file as in attachment to use PSoC 6 macros, but I get a "sdcard not ready" error. Any idea what I am doing wrong? In attachment also my main file (still under clean up).

Thanks

Davide

0 Likes

I also try to port the Project to PSoC6. But i get everytime the error: (FR_DISK_ERR) low level error.

Whats the reason for this? I think it's very poor from Cypres not to offer a working filesystem for PSoC6 and PSoC Creator.

0 Likes

Hi all,

We have a new code example that uses FatFS wtih microSD. Here is the link:

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

0 Likes