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

PSoC™ 5, 3 & 1 Forum Discussions

ThBa_282891
Level 3
Level 3
First like received First like given

Hey there,

   

Im currently trying to use an SD card in one of my projects.

   

PSoC Creator 3.3 CP2, Component emFile 1.20, Lib emFile_V322c.

   

I am using an Lcsoft.net SD Card holder (see the schematic attached) and a PSoC5LP Prototyping Kit. I already measured all the physical connections, tried another SD-Card holder, other boards, other pins, other libraray configuration... no success so far.

   

I used the Demo-Project and as well tried to set up an empty project with the instructions from the emFile datasheet.

   

I have used exactly this SD-Card (32MB SDXC/MMC) some years ago with PSoCs and it worked fine. Also the card is not write protected and works fine under windows.

   

I also Included FS_ConfigIO.c to my project and inserted UART Debug statements there but there is nothing coming out. My code (based on the example)

   
    

FS_Init();

    

/* Get volume name of SD card #0 */
    if(0 != FS_GetVolumeName(0u, &sdVolName[0], 9u))
    {
        /* Getting volume name succeeded so prompt it on the LCD */
        UART_PutString("\r\nSD card name:");
       
        UART_PutString(sdVolName);
    }
    else
    {
        /* Operation Failed - indicate this */
        UART_PutString("\r\nFailed to get SD card name");
       
    }

    

    UART_PutString("SD card format: ");
    
    if(0 == FS_FormatSD(sdVolName))
    {

    

        UART_PutString("Succeeded");
    }
    else
    {

    

        UART_PutString("Failed");
    }
    
    
    /* This will create directory "Dir" on SD card */
    if(0 == FS_MkDir("Dir"))
    {
        /* Display successful directory creation message */
        UART_PutString("\r\n\"Dir\" created");
    }
    else
    {
        /* Display failure message */
        UART_PutString("\r\nFailed to create directory");

    

    }

   
   

I get:

   
    

SD card name:mmc:0:SD card format: Failed

    

Failed to create directory

   
   

Needless to say that also the card is not formatted and no directory created.

   

Its a bare-metal system without OS. I tried emf16nosnlfn emf32nosnlfn and emf16noslfn

   

   

Build Setting:

   

Additional Include dirs:
..\..\..\200_Components\emFile_V322c\Code\Include\PSoC5; ..\..\..\200_Components\emFile_V322c\Code\Include\PSoC5\emf16nOS

   

Additional Libs

   

emf16nosnlfn

   

Additional Lib dir:

   

..\..\..\200_Components\emFile_V322c\LinkLibrary\PSoC5\GCC

   

 

   

Edit:
I attached a logic analyzer to the borad, this doesn't look like proper SPI communication to me (see attach file).

0 Likes
5 Replies
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello,

   

 

   

Can you format the SD Card using SD formatter and try again. Please let us kno wif there is any improvement.

   

 

   

Thanks,

   

Hima

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

I tried both, formatting the Card with the windows tools as well as formatting it with third party tools. However, the card should be formatted by emFile anyway.

   

What is confusing me is the SPI communication, especially the CS does not make any sense.

   

EDIT:
I can exclude hardware problems as this library is working fine:
http://elm-chan.org/fsw/ff/00index_e.html

   

Find a PSoC port here:
https://github.com/hackingchips/PSoC_FatFs

   

​However, I have access times around 100-150ms @ 75MHz CPU and 10MBit SPI. Is emFile faster?

   

EDIT: by modifying the delays I was able to accelerate the FS by ~factor 50! Side effects of this change are not clear but for the subset of functions I need it works fine.

0 Likes
himam_31
Employee
Employee
50 likes received 25 likes received 10 likes received

Hello ,

   

EmFile library performance is given in the "Performance and Resource Usage" in the datasheet. At 48 MHz CPU and 12 MHz SPI data rate, the maximum EmFile throughput is 553.51KBps. Please refer to the datasheet.

   

Thanks,

   

Hima

0 Likes
JiGi_284761
Level 4
Level 4
Welcome!

Cypress now owns Spansion and they have their own filesystem for their memories called SpansionFFS. It works pretty good and is easy to use. It also works on NOR memories. 

0 Likes
Anonymous
Not applicable

hello, if you use CY8CKIT-059, your problem can be because of cmos capacitors. You can change your pins. Also you can check this post. http://www.cypress.com/forum/psoc-5-device-programming/troubleshoot-emfile-example-help

0 Likes