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 support@ccsinfo.com

Another MMC Over SPI FAT32 code!
Goto page Previous  1, 2, 3, 4, 5, 6
 
Post new topic   Reply to topic    CCS Forum Index -> Code Library
View previous topic :: View next topic  
Author Message
tesla80



Joined: 23 May 2007
Posts: 81

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 1:01 pm     Reply with quote

Please tell me how to change the cluster size IOpuffer[512] to 64 ?
I found some another 512s written in the code but it doesn't work when I replace 512s with 64s it doesn't work and I get warnings like:
"Subscript out of range"
at these 3 lines:
Code:
      gStartSectorL = gFiles[MAXFILES-1].IOpuffer[0x1C6];
      gStartSectorH = gFiles[MAXFILES-1].IOpuffer[0x1C7];
      gStartSectorHL = gFiles[MAXFILES-1].IOpuffer[0x1C8];


How to repair it?
What mean the numbers 454-455-456?
asmallri



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

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

PostPosted: Wed Dec 21, 2011 2:43 pm     Reply with quote

tesla80 wrote:
Please tell me how to change the cluster size IOpuffer[512] to 64 ?
I found some another 512s written in the code but it doesn't work when I replace 512s with 64s it doesn't work and I get warnings like:
"Subscript out of range"
at these 3 lines:
Code:
      gStartSectorL = gFiles[MAXFILES-1].IOpuffer[0x1C6];
      gStartSectorH = gFiles[MAXFILES-1].IOpuffer[0x1C7];
      gStartSectorHL = gFiles[MAXFILES-1].IOpuffer[0x1C8];


How to repair it?
What mean the numbers 454-455-456?


The code is extracting information from the boot sector. A sector is 512 bytes and the information required to find the starting sector is located at offset 0x1c6 (in this sector). You have changed the cluster size buffer to 64 which is obviously not the sector size of an SD/MMC card.

It is possible to modify the code to read in blocks of less than 512 bytes however be aware that you cannot reduce the requirement for a 512 byte write buffer as SD/MMC cards MUST write in 512 byte blocks.

This is the reason that, when using PIC18F processors, the PICs with the highest amount of RAM (3900 bytes) are most suited data logging applications using SD/MMC cards. I have built a number of commercial products that log to SD/MMC cards however, as a general rule, I no longer use the PIC18F family for this class of operation, instead using the PIC24 and above because of the additional RAM and superiour system architecture.
_________________
Regards, Andrew

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



Joined: 23 May 2007
Posts: 81

View user's profile Send private message

PostPosted: Wed Dec 21, 2011 5:35 pm     Reply with quote

Thanks asmallri,
So I will use a better PIC then.

What could you say about my question at the link below for this library? I hope a person like you can easily find the bug. I also can send you proteus file + working code, if you wish. it acts the same like in real HW.

I can't write into every 8 files after 8 successful ones:
http://www.ccsinfo.com/forum/viewtopic.php?p=155283#155283
asmallri



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

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

PostPosted: Wed Dec 21, 2011 5:44 pm     Reply with quote

tesla80 wrote:
Thanks asmallri,
So I will use a better PIC then.

What could you say about my question at the link below for this library? I hope a person like you can easily find the bug. I also can send you proteus file + working code, if you wish. it acts the same like in real HW.

I can't write into every 8 files after 8 successful ones:
http://www.ccsinfo.com/forum/viewtopic.php?p=155283#155283


If you are debugging this in proteus then you are wasting your time.
_________________
Regards, Andrew

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



Joined: 23 May 2007
Posts: 81

View user's profile Send private message

PostPosted: Thu Dec 22, 2011 6:43 am     Reply with quote

NO!! It works on real hardware!
I just said that it works on proteus too.

So is that a trading forum?
Everywhere people say to buy a code... It's not a commercial product and I'm just learning!
You are here to sell your codes, not to help.
asmallri



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

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

PostPosted: Thu Dec 22, 2011 9:46 am     Reply with quote

tesla80 wrote:
NO!! It works on real hardware!
I just said that it works on proteus too.

So is that a trading forum?
Everywhere people say to buy a code... It's not a commercial product and I'm just learning!
You are here to sell your codes, not to help.


You are not a native English speaker which puts you at a disadvantage because you miss the subtleties of the language. I am a native English speaker but I worked in a German speaking country for several years and appreciate the challenges.

No one has told you must buy any code. One or more forum members have made recommendations to you and, in each case, outlined why they made such a recommendation - this is a good use of the forum. I do sell FAT software but that did not prevent me from trying to help you like explaining why you were having problems. You asked me specific questions about the CCS driver that I cannot help you with because I do not use or support their file system driver.
_________________
Regards, Andrew

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



Joined: 23 May 2007
Posts: 81

View user's profile Send private message

PostPosted: Thu Dec 22, 2011 12:02 pm     Reply with quote

For the people who interested to find the write bug, here are all the code, Proteus 7.7 DNS file and sd.mmc file which can be opened by WinImage
web.rar - 0.07MB

I think some of calculations are wrong and the error occurs after successfully writing of every 8 file.

I'm already working on it.

Br.
a4able



Joined: 10 Aug 2012
Posts: 1

View user's profile Send private message

PostPosted: Sun Aug 12, 2012 12:43 am     Reply with quote

Milhaus wrote:
Thanks Miniman,
your library work perfectly. But i have one question. I am using interrupts in my PIC18F2610 ( 22050 times/s ) for playing wav file from MMC card.It is really needed to disable/enable interrupts in function MMCResponse ReadSector(int32 sector, char *hova) ?

thanks
Milos


Can you please give me your corrected header files.
I am on a project to play a mp3 file from SD card using pic and vs1011 mp3 decoder ic.
I am a fresher in pic.
Working on this for days but still nowhere.
It will be so kind if you help me with this.
I am using Proteus to simulate.
Fernandes



Joined: 31 Aug 2013
Posts: 1

View user's profile Send private message

PostPosted: Sat Aug 31, 2013 3:11 pm     Reply with quote

incubus22 wrote:
Miniman wrote:
Have never used Proteus, all I can say is that I have got it to work irl and that it seems like some other peoples have to. Maby the SPI mode is wrong, try to change that


Hello again! I've managed to make the MMC initialize in real world. However, I can't append to a file. My code to append is as follows:
Code:

lcd_init();
   printf(lcd_putc, "START!!!\n");
   
   if(MMCInit() == MMC_OK)                               
   {                                                     
      printf(lcd_putc,"MMC initialized\n");                     
      InitFAT();
                           
      { 
         strcpy(gfilename,"EVENTS.LOG");     
         f = fopen(gfilename,'a'); // open EVENTS.LOG for append   
         if (f & MMC_ERROR)                                           
         {                                                             
            printf(lcd_putc,"Couldn't open file!\n");                         
            if(f == MMC_NO_CARD_INSERTED)                             
               printf(lcd_putc,"Please, insert MMC!");                         
            else if(f == MMC_MAX_FILES_REACHED)                       
               printf(lcd_putc,"ops.. =)"); 
            while(1);
         }                                                               
         else                                                         
         {                                                             
            strcpy(msg,"System started\n");   
            printf(lcd_putc,"written\n");
            fputstring(msg,f);                                         
            fclose(f);   
            while(1);
         }       
     }
   }
   else
   {
      printf(lcd_putc,"MMC init failed!\n");
      while(1);
   }

I have formatted my MMC using the cmd and the following command:
format F: /A:512 /V:mymmc /FS:FAT32

Nothing is happening. The file EVENTS.LOG does not change at all. Any clue?

The only lines printed on my LCD are:
START!!!
MMC initialized

no more else.


Hello Incubus!!!!!
I have the same problem aforementioned and I don't know how I can solve it. Could you tell me how you did it, please?
adnan jafar



Joined: 26 Sep 2014
Posts: 11

View user's profile Send private message

SD Card interfacing with PIC18F452
PostPosted: Wed Dec 17, 2014 2:20 pm     Reply with quote

Hello Seniors!
I tried to implement the Tomi code with 4GB SD card and PIC18F452. i used level conversion between PIC and SD Card. The Card is successfully Initialized but when i write to some memory location and then see that memory location, nothing is seen on this memory location. Can anyone tell em that what is the problem???? or how can i change this code for SD Card?????

Regards,
Adnan
Display posts from previous:   
Post new topic   Reply to topic    CCS Forum Index -> Code Library All times are GMT - 6 Hours
Goto page Previous  1, 2, 3, 4, 5, 6
Page 6 of 6

 
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