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

PSoC™ 5, 3 & 1

GeJo_4320246
Level 1
First like received First like given
Level 1

Hi,

Here what I use in this project :

  • 'PSoC 5LP CY8C5888LT*-LP097' Prototyping kit
  • 2Go Micro SD transcend card
  • microSD click from Mikroe
  • SD Card Formatter and/or Formatter from Windows 10
  • UART (named UARTGPS because of my project) communication with Termite 3.4  instead of LCD in the example.
  • Default configuration for emFile in TopDesign
  • Tried FAT16 and FAT32
  • tried with pins 2[3:6] then 12.0 12.4 12.3 12.2

My code compile without error,

But in the end, it just does nothing, and it seems that it doesn't even see the sd card. It only displays a generic name "mmc:0" which is why I changed the SD card name to "UMTS" to be sure it was not working.

Here I link the schematics for my SD card Reader : https://download.mikroe.com/documents/add-on-boards/click/microsd/microsd-click-schematic.pdf

And all the information : https://www.mikroe.com/microsd-click

Intersting fact that might be a lead : I measured voltage with a voltmeter (DC mode) and I couldn't measure anything except for CS pin

0 Likes
1 Solution
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Geoffrey,

I believe I solved both yours and my problem.

Your main() left out the

CyGlobalIntEnable; /* Enable global interrupts. */

Once I inserted it early in the initialization, my SPI communication lines to the SD begin working.

Note:  I'm still having difficulty formatting and other FS functions but I can see the SPI is working now.

Does anyone have access to the FS API calls?  [Update] Never mind.  Found it!

Len

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

View solution in original post

0 Likes
19 Replies
GeJo_4320246
Level 1
First like received First like given
Level 1

Edit : (I did not know how to edit initial post)

Interesting fact that might be a lead : I measured voltage with a voltmeter (DC mode) and I couldn't measure anything except for CS pin.

I didn't expect much since it's supposed to be serial communication  but the the CS pin voltage was around 4.7V which I find weird since my card reader is working in 3.3V and I don't know if it could be related ?

Also the card reader is powered on by external  source with 3.3V regulator.

Does someone know what could go wrong in my project ?

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Geoffrey,

I've downloaded your project.  I get a compile error:  "Build error: MMC_X_HW.h: No such file or directory".  Therefore I can't help much further at this time.

[Solved!]  Your build settings point to the emFile info in the C: directory.

I'm currently looking at your project...

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
GeJo_4320246
Level 1
First like received First like given
Level 1

Hi thank you for your interest in my problem. I had to change the path of my emfile "emFile_v322c" files to my hard disk C:\ because I had a path problem..

The error that you mention was the one that I had before moving the files.

0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Hi,

I've been trying to make the project in the initial topic work and finally it seems to be working.

Although the name is still "mmc:0:"

008-TeraTerm-Log.JPG

The most difficult part was finding a SD card interface... I have a nice colleague 😉

Anyway, I spent whole morning without success.

IMG_3727.JPG

Then  a few minutes ago I noticed that the media detect signals needed to be connected!

So I connected them with the BLUE Jumper pin, then the program started working!

IMG_3726.JPG

FYI, I used libemf32noslfn.a (emf32noslfn) to be more compatible with my PC.

I hope that this can work for your case, too.

moto

0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Hi,

Some additional note, off my head.

Since the I/O voltage of CY8CKIT-059 is 5V, the CS pin is around 5V when it is not asserted.

So IMHO, measuring 4.7V won't be a problem.

(I did not provide an external 3.3V, and let the 5V do all)

And even I renamed the media on my PC to SD,

the program reported "mmc:0:" so I took it as a spec of the linked library.

I just saw the schematic of your SD card IF, in your case the media detect SW is automatically on if you insert the media.

Are you testing your program with a media inserted?

(interesting enough, the program reported "mmc:0:" even without the media.)

Beside seeing the name "mmc:0:", is other part of you program working on you side of the planet?

moto

0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Hi,

Just to make sure, I downloaded your attachment and tried

I renamed the project to emFile_Example01_190806.

For the include path, I added 3 relative paths

000-Includes.JPG

For the Linker Configuration

002-Linker-Settings.JPG

And for the Library Directories

001-Lib-Directories.JPG

Having done above, I have not touched any other part of the project

and the program could be built and run.

003-TeraTerm-log.JPG

I'm using a SD card reader from the link below. (Sorry Japanese)

マイクロSDカードスロットDIP化キット: 組立キット 秋月電子通商-電子部品・ネット通販

So my conclusion is that the project is fine,

if it does not working probably problem is SD card reader hardware

or connection with it.

moto

0 Likes
GeJo_4320246
Level 1
First like received First like given
Level 1

Hi Moto,

Thank you for taking so much time to help me !

I tried adding the third relative path but it didn't change anything.

It's a relief that the code is working then, but bad news that this might be hardware problem. I looked and there is no equivalent for the media detect in my SD card reader. I measured the voltage to the CD pin and it detects well my sd card. I will try again with FAT32 then and I'll see.

I think that what might be wrong is that the SD card is a 3.3V power supply ONLY.

Even though it is powered with 3.3V and only the SPI pins are in 5V then, it could probably be a problem so I'll try to supply the PSoC with 3.3V power supply and see what happens.

I also could try with another SD card but I don't think that I have another card under 2Go capacity.

If it does not work I'll probably try to reach the support team of Mikroe for their device.

I'll keep you updated.

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Geoffrey,

I believe I solved both yours and my problem.

Your main() left out the

CyGlobalIntEnable; /* Enable global interrupts. */

Once I inserted it early in the initialization, my SPI communication lines to the SD begin working.

Note:  I'm still having difficulty formatting and other FS functions but I can see the SPI is working now.

Does anyone have access to the FS API calls?  [Update] Never mind.  Found it!

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto,

I've tried both Geoffrey's and your projects.  I get the same result that Geoffrey sees.   Basically none of the SPI pins are toggling.  It appears that although both yours and his project builds, the IO is not being controlled by the emFile component.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Dear Len-san,

I tried to draw schematics for both my system and yours

First my system (working)

006-Schematic-AE.JPG

Second your system (the upper right part may not be accurate)

005-Schematic-micro.JPG

I think that most significant difference is the pin (10) of SD card holder.

I think that the pin must be LOW when there is a SD card inserted.

Meantime, I think that you can connect VDD(5.0V) of CY8CKIT-059 to the VCC/+3.3V of the SD Module

as far as you are not mounting the module to other 3.3V board.

Please try the following connections

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

CY8CKIT-059   micorSD

P12[0]               CS#

P12[3]               SDI

P12[4]               SCK

P12[2]               SDO

GND                 CD#

VDD(5V)           +3V3  (when the module is not connected to other 3.3V system)

GND                 GND

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

Best Regards,

7-Aug-2019

Motoo Tanaka

P.S. I attached the binary files of my project, which is working on my side of the planet

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto-san,

My SD card interface doesn't not have a Card Detect input or output.  This is a Seeedstudio V3.0 SD card reader.  It was designed for an Arduino system that I have gotten to work successfully.  It only has four signals (CS, SCK, SDI and SDO) along with VDD and GND.

The other issue is that when monitoring all 4 signals I observe no signal toggling when the SW should be reading our writing to the SD card.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Dear Len-san,

In the beginning of this topic it was written

  • microSD click from Mikroe

So I was trying to think about Mikroe SD module...

Are you with Gejo-san? or are we talking about two different systems at once here?

Anyway, since it's already 2:00AM in Japan, I'll take a look at Seeedstudio module tomorrow (or shall we call it today?).

Meantime, could you test this?

(1) Create a simple project

(2) add a GPIO pin (output, strong drive) without hardware connection

(3) Assign that pin to one of the pin used for SPI

(4) From a program repeat write(0) and CyDelay(500) and Write(1)  and CyDelay(500)

   while(1) {

             the_pin_Write(0) ;

             CyDelay(500) ;

             the_pin_Write(1) ;

             CyDelay(500) ;

   }

(5) probe the pin and monitor it with you oscilloscope

    if it is flipping you board should be OK,

    but if not, may be your board has been damaged somehow.

Best Regards

8-Aug-2019

Motoo Tanaka

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto-san,

Thank you for your response.  I've gotten the SPI comm working now.  The CyGlobalIntEnable; /* Enable global interrupts. */ was left out of Geoffrey's original project.

I am having FS problems.  If you have access the the FS API calls, that would be handy.  [Update] Never mind.  Found it!

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Dear Len-san,

I have just seen the circuit of seeed sd shield.

You need to provide 5v to arduino 5v pin.

Have you connected the VDD/5V of cy8ckit-059 to the 5v pin of the shield?

Best Regards

8-Aug-2019

Motoo Tanaka

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto-san,

Yes.  5V is connected.  I'm having difficulties with the FS calls.  Something's not right.

Len

Len
"Engineering is an Art. The Art of Compromise."
0 Likes
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Dear Len-san,

(1) Could you be more specific about the "difficulties"?

(2) Please let me know the connection between the Seeed Shield and CY8CKIT-059

(3) Make sure that the card selector switch is micro SD position

(4) This needs to be at your own risk,

      but try connecting CDN pin of SD Card Reader to GND

      Note: My case it worked, I can not guarantee if it works for you, though.

スクリーンショット 2019-08-08 23.04.53.png

Best Regards,

8-Aug-2019

Motoo Tanaka

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto-san,

Thank you for your time and research.  I have solved the problem. The switch that seleted between the standard SD card or the mini SD was set to mini and I was using standard SD cards.   Once I flipped the switch to "standard"  I could talk to the formatted SD card.

Len

Len
"Engineering is an Art. The Art of Compromise."
MotooTanaka
Level 9
First comment on KBA 1000 replies posted 750 replies posted
Level 9

Dear Len-san,

LOL.

But I'm glad knowing that you are OK now 😉

Best Regards,

9-Aug-2019

Motoo Tanaka

0 Likes
Len_CONSULTRON
Level 9
1000 replies posted 750 replies posted 500 likes received
Level 9

Moto-san and Geoffrey,

If you're interested.  I've modified Geoffrey's original project to be menu driven commands as well as using the CY8CKIT-059's USB port for UART comm instead of the KitProg.

I've attached the project here.

You will need to do the following:

  • Unarc it.  (Obvious).
  • The emFile component files on your system need to be assigned in the project build.  I placed my emFile component files one-level below the project.
  • Build the project without error.  (There might be a few warnings but it's OK).
  • Program your CY8CKIT-059.
  • Place a USB cable from the USB connector on the CY8CKIT-059 to the PC.
  • Make sure the PC finds the driver.  If not, I've attached the .inf file as well.
  • Once the USBUART is recognized by the system (assigned a COM port), open a term program @ 115200 8N1.
  • Type '?' or 'h'.  It should display the commands available in that build.
  • Type a 'd'.  It will find all the mounted volumes and display the media specs.

I plan to add more commands to the program.  You can add more commands if you're interested.  Sorry the comments are a little 'lite'.

Enjoy!

Len

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