hedisurfer
Newbie level 3
mmc command unsupported
Hi everyone,
I'm trying these days to read a mmc card with the library of mikroC v3.2 of mmc so I used the function mmc_Fat_Init() but it doesn't work and in Proteus I obtain the message: "[MMC CMD] command unsupported".
I suppose that wires are well connected.
Here is the link for my schematic:
https://img12.imageshack.us/i/schematicp.jpg/
And here is my code:
// Glcd module connections
char GLCD_DataPort at PORTD;
sbit GLCD_CS1 at RB0_bit;
sbit GLCD_CS2 at RB1_bit;
sbit GLCD_RS at RB2_bit;
sbit GLCD_RW at RB3_bit;
sbit GLCD_EN at RB4_bit;
sbit GLCD_RST at RB5_bit;
sbit GLCD_CS1_Direction at TRISB0_bit;
sbit GLCD_CS2_Direction at TRISB1_bit;
sbit GLCD_RS_Direction at TRISB2_bit;
sbit GLCD_RW_Direction at TRISB3_bit;
sbit GLCD_EN_Direction at TRISB4_bit;
sbit GLCD_RST_Direction at TRISB5_bit;
// End Glcd module connections
// MMC module connections
sbit Mmc_Chip_Select at RC2_bit;
sbit Mmc_Chip_Select_Direction at TRISC2_bit;
// eof MMC module connections
// Variables for MMC routines
char buffer[512]= "";
char character;
unsigned long i, size;
void delay2S(){ // 2 seconds delay function
Delay_ms(2000);
}
void main() {
ADCON1 |= 0x0F; // Configure AN pins as digital
//CMCON |= 7; // Turn off comparators
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD
// Initialize SPI1 module
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
Delay_ms(250);
if(!Mmc_Init())
{
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
}
Glcd_Set_Font(Character8x7, 8, 7, 32);// Choose font, see __Lib_GLCDFonts.c in Uses folder
while(1) {
Glcd_Write_Text(buffer, 1, 7, 2); // Write string
}
}
Hope I'll find help here
[/img]
Hi everyone,
I'm trying these days to read a mmc card with the library of mikroC v3.2 of mmc so I used the function mmc_Fat_Init() but it doesn't work and in Proteus I obtain the message: "[MMC CMD] command unsupported".
I suppose that wires are well connected.
Here is the link for my schematic:
https://img12.imageshack.us/i/schematicp.jpg/
And here is my code:
// Glcd module connections
char GLCD_DataPort at PORTD;
sbit GLCD_CS1 at RB0_bit;
sbit GLCD_CS2 at RB1_bit;
sbit GLCD_RS at RB2_bit;
sbit GLCD_RW at RB3_bit;
sbit GLCD_EN at RB4_bit;
sbit GLCD_RST at RB5_bit;
sbit GLCD_CS1_Direction at TRISB0_bit;
sbit GLCD_CS2_Direction at TRISB1_bit;
sbit GLCD_RS_Direction at TRISB2_bit;
sbit GLCD_RW_Direction at TRISB3_bit;
sbit GLCD_EN_Direction at TRISB4_bit;
sbit GLCD_RST_Direction at TRISB5_bit;
// End Glcd module connections
// MMC module connections
sbit Mmc_Chip_Select at RC2_bit;
sbit Mmc_Chip_Select_Direction at TRISC2_bit;
// eof MMC module connections
// Variables for MMC routines
char buffer[512]= "";
char character;
unsigned long i, size;
void delay2S(){ // 2 seconds delay function
Delay_ms(2000);
}
void main() {
ADCON1 |= 0x0F; // Configure AN pins as digital
//CMCON |= 7; // Turn off comparators
Glcd_Init(); // Initialize GLCD
Glcd_Fill(0x00); // Clear GLCD
// Initialize SPI1 module
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV64, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
Delay_ms(250);
if(!Mmc_Init())
{
SPI1_Init_Advanced(_SPI_MASTER_OSC_DIV4, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_LOW, _SPI_LOW_2_HIGH);
}
Glcd_Set_Font(Character8x7, 8, 7, 32);// Choose font, see __Lib_GLCDFonts.c in Uses folder
while(1) {
Glcd_Write_Text(buffer, 1, 7, 2); // Write string
}
}
Hope I'll find help here