CCS C Software and Maintenance Offers
FAQFAQ   FAQForum Help   FAQOfficial CCS Support   SearchSearch  RegisterRegister 

ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

CCS does not monitor this forum on a regular basis.

Please do not post bug reports on this forum. Send them to CCS Technical Support

Create a file and write into mmc is OK But ?????
Goto page Previous  1, 2, 3  Next
 
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion
View previous topic :: View next topic  
Author Message
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Fri May 06, 2011 4:33 am     Reply with quote

How can you help me fix? please

regards,
Geps



Joined: 05 Jul 2010
Posts: 129

View user's profile Send private message

PostPosted: Fri May 06, 2011 5:13 am     Reply with quote

What happens if you have:

Code:
strcpy(msg,"HelloWorld");
      fputstring(msg,f);


With the space removed?
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Fri May 06, 2011 6:37 am     Reply with quote

Unfortunately, the same problem continues
I wrote posts

Code:
strcpy(msg,"HelloWorld");
      fputstring(msg,f);



same message Hello. Don't written HelloWorld

Crying or Very sad
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Fri May 06, 2011 1:55 pm     Reply with quote

Code:
(Cmd / format f: / fs: fat32 / a: 512)
format is defined, and then I opened the SD card with WinHex seems to be in the picture below.

and Trying to write data to SD card.
Code:
 f = fopen(gfilename,'a');
      printf("Created sample.txt\r\n");
      delay_ms(1000);
     
     if (f & MMC_ERROR)
      {                                               
      printf(lcd_putc,"Couldn't open file!");         
      if(f == MMC_NO_CARD_INSERTED)                           
         printf(lcd_putc,"Please, insert MMC!");                         
      else if(f == MMC_MAX_FILES_REACHED)                   
         printf(lcd_putc,"ops.. =)");                                   
      }                                                 
   else                                                         
   {       
      printf(lcd_putc,"\f");
      LCD_gotoxy(1,1);
      printf(lcd_putc,"Writing Began");
      printf("Writing Began\r\n");

      strcpy(msg,"Picproje");
      fputstring(msg,f);

      printf("Written data=%s",msg);
      fclose(f);
      delay_ms(100);

SD card with WinHex opened again after the end of the writing process seems to be in the picture below.


And



Where am I could not find the error. SWSPI both HW and tried but still did not happen.


Do you have this code working? or you have a working library of mmc? Please help me


http://www.ccsinfo.com/forum/viewtopic.php?t=31532 Confused
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Fri May 06, 2011 2:59 pm     Reply with quote

If you are getting desperate, you may want to look at our commercial driver.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Sat May 07, 2011 12:19 am     Reply with quote

Hi friends

I do not think this commercial project. I am doing as a hobby.

I think this job will be finished here and dreams will fall into the water.
Crying or Very sad Crying or Very sad
lazuribicci



Joined: 06 Feb 2010
Posts: 10

View user's profile Send private message

PostPosted: Sat May 07, 2011 3:28 am     Reply with quote

thenorthstar wrote:
Hi friends

I do not think this commercial project. I am doing as a hobby.

I think this job will be finished here and dreams will fall into the water.
Crying or Very sad Crying or Very sad


üzülme bu kadar yaw. biraz ara ver sonra tekrar bakarsın Smile
yada şöyle bişey dene madem sadece hello yazılıyor hello ile world ü ayrı ayrı yaz. belki driver dosyasında bir yerde bi ayar vardır sadece 5erli paketler halinde yazabiliyorsundur.
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sat May 07, 2011 9:36 am     Reply with quote

I see the MMC code you are using is an exact copy of the code posted in the Code Library Another MMC Over SPI FAT32 code!
Except that you changed the data pins from PortB to PortC.
Several people have reported the driver to work for the basic functions so for now let's assume your problem is not in the driver code.

What you call 'spaces' in between the characters are in fact 'zeroes'. It is shown by Notepad as a space, but there is a big technical difference with the space character value 0x20.
Notepad is a nice program but has one big disadvantage, it tries to be smart. I hate smart programs. Because your text file contains misformed data Notepad tries to guess about what encoding system is used (ANSI, UTF-8, UTF16, etc). Notepad is clever but with small sized files and misformed data it sometimes guesses wrong (that's the problem with guessing and not letting the user decide in case of doubt). For the moment I recommend you to use Winhex or a similar program to study the file contents until you get rid of the extra zeroes.

Can you post a schematic or description of the hardware connection between your processor and SD card? There might be a problem with the pull-up resistors.
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Sat May 07, 2011 12:04 pm     Reply with quote

Quote:

I see the MMC code you are using is an exact copy of the code posted in the Code Library Another MMC Over SPI FAT32 code!
Except that you changed the data pins from PortB to PortC.
Several people have reported the driver to work for the basic functions so for now let's assume your problem is not in the driver code.

What you call 'spaces' in between the characters are in fact 'zeroes'. It is shown by Notepad as a space, but there is a big technical difference with the space character value 0x20.
Notepad is a nice program but has one big disadvantage, it tries to be smart. I hate smart programs. Because your text file contains misformed data Notepad tries to guess about what encoding system is used (ANSI, UTF-8, UTF16, etc). Notepad is clever but with small sized files and misformed data it sometimes guesses wrong (that's the problem with guessing and not letting the user decide in case of doubt). For the momement I recommend you to use Winhex or a similar program to study the file contents until you get rid of the extra zeroes.

Can you post a schematic or description of the hardware connection between your processor and SD card? There might be a problem with the pull-up resistors.

Thank you very much for the reply.
I did google translation to English is bad sorry for that.
The circuit that follows.
Do you have code that works.
The data shown in the pictures looks like WinHex, but does not appear in the txt file.
mmc / sd of the 3.3v supply is used for the MIC29310 and pic to mmc/sd, and between the voltage converter used as the MC4050


best regards
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Sun May 08, 2011 10:35 am     Reply with quote

In the schematic I don't see a problem that would explain the erroneous behaviour you have.

The schematic would have been easier (and more stable) had you used the LF version of the PIC processor, then the processor and memory card could both run from the same 3.3V without the need for glue logic.

A problem in the schematic is the SDO from the MMC which is 3.3V logic and connects to the pin C4 of the PIC. This is a Schmitt Trigger input which requires 0.8Vdd = 4V to see a Logic High voltage (Datasheet chapter 26.3, parameter D041).
However, this would give problems in reading from the MMC. You are having problems writing.


To rule out hardware problems I suggest you test with another FAT library. Try the example program ex_fat.c from the CCS examples directory.
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Mon May 09, 2011 12:36 am     Reply with quote

Thank you for the answer to my teacher.
I could not find a library that worked correctly. Crying or Very sad


When I try the example program ex_fat.c from the CCS examples directory and I created the file does not OK. Remain attached as in the picture below, the PIC needs to throw the reset.
Code:
ckielstra



Joined: 18 Mar 2004
Posts: 3680
Location: The Netherlands

View user's profile Send private message

PostPosted: Mon May 09, 2011 6:59 am     Reply with quote

Two different software libraries don't work with your hardware, that suggests you have a hardware problem.

I spotted one hardware problem, see my previous post. There might be other problems. Hardware design is not my best expertise, I can only say this is the first time I see a design with an 4050 as level translator in combination with an MMC card. Perhaps a good design but it makes me wonder why other people never did it like that.
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Mon May 09, 2011 9:20 am     Reply with quote

How would you suggest to use on a design? Can you give an example of a schema?
thenorthstar



Joined: 06 Mar 2010
Posts: 24

View user's profile Send private message

PostPosted: Thu May 12, 2011 6:32 am     Reply with quote

Let Someone please help.
asmallri



Joined: 12 Aug 2004
Posts: 1634
Location: Perth, Australia

View user's profile Send private message Send e-mail Visit poster's website

PostPosted: Thu May 12, 2011 11:16 am     Reply with quote

You will find operational reference schematics on the projects page of my web site.
_________________
Regards, Andrew

http://www.brushelectronics.com/software
Home of Ethernet, SD card and Encrypted Serial Bootloaders for PICs!!
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> General CCS C Discussion All times are GMT - 6 Hours
Goto page Previous  1, 2, 3  Next
Page 2 of 3

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group