Robots are revolutionizing our lives in many ways. Join our webinar to learn about Infineon’s broad portfolio of robot building blocks.
Click here to register.

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

PSoC™ 5, 3 & 1 Forum Discussions

Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

If you are interested in the PSOC 5 with an SDCard, be sure to look at the following web site; FatFs - Generic FAT Filesystem Module

  We used the Cypress licensed Segger sdcard library on a psoc.  it worked.  We went to another psoc, and it failed.

  After about a week worth of tearing hair out, I finally determined the problem (at least for us).

  Bottom line:  Stay away from Port 3 if you are using SDCards in SPI mode.  It will make your life *much* simpler.

If you *must* use Port 3 (which was our predicament), I found a pin arrangement that worked for us.  Your mileage may vary.

Basically, MOSI and MISO cannot be contiguous pins on the port.  You also can't have the clock next to both the MISO and MOSI pins. (Tested on CY8CKit-059, and a CY8C5868AXI-LP035 TQFT package.  This appears to be endemic to the die, not the package.)

Here is a configuration that I finally got to work:

  Pin 3[0] -- SCLK

  Pin 3[1]  -- MISO

  Pin 3[2[  -- CS (Slave Select)

  Pin 3[3]  -- MOSI.

If you put in any other order, the SDCard does not want to enter into SPI mode, and everything fails beautifully.

There appears to be leakage between the adjacent pins, (speculation: due to the analog components sitting on the pins) causing the SDCard, which is very particular about startup voltages, to fail to enter SPI mode.

1 Reply
Level 5
Level 5
First comment on blog 100 replies posted 50 replies posted

One more update:

The Segger library is closed source, licensed to Cypress without source code.  Cypress allows us to use it for free with the emFile component.

It is not ideal for using with the PSoC 5, because you don't have access to the source code.  The library does an unhandled exception if a card is removed or not installed during all of the calls that I have tried.  At that point, you have no choice but to use a watchdog timer and reboot, or go purchase the source to the library to correctly patch this unhandled exception.  The API for segger has no described method of handling this error.

The elm-chan library, on the other hand, is free to use, has the source code, and does not crash and burn if a card is removed in the middle of a process.  If it did, then you could patch the source code and fix the issue.  The elm-chan library is an MIT style license, you get to use it without revealing your source code.  It is used by many other embedded processor developers for other mcu's.

It seems to be working well for us.  There is at least one project on github that uses a modified version of the library, for the CY8CKit-059 board.  You need to be a bit wary of that project, it appears the author modified some files and seems to have broken code page support.  However, it is a very good test case to allow you to check out your hardware before you use your own code.

This widget could not be displayed.