View previous topic :: View next topic |
Author |
Message |
thenorthstar
Joined: 06 Mar 2010 Posts: 24
|
|
Posted: Fri May 06, 2011 4:33 am |
|
|
How can you help me fix? please
regards, |
|
|
Geps
Joined: 05 Jul 2010 Posts: 129
|
|
Posted: Fri May 06, 2011 5:13 am |
|
|
What happens if you have:
Code: | strcpy(msg,"HelloWorld");
fputstring(msg,f); |
With the space removed? |
|
|
thenorthstar
Joined: 06 Mar 2010 Posts: 24
|
|
Posted: Fri May 06, 2011 6:37 am |
|
|
Unfortunately, the same problem continues
I wrote posts
Code: | strcpy(msg,"HelloWorld");
fputstring(msg,f); |
same message Hello. Don't written HelloWorld
|
|
|
thenorthstar
Joined: 06 Mar 2010 Posts: 24
|
|
Posted: Fri May 06, 2011 1:55 pm |
|
|
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 |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Fri May 06, 2011 2:59 pm |
|
|
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
|
|
Posted: Sat May 07, 2011 12:19 am |
|
|
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.
|
|
|
lazuribicci
Joined: 06 Feb 2010 Posts: 10
|
|
Posted: Sat May 07, 2011 3:28 am |
|
|
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.
|
üzülme bu kadar yaw. biraz ara ver sonra tekrar bakarsın
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
|
|
Posted: Sat May 07, 2011 9:36 am |
|
|
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
|
|
Posted: Sat May 07, 2011 12:04 pm |
|
|
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
|
|
Posted: Sun May 08, 2011 10:35 am |
|
|
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
|
|
Posted: Mon May 09, 2011 12:36 am |
|
|
Thank you for the answer to my teacher.
I could not find a library that worked correctly.
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.
|
|
|
ckielstra
Joined: 18 Mar 2004 Posts: 3680 Location: The Netherlands
|
|
Posted: Mon May 09, 2011 6:59 am |
|
|
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
|
|
Posted: Mon May 09, 2011 9:20 am |
|
|
How would you suggest to use on a design? Can you give an example of a schema? |
|
|
thenorthstar
Joined: 06 Mar 2010 Posts: 24
|
|
Posted: Thu May 12, 2011 6:32 am |
|
|
Let Someone please help. |
|
|
asmallri
Joined: 12 Aug 2004 Posts: 1634 Location: Perth, Australia
|
|
Posted: Thu May 12, 2011 11:16 am |
|
|
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!! |
|
|
|