Hi, I got 4GB sandisk micro SD card to try. This is a part of benchmark test.
What's the quick way to do read/write?
What I did so far is enable SPI1 and SPI2 drivers with HalCoGen.
Call spi_Init() at startup.
and modified RM48 connectivity code like this
void SD_Init()
{
IOMM_UNLOCK();
/* Set muxing for MibSPI2 - Is this correct????? */
/*(int *) 0xFFFF1C84 = 0x01010102;
/* Lock pinmux registers */
IOMM_LOCK();
/* Initialize and enable the Flash Card. */
uint32_t i,r1;
/* Initialize SPI interface and enable Flash Card SPI mode. */
SPI_ssel (1);
SPI_hiSpeed (0);
/* Send SPI Command with card not selected at 400 KBit. */
for (i = 0; i < 16; i++) {
r1 = SPI_send (0xFF);
}
/* Reset the card, send CMD0. */
SPI_ssel (0);
r1 = mmc_command (GO_IDLE_STATE, 0);
for (i = 0; i < 100; i++) {
if (r1 == 0x01) {
break;
}
r1 = SPI_send (0xFF);
}
SPI_ssel (1);
if (r1 != 0x01) {
/* Failed to Reset Flash Card. */
return (0);
}
I got stuck at "Failed to Reset Flash card".
Any ideas?
-Young