I am trying to play a sound.mp3 from my sd card ,but i receive a error 255 (SD card not found)
The micro sd is SDHC ,cut down to 4GB and FAT16 formatted.
Here is what i have written so far. I have been trying and reading the DataSheet ,so telling me to do that is not quite helping because i have spent a lot of time reading it and have trouble understanding it.
Unlike the P32MX this chip (P32MZ2048ECH124) uses ANSEL and not AD1PCFG. I also tried modifying the Example for P32MX to work on my P32MZ ,but i haven't done any progress ,i receive the same error.
I also have the FAT32 library (same error).
My guess is that i am not initializing something properly (either the SPI or ADC pins).
If anyone can help me understand my lack of skills i will be very grateful due to the fact that there is no one i know that knows microprocessors to help me better understand them.
My gear:
mikroC PRO for PIC32
EasyPIC Fusion v7
PIC32MZ2048ECH124 @ 200MHz
Implemented VS1053b
Implemented MicroSD slot
SDHC 8GB card ,reduced to 4GB FAT16 (leaving 4GB of free space un-allocated)
ANY info you have on anything regarding MCU's will be helpful due to the fact that i apparently lack the understanding of things.
Code: Select all
// TFT module connections
char TFT_DataPort at LATE;
sbit TFT_RST at LATD7_bit;
sbit TFT_BLED at LATD2_bit;
sbit TFT_RS at LATD9_bit;
sbit TFT_CS at LATD10_bit;
sbit TFT_RD at LATD5_bit;
sbit TFT_WR at LATD4_bit;
char TFT_DataPort_Direction at TRISE;
sbit TFT_RST_Direction at TRISD7_bit;
sbit TFT_BLED_Direction at TRISD2_bit;
sbit TFT_RS_Direction at TRISD9_bit;
sbit TFT_CS_Direction at TRISD10_bit;
sbit TFT_RD_Direction at TRISD5_bit;
sbit TFT_WR_Direction at TRISD4_bit;
// End TFT module connections
//MMC connections
sbit Mmc_Chip_Select at RD12_bit;
sbit Mmc_Chip_Select_Direction at TRISD12_bit;
void main(){
AD1CON1 = 0x00;
AD1CON2 = 0x00;
AD1CON3 = 0x00;
CM1CON = 0x00;
CM2CON = 0x00;
ANSELD = 0;
TFT_Init_ILI9341_8bit(320, 240);
TFT_Fill_Screen(CL_PURPLE);
TFT_Set_Font(TFT_defaultFont, CL_BLACK, FO_HORIZONTAL);
TFT_Write_Text("FAT32", 0, 0);
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, 64, _SPI_SS_DISABLE, _SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
if (Mmc_Fat_Init() == 0){
TFT_Write_Text("FAT32 Initialized", 0, 50);
Delay_ms(5000);
}
else if(Mmc_Fat_Init() == 1){
TFT_Write_Text("Error: 1", 0, 50);
Delay_ms(5000);
}
else if(Mmc_Fat_Init() == 255){
TFT_Write_Text("Error: 255", 0, 50);
Delay_ms(5000);
}
}