MikroC & SD CARD & PIC18F4520

Status
Not open for further replies.
Does anyone know what's allocation size to set for mikroC to work ?
I have formatted into FAT using windows XP and allocation size default.


Linspire
 

The SD card must be formatted with FAT16, not FAT32, with the default allocation size. Formatting the SD with FAT16 is a requirement of the MikroC MMC Library.

BigDog
 

Yap I formatted my sd card into FAT (Windows XP) with default allocation.
When I formatted sd card, I choose option of FAT instead of FAT32.
Still having problem sd card detection.

Linspire

---------- Post added at 18:37 ---------- Previous post was at 17:03 ----------

I have make image clone directly from my SD card.
I did simulation ISIS 7, it's working properly.
Sighed.
Still having problem detection SD card.

Linspire
 

So weird...
When I tried mikroC user manual example code, it's not working properly.
However, I rewrite my code with following these coding:
Code:
  SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE,_SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
  while (Mmc_Init());
  Lcd_Out(1,1,"reintialized");
  Delay_ms(1000);
  Delay_ms(1000);
  // use fat16 quick format instead of init routine if a formatting is needed
  while(1) {

             if (!Mmc_Fat_Init()) {
             SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE,_SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
             ......
             ......
             ......
             break;        // WHEN YOU CREATE FILE, GET OUT OF INFINITE WHILE LOOP
                               }
            }

It's working properly on my hardware.
Why is like that ?
Anyone know how to explain it ?


Linspire
 


Hi Bigdog,
I have posted a very similar querry. Please check it out and suggest me a way out
https://www.edaboard.com/threads/282589/
Thanks in Advance, Regards
 

The below 2 functions should be called once and so they should be in the main() function but before the while(1) loop.

Code C - [expand]
1
2
if (!Mmc_Fat_Init()) {
             SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE,_SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);

 

Status
Not open for further replies.
Cookies are required to use this site. You must accept them to continue using the site. Learn more…