1 2 Previous Next 19 Replies Latest reply on Aug 9, 2019 4:28 AM by LePo_1062026

    emFile compiling but not working

    GeJo_4320246

      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

        • 1. Re: emFile compiling but not working
          GeJo_4320246

          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 ?

          • 2. Re: emFile compiling but not working
            LePo_1062026

            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

            • 3. Re: emFile compiling but not working
              GeJo_4320246

              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.

              • 4. Re: emFile compiling but not working
                MoTa_728816

                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

                • 5. Re: emFile compiling but not working
                  MoTa_728816

                  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

                  • 6. Re: emFile compiling but not working
                    MoTa_728816

                    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

                    • 7. Re: emFile compiling but not working
                      GeJo_4320246

                      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.

                      • 8. Re: emFile compiling but not working
                        LePo_1062026

                        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

                        • 9. Re: emFile compiling but not working
                          MoTa_728816

                          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

                          • 10. Re: emFile compiling but not working
                            LePo_1062026

                            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

                            • 11. Re: emFile compiling but not working
                              MoTa_728816

                              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

                              • 12. Re: emFile compiling but not working
                                LePo_1062026

                                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

                                • 13. Re: emFile compiling but not working
                                  LePo_1062026

                                  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

                                  • 14. Re: emFile compiling but not working
                                    MoTa_728816

                                    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

                                    1 2 Previous Next