I am struggling to get the sd_card example working for the LAUNCHXL-F28379D. I purchased a MicroSD breakout board from adafruit (www.adafruit.com/.../254). I made the following connections:
CS->GPIO125, DI->GPIO122, DO->GPIO124, CLK->GPIO123
I believe these are the correct connections from looking at the mmc-F2837x.c file in the example project. I also tested the pins with a multimeter during debug and they appear to be working correctly.
Unfortunately, I cannot get the disk to initialize. Specifically, in the disk_intitialize function below, the send_cmd (highlighted in red) times out waiting for a response.
Does anyone have any insight into this problem? I know that the microsd is working and that the breakout board is at least partially working as the led lights up when toggling the CS.
DSTATUS disk_initialize(BYTE drv /* Physical drive nmuber (0) */)
{
BYTE n, ty, ocr[4];
if (drv) return STA_NOINIT; /* Supports only single drive */
if (Stat & STA_NODISK) return Stat; /* No card in the socket */
power_on(); /* Force socket power on */
send_initial_clock_train();
SELECT(); /* CS = L */
ty = 0;
if (send_cmd(CMD0, 0) == 1) /* Enter Idle state */
{
Timer1 = 100; /* Initialization timeout of 1000 msec */
if (send_cmd(CMD8, 0x1AA) == 1) /* SDC Ver2+ */
{
for (n = 0; n < 4; n++) ocr[n] = rcvr_spi();
if (ocr[2] == 0x01 && ocr[3] == 0xAA) /* The card can work at vdd range of 2.7-3.6V */
{
do
{
if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 1UL << 30) == 0) break; /* ACMD41 with HCS bit */
}
while (Timer1);
if (Timer1 && send_cmd(CMD58, 0) == 0) /* Check CCS bit */
{
for (n = 0; n < 4; n++) ocr[n] = rcvr_spi();
ty = (ocr[0] & 0x40) ? 6 : 2;
}
}
}
else /* SDC Ver1 or MMC */
{
ty = (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) <= 1) ? 2 : 1; /* SDC : MMC */
do
{
if (ty == 2)
{
if (send_cmd(CMD55, 0) <= 1 && send_cmd(CMD41, 0) == 0) break; /* ACMD41 */
}
else
{
if (send_cmd(CMD1, 0) == 0) break; /* CMD1 */
}
}
while (Timer1);
if (!Timer1 || send_cmd(CMD16, 512) != 0) /* Select R/W block length */
ty = 0;
}
}
CardType = ty;
DESELECT(); /* CS = H */
rcvr_spi(); /* Idle (Release DO) */
if (ty) /* Initialization succeded */
{
Stat &= ~STA_NOINIT; /* Clear STA_NOINIT */
set_max_speed();
}
else /* Initialization failed */
{
power_off();
}
return Stat;
}