hi im new here, I need ur help as soon as possible plzzzz
im using dspic33FJ32MC204 with sd card. the sd card can not be initialized.i used the portc to indicate that. if the portc=0x0000 it means that sd card initialization was ok if not portc=0x00ff (portc has only 10 pins). here is my code written with mikroc using the internal RC.
#define FCY 3685000
#define BAUDRATE 9600
#define BRGVAL ((FCY/BAUDRATE)/16)-1
int main(void)
{
ADPCFG=0xffff;
RPINR18bits.U1RXR = 0;
RPOR5bits.RP10R = 8;
RPINR20bits . SDI1R = 11;
RPOR6bits . RP12R = 7 ;
Mmc_Chip_Select=1;
trisc=0x0000;
//initialisation spi
portc=0xffff;
spi1_init();
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_SEC_1, _SPI_PRESCALE_PRI_64,_SPI_SS_DISABLE,_SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
delay_ms(500);
if (Mmc_Init()==0)
{
portc=0x0000;
delay_ms(5000);
SPI1_Init_Advanced(_SPI_MASTER, _SPI_8_BIT, _SPI_PRESCALE_SEC_1, _SPI_PRESCALE_PRI_4,_SPI_SS_DISABLE,_SPI_DATA_SAMPLE_MIDDLE, _SPI_CLK_IDLE_HIGH, _SPI_ACTIVE_2_IDLE);
delay_ms(500);
}
else if (Mmc_Init()==1)
{
portc=0xff00;
delay_ms(1000);
}
while(1)
{}
}