cancel
Showing results for 
Search instead for 
Did you mean: 

PSoC 4

Anonymous
Not applicable

Hello,

I am new to PSoC4. I am trying to interface GPS http://www.progin.com.tw/mr87_en.htm with PSoC4.
I got an example at http://www.element14.com/community/message/141760/l/re-psoc-4-pioneer-kit-community-project089-gps-e... . I have studied it and it works well now. The problem with it is, it shows only Longitude or Latitude or Time at one time. The output actually depends on "State" global variable in the program

uint8 State=GO_LATITUDE;
//uint8 State=GO_LONGITUDE;
//uint8 State=TIME;

Now I want to interface SD Card to log the GPS co-ordinates: Longitude, Latitude, Time and temperature sensor (LM35)output in excel sheet (or Microsoft Excel Comma Separated Values File (.csv) ). I have tried the example of SD Card at http://www.element14.com/community/thread/25517/l/psoc-4-pioneer-kit-community-project050-sd-card-ex... , but it actually causes file system to format.

Any help will be appreciated.

Regards,
Sarang

0 Likes
30 Replies
ETRO_SSN583
Esteemed Contributor

Consider posting your project, makes life easier to troubleshoot.

   

 

   

“File”                                                             Creator

   

“Create Workspace Bundle”

   

 

   

1) What size SDCARD are you using ?

   

2) Power arrangement/schematic ?

   

3) I used the example project, was able to do simple data writes,

   

is that where you are getting hung up ?

   

 

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank you Dana.

   

I am working on the same example of SDCard that is given on element14.

   

1. I am using 2Gb SanDisk microSDCard.

   

2. What do you mean by Power arrangement/schematic ?

   

3. I am using PSoC Creator 3.1 SP 1, which indeed gives me 49 warnings for SDCard program.

   

 

   

Regards,

   

Sarang

0 Likes
EvPa_264126
Valued Contributor II

Dvorakvik have cleaned the SDcard code for SD in progect  SDCard_H_33_50_Source_W5100_OK.zip.  it's  here: http://www.cypress.com/?app=forum&id=4749&rID=91643
Perhaps you are interested to use GPS time information. it's here:  http://www.hackster.io/rayburne/gps-clock-an-about-time-project-for-psoc-4200

0 Likes
Anonymous
Not applicable

Hey Pavloven ,

   

Dvorakvik's project  SDCard_H_33_50_Source_W5100_OK.zip    gives only the warnings as shown in image (9 warnings which are vaiable "abc" set but not used)

   

But his project causes the file system to corrupt. (Image attached here with)

   

Any help??

   

Regards,

   

Sarang

0 Likes
EvPa_264126
Valued Contributor II

   

Ah, yes. recommended use  SD Formatter 4.0 for SD/SDHC/SDXC      https://www.sdcard.org/downloads/formatter_4/

0 Likes
Anonymous
Not applicable

Pavloven, I am using SDFormatter V4.0. But still it corrupts file system.  I got the "Write file " and "Append file" perfectly working before, but now again the file system is corrupting.

   

Am I write for the following sequence:

   

1. Format microSD card using SDFormatter V4.0.

   

2. Put SDCard into SD Card reader.

   

3. Plug in Pioneer Kit's USB to laptop.

   

4. Build and program PSoC4.

   

5. Plug out USB from lapatop.

   

6. Put microSD card in USB microSD card reader. Plug it in to laptop

   

7. Check for the created file.

   

Regards,

   

Sarang

0 Likes
Bob_Marlowe
Expert II

4a. is hopefully: Run program on Pioneer Kit

   

Else you would have made connection/wire mistakes

   

 

   

Bob

0 Likes
EvPa_264126
Valued Contributor II

Once I had similar problems with the SD card but I do not remember her model. I replaced it.
I'm using the old models no more than 4 Gb
you may use someone else's project for PSoC4 and make sure that the problem with SD card repeated.
 

0 Likes
Anonymous
Not applicable

Hey Bob,

   

What do you mean by "4a. is hopefully: Run program on Pioneer Kit"

0 Likes
Anonymous
Not applicable

Hey Pavloven,

   

If you have the SDCard reader module could you please let me know if it (Dvorakvik have cleaned the SDcard code for SD in progect  SDCard_H_33_50_Source_W5100_OK.zip.  it's  here: http://www.cypress.com/?app=forum&id=4749&rID=91643) works well.

0 Likes
Anonymous
Not applicable

When I debug my program fcnt does not show up in any "Locals tab". Actually I kept 5 .txt files in microSDCard just to check if program counts number of files correctly in the card. (All below part of program is commented  except     SDCard_Select(SDCard_DISABLE);    SDCard_Stop();  )

   

Line number 41:

   

fcnt = SDCard_GetFileCount();               // = Get number of files on Card

   

 

   

What does it indicate??

0 Likes
Bob_Marlowe
Expert II

What do you mean by "4a. is hopefully: Run program on Pioneer Kit"

   

In your list you program your kit, but you do not tell that you run/debug your program. When the filesystem is destroyed before you actually run you must have wired something badly.

   

 

   

Bob

0 Likes
EvPa_264126
Valued Contributor II

   

Take a look at this project: http://mylab.wmsite.ru/moi-razrab/cypress-psoc/sd-logger-for-psoc5/8-mi-kanalnyj-logger/

   

But it uses the same library.

   

In addition SDCard_FS.c file is converted to a Creator 3.1 with errors after line 705 (((

0 Likes
Anonymous
Not applicable

Hey  I am trying the following project attached herewith.

   

Its a simple file creation and add text to the file project.

   

Still it is causing the file system to corrupt.

   

Hey Bob, I shall try the link given by you and let you know further.

0 Likes
EvPa_264126
Valued Contributor II

This only I have a problem with the file SDCard_FS.c?

0 Likes
Anonymous
Not applicable

Hey what problem do you find at the location marked by you in image.

   

 

   

Dvorakvik project  SDCard_H_33_50_Source_W5100_OK.zip.  @  http://www.cypress.com/?app=forum&id=4749&rID=91643 works sometimes (does not make file system corrupt) but fails most of the time (Corrupts the file system)

0 Likes
EvPa_264126
Valued Contributor II

   

I can't see the text in the file SDCard_FS.c

   

below the line No. 705

   

I'm afraid that I have problems with Creator 3.1

0 Likes
Anonymous
Not applicable

I am attaching SDCard_FS.c   Please download notepad++ at http://notepad-plus-plus.org/download/v6.7.5.html  to get line numbers.

0 Likes
EvPa_264126
Valued Contributor II

Thanks. I need to reinstall Creator3.1 on a computer XP (((

   

I tested your project sar_try_2.cydsn.rar with three SD cards. The result on the photo.
At SanDisk 4Gb file is not even recorded.
 

0 Likes
Anonymous
Not applicable

Thanks for your efforts. Well, can I say that code is absolutely correct??? (As you get "file1.txt" successfully created on the SD Card.)

   

You worked with Transcend 256MB, Kingston 1GB which gave you correct output. But SanDisk 4GB does not work. (Anyways 4GB is not supported by PSoC4 as of now).

   

May we conclude that SanDisk microSD card does not work well with this code?  (I shall try to work with Transcend microSD Card and let you know).

0 Likes
EvPa_264126
Valued Contributor II

   

Yes that's right.  I am not an expert on working with SD - just an experiment.

   

   

I also use MicroSD 1Gb

0 Likes
Anonymous
Not applicable

Hurray!!!  Hey Pavloven its working absolutely fine. Got an old microsd card from my friend (Make of SDCard: MAXX)

   

Special thanks to Pavloven. You boosted my courage to work on the same project. (As it worked well for you.)

   

Thanks to other members of my cases.

   

Hey, in the following function we are passing character string "This is my 1st file.".

   

fp = SDCard_fopen((uint8 *)"file1.txt",(uint8 *) "w");  // = Open a file with write mode access. If the file is not present, a new file is  created.
SDCard_fputcs((uint8 *)"This is my 1st file.", fp);         // = Write a constant string into the file

   

.

   

Instead in my complete project (the one that I am working on) I want to save the values of the Longitude, Latitude, Time (from GPS module) of variable type char longitude[10], char latitude[9] and char time[10]. So  now I am working to convert the values in longitude[10] to character string so that it can be passed in SDCard_fputcs( );     

   

.

   

Is there any way that I can directly pass the longitude[10] in SDCard_fputcs();

   

 

   

Thank you,

   

Sarang

0 Likes
ToVa_285016
Contributor

 See the attached project where I am logging two sets of voltage and current for a solar system.  I am saving them in a file that can be opened by excel and graphed.
Thank you,
Tom

0 Likes
HeLi_263931
Honored Contributor II

Any card larger than 2GB is either SDHC or SDXC. The difference is not the electrical connection (its the same for SD and SDHC, though SDXC introduces some faster bus), but the used file system. SD uses FAT, SDHC uses FAT32, SDXC uses exFAT.

   

Cards of 2GB and smaller my be SD or SDHC, so luck might vary.

   

It seems that the SD Card implementation knows only about the FAT filesystem, so it might destroy any other ones.

0 Likes
EvPa_264126
Valued Contributor II

I'm glad I could help you.
If longitude [10] - ready data line so it is possible to:
..............
 SDCard_fputcs((uint8 *)longitude, fp);   
.................

   

But the project DataLogger3.zip from tdvdesign already has a solution - use it.

   

It is a pity that there is no datasheet for SDCard component.
I would like to see the development of this area.

0 Likes
ETRO_SSN583
Esteemed Contributor

The element14 website had this to say about cards -

   

 

   

Few things to check:

   

1. You need to format your SDCard with SDFormatter (https://www.sdcard.org/downloads/formatter_4/). Windows formatting does not create a boot record.

   

2. SD Card should not be high capacity. i.e. the size of card should be less than 2Gb. The file system cannot handle high capacity cards.

   

3. There are two CS pins; in which you should use only the SD_CS pin and ignore the _ss0 pin.

   

4. PSoC4 should operate at 3.3V

   

 

   

www.element14.com/community/thread/25517/l/psoc-4-pioneer-kit-community-project050-sd-card-example

   

 

   

Regards, Dana.

0 Likes
ETRO_SSN583
Esteemed Contributor

And these comments -

   

 

   

I was going through my old emails and saw that this post went unanswered. Sorry for the inconvenience.

   

 

   

Here are the answers to your questions:

   

1) I haven't cleaned the code well. But, these wont break anything.

   

2) The code has not identified a valid SD Card.

   

3) It is compatible. You'll have to change the pinout though.

   

4) This will not work. Any card with size more than 2GB capacity needs a "High Capacity" support. This is as simple as setting the high-capacity bit during card initialization in ACMD41 command.

   

But, this also means that the File System should support the same. Unfortunately, this feature is not supported in the code attached here.

   

So, you are limited to use only 2GB cards. I have seen that some cards from SanDisk with exactly 2GB capacity needs this bit to be set. Transcend cards work without any issues till 2GB.

   

5) Normal settings should work. You can either use 5V or 3.3V setting, but I recommend using 3.3V.

   

6) SDCard_InitCard() is trying to initialize the card. Since this function is kept in an loop, the initialization procedure happens till a valid card is identified.

   

 

   

So, the only issue I see here is the 8GB card used. Please try with a true 2GB card. I suggest to use a Transcend 2GB SD card.

   

 

   

Regards,

   

Sriram V S

0 Likes
Anonymous
Not applicable

Hey tdvdesign thanks for posting your project, saw it today. Thanks to Hli, Pavloven, Danaaknight for your replies.

   

I am stuck at :

   

[1] GPS() time conversion from UTC to IST (Indian Standard Time is 5 hours and 30 minutes ahead of Coordinated Universal Time )

   

[2] Getting the latitude and longitude direction (N/S, E/W)

   

Herewith I have attached my complete project.

   

This project works perfectly well to store GPS coordinates, time in the SDCard only problem is it stores UTC time (as provided by GPS) and coordinates without directions.  I have referred the codes from element14 (example project 50, 89)

   

Need help to make it correct.

   

Regards,

   

Sarang

0 Likes
ETRO_SSN583
Esteemed Contributor

Converting time -

   

 

   

rl.se/convert-utc-to-local-time

   

stackoverflow.com/questions/1173578/converting-between-timezones-in-c

   

 

   

Regards, Dana.

0 Likes
Anonymous
Not applicable

Thank you Dana,

   

But I could not understand the text on the links you provided. May I please get any further help.

   

Regards,

   

Sarang

0 Likes