sd card error

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

cross mob
RaSh_3782726
Level 3
Level 3
10 replies posted 10 questions asked 5 replies posted

Hi,

I am using psoc 5lp 059 kit, in that i am using spi connection with sd card (micro sd card 16 gb, class 4, san disk)

In that I have error -1,

ex:

        int abx = FS_Mount(sdVolName);

        sprintf(cmdnum,"a : %d ",abx);

        UART_2_PutString("\n\r");

        UART_2_PutString(cmdnum);

        UART_2_PutString("\n\r");

abx = -1, and its error of FS_ERRCODE_EOF (End of file reached)

ref: https://www.segger.com/downloads/emfile/UM02001

how to resolve this?

0 Likes
1 Solution
Len_CONSULTRON
Level 9
Level 9
Beta tester 500 solutions authored 1000 replies posted

RaSh,

You list:

You don't mention what sdVolName is set to.

The FS_Mount(char *VolName) expects to see the VolumeName previously assigned to it.  If it doesn't find it, it will return: -1 which equals "Error, Volume can not be mounted"

If you change the line to:

int abx = FS_Mount(NULL);

It will return the first volume it sees in the SD slot.

Len

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

View solution in original post

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

Perhaps this is due to a known limitation:

The volume of the SD card should not exceed 2Gb.

Test the project with a card no more than 2Gb

Evgeniy

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

RaSh,

You list:

You don't mention what sdVolName is set to.

The FS_Mount(char *VolName) expects to see the VolumeName previously assigned to it.  If it doesn't find it, it will return: -1 which equals "Error, Volume can not be mounted"

If you change the line to:

int abx = FS_Mount(NULL);

It will return the first volume it sees in the SD slot.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
WaMa_286156
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

go to the post: PSOC5 and SDCARD, warning​ for some of the issues I worked through on SD Card.   I eventually gave up on emfile due to how it handles errors.

The Segger Emfile sdcard library has some crashes in it unless you figure out how to patch the exception vectors manually. Your best bet is to purchase the library source code if you need a fully functioning SDCard system handling all errors.

On the other hand, the elm-chan library at http://elm-chan.org is a library that I was able to put into the PSoC5LP very easily, and it handles errors gracefully, within the code space, rather than using CPU exceptions to unknown vectors.