FATFS file system not working

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

cross mob
AbPa_4654881
Level 3
Level 3
10 replies posted 10 questions asked 10 likes given

Hi All,

I am Using cy8ckit-059 kit. I want to read/write data from a file present in the SD card. for that I am using FATfs file system.

I am trying one example from here 

https://github.com/hackingchips/PSoC_FatFs/tree/master/Examples/PSoC5LP_FatFs

But I am getting this error

error: (FR_NOT_READY) sdcard not ready.

has anyone used FATfs library for ( micro SD card ~8gb) ? or is there any working example available with Fatfs file system 

Please suggest me to resolve this error.

Thanks

 

 

0 Likes
1 Solution
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Abhi-san,

I tried with a 8GB micro-sd card and got

==================

PSoC FatFs. PSoC 5LP FatFs Test/Demo.
Hacking Chips. 12/2015.

(A) - Show 'root' directory listing.
(B) - Create directories, create files.
(?) - Show menu.
Select test :>a
error: (FR_NOT_READY) sdcard not ready.

==================

Then I tried with a 4GB micro-sd card and got

==================

Select test :>A
Volume label: USB4G

SPOTLI~1 <DIR>
FSEVEN~1 <DIR>
TEMPOR~1 <DIR>
HELLO.C 87
_HELL~1.C 4096

Total sectors: 7764032
Free sectors: 7758592
Drive space: 3882016
Free space: 3879296

==================

So, I would think that the program (or hardware?) is not supporting a 8GB micro-sd card.

Please try with one which is 4GB or smaller.

Best Regards,

9-Jan-2021

Motoo Tanaka

View solution in original post

0 Likes
7 Replies
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

AbPa,

 

I have not had any luck with downloading the PSoC5LP_FatFS.   However it appears not to use the PSoC-supplied emFile system.   Is there a reason you cannot use the emFile system?

 

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes

Hi Len,

Actually every thing is in the backend of EMfile  component. I need to use independent SPI master module for emfile in  TopDesign.cysch that I can't edit the emfile component. don't have any idea to edit the internal emfile thing .

The reason is that I am having multiple thing that need to be use as SPI and I have only 4 pin assigned for all the SPI Things(including SD card) .

the Plan is to use the multiplexer to control all the SPI comunication according to whenever which SPI operation is required.

But when we use emfile, it assign 4 pin like this

\emfile_1:miso0\    \emfile_1:mosi0\      \emfile_1:sclk0\    \emfile_1:SPI0_CS\   

but for the other SPI operations I have SPI master component form PSOC component library  where I need to connect GPIO's to the miso, mosi, sclk and ss. 

So The Emfile assigned GPIO " \emfile_1:miso0\    \emfile_1:mosi0\      \emfile_1:sclk0\    \emfile_1:SPI0_CS\  " I am not able to use for other SPI master components.

That's the problem I am facing right now. for that reason I plan to use FatfS file system Example 

Please suggest any thing I can do here.

Thanks

Abhi

 

0 Likes

AbPa,

As I recommended on another thread you posted: You should devote the SPI for emFile solely to emFile.   The emFile system library assumes FULL CONTROL of the SPI.   It caches file and directory info.   It uses it's own algorithms to determine when to flush the caches.   From what I can tell, there is no way to tell exactly when that will be.

The PSoC5 has multiple SPI resources.   I don't see the advantage of using just one SPI Master for all your SPI slaves.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
lock attach
Attachments are accessible only for community members.
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Hi,

I have just downloaded the project from

https://github.com/hackingchips/PSoC_FatFs

and built the project PSoC5LP_FatFs.

Note: I used a 4GB SDC.

And my TeraTerm log is

===========================

PSoC FatFs. PSoC 5LP FatFs Test/Demo.
Hacking Chips. 12/2015.

(A) - Show 'root' directory listing.
(B) - Create directories, create files.
(?) - Show menu.
Select test :>a
Volume label: USB4G

SPOTLI~1 <DIR>
FSEVEN~1 <DIR>
TEMPOR~1 <DIR>
HELLO.C 87
_HELL~1.C 4096

Total sectors: 7764032
Free sectors: 7758592
Drive space: 3882016
Free space: 3879296


Select test 😆

===========================

So it seems to be working.

I wonder if your SD card I/F is receiving 5V and all the pin connections are ok?

I needed to connect 5V, GND, SCLK, MISO, MOSI, and nCS.

Note: When I missed to provide 5V, I received similar error  (SD-CARD is not Ready or something like that)

Have you inserted a SD-Card which is already formatted as FatFs?

Attached is the archive of the project I used.

moto

 

0 Likes

Hi Moto,

I have checked, But it is still showing me the same Error with attached project also.

I'm using SD card module as shown in attached image with 8GB micro Sd card and the vcc on the SD card module I am connecting to VDD of cy8ckit-059 kit (5v). 

I have inserted the SD card that is Formatted as FAT32 only.

I am not getting where I am doing wrong here.

Thanks

Abhi

 

Untitled.pngIMG_20210109_012351.jpg

 

 

 

 

 

 

0 Likes
MotooTanaka
Level 9
Level 9
Distributor - Marubun (Japan)
First comment on blog Beta tester First comment on KBA

Dear Abhi-san,

I tried with a 8GB micro-sd card and got

==================

PSoC FatFs. PSoC 5LP FatFs Test/Demo.
Hacking Chips. 12/2015.

(A) - Show 'root' directory listing.
(B) - Create directories, create files.
(?) - Show menu.
Select test :>a
error: (FR_NOT_READY) sdcard not ready.

==================

Then I tried with a 4GB micro-sd card and got

==================

Select test :>A
Volume label: USB4G

SPOTLI~1 <DIR>
FSEVEN~1 <DIR>
TEMPOR~1 <DIR>
HELLO.C 87
_HELL~1.C 4096

Total sectors: 7764032
Free sectors: 7758592
Drive space: 3882016
Free space: 3879296

==================

So, I would think that the program (or hardware?) is not supporting a 8GB micro-sd card.

Please try with one which is 4GB or smaller.

Best Regards,

9-Jan-2021

Motoo Tanaka

0 Likes
WaMa_286156
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

I did this a while ago.  This points you to an open source version of FatFS.  (Probably limited to 4 gig or so)

https://community.cypress.com/t5/PSoC-5-3-1-MCU/PSOC5-and-SDCARD-warning/m-p/87769

0 Likes