HI!
Please, help me . I am using smart glcd 240x128 with micro sd card(8gb), pic18f8722 and mikroC pro for pic. this is my code to Initialize SPI1 and storage device, but he can`t. I used standart code from Visual GLCD for SmartGLCD240x128_hw_rev_1.50 hardware pattern.
void Init_Ext_Mem() {
// Initialize SPI
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
Delay_ms(10);
// Initialize MMC
if (!Mmc_Fat_Init()) {
// Reinitialize SPI at higher speed
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
// Open resource file for read
Mmc_Fat_Assign("%FILE_NAME", 0);
Mmc_Fat_Reset(&res_file_size);
}
}
But it don`t work. I can attach scheme in proteus and full code. Now I am using this code:
// MMC/SD Connections
sbit Mmc_Chip_Select at LATC0_bit;
sbit Mmc_Chip_Select_Direction at TRISC0_bit;
// end of MMC/SD
…
void main() {
…
Delay_ms(100);
// Initialize SPI
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW,_SPI_LOW_2_HIGH);
// Initialize MMC
if (Mmc_Fat_Init() == 0) {
// reinitialize spi at higher speed
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
//--- Test start
T6963C_write_text("11", 4, 4, T6963C_ROM_MODE_XOR);
}
else {
// Note: Mmc_Fat_Init tries to initialize a card more than once.
T6963C_write_text("00", 4, 4, T6963C_ROM_MODE_XOR);
}
…
Writes 00.
mmc sd card
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: mmc sd card
Hello,
Capacity of FAT16 disk is maximum 2GB.
Please see:
MikroC Pro - FAT32 Library
http://www.libstock.com/projects/view/108/fat32-library
Best regards,
Peter
Capacity of FAT16 disk is maximum 2GB.
Please see:
MikroC Pro - FAT32 Library
http://www.libstock.com/projects/view/108/fat32-library
Best regards,
Peter
Re: mmc sd card
Thank you so much for support
i try this code, but error message is Unresolved extern `FAT32_Init`
// Initialize SPI
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
err = FAT32_Init();
// err = FAT32_format("dev0");
if (err < 0) //
{
T6963C_write_text("Fat32 inite", 4, 4, T6963C_ROM_MODE_XOR);
while(err < 0) // ...retry each second
{
err = FAT32_Init();
Delay_ms(1000);
}
}
///////////////////////////////////////
// if all went well, reinitialize
// SPI with greater speed
///////////////////////////////////////
// Initialize MMC
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
T6963C_write_text("00", 4, 4, T6963C_ROM_MODE_XOR);
i try this code, but error message is Unresolved extern `FAT32_Init`
// Initialize SPI
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
err = FAT32_Init();
// err = FAT32_format("dev0");
if (err < 0) //
{
T6963C_write_text("Fat32 inite", 4, 4, T6963C_ROM_MODE_XOR);
while(err < 0) // ...retry each second
{
err = FAT32_Init();
Delay_ms(1000);
}
}
///////////////////////////////////////
// if all went well, reinitialize
// SPI with greater speed
///////////////////////////////////////
// Initialize MMC
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
T6963C_write_text("00", 4, 4, T6963C_ROM_MODE_XOR);
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: mmc sd card
Hello,
Library is included in Library Manager?
Best regards,
Peter
Library is included in Library Manager?
Best regards,
Peter
Re: mmc sd card
Oh! yes, I did it, but another error is "not enough RAM `f32_sector` and indikate this line in __Lib_FAT32_Defs.c:
__RAW_SECTOR f32_sector;
__RAW_SECTOR f32_sector;
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: mmc sd card
Hello,
Please zip and attach your project files.
Best regards,
Peter
Please zip and attach your project files.
Best regards,
Peter
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: mmc sd card
Hi,
Please can you tell me what is "T6963C_MikroC_PRO.h" and do you have some version of source code with which I can recreate problematic situation?
Best regards,
Peter
Please can you tell me what is "T6963C_MikroC_PRO.h" and do you have some version of source code with which I can recreate problematic situation?
Code: Select all
#include "__T6963C.h"
#include "T6963C_MikroC_PRO.h"
#include "menu.h"
#include "__Lib_FAT32.h"
Peter
Re: mmc sd card
Hi
I added T6963C_MikroC_PRO.h and make source code without errors. Thank you very much!
I added T6963C_MikroC_PRO.h and make source code without errors. Thank you very much!
- Attachments
-
- Project.rar
- (484.83 KiB) Downloaded 216 times
- petar.timotijevic
- mikroElektronika team
- Posts: 1739
- Joined: 19 Feb 2014 13:46
- Location: Serbia
- Contact:
Re: mmc sd card
Hello,
With this code I get blank GLCD on my SmartGLCD 1.50 board.
Unfortunately with this code I can not recreate problematic situation.
Best regards,
Peter
With this code I get blank GLCD on my SmartGLCD 1.50 board.
Unfortunately with this code I can not recreate problematic situation.
You received this error during compiling process?san4opa wrote:but another error is "not enough RAM `f32_sector` and indikate this line in __Lib_FAT32_Defs.c: __RAW_SECTOR f32_sector;
Best regards,
Peter
Re: mmc sd card
Hello!
Error was disappeared, but he doesn`t initialize FAT32. indicates fat32 error.
Error was disappeared, but he doesn`t initialize FAT32. indicates fat32 error.