This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Timeout writing SD Card after repeating

I'm stuck with my SD design. 
When i'm writing a single block/sector, no problem. 
Or when i'm writing multiple block /sectors with the multiple_block_write command, no problem. 

But when I repeat the command every single time (bursting a lot of data) i have a timeout on checking the 'DRRDY' bit.
With the single_block i get around 50 blocks a error

example: 
write_mult_block (xx blocks) => No error
Write_mult_block  (xx blocks) => error
write_mult_block  (xx blocks  ) => no error

But when i do this: 
- write (80 blocks) => No error
- printf()
- write (80 blocks) => No error

My  code: 
[/code]
//=====================================================================================================
uint32_t MMCSD_writeBlock(unsigned int baseAddr, uint32_t in_block, uint32_t count,  uint32_t *src_buffer)
{
uint32_t rtn;
	uint32_t i, j, cnt, s;

//printf("MMCSD_writeBlock %d %x\n", in_block, src_buffer);

//USTIMER_delay(1000);

// reset fifo and config for transmit.
SETBIT(baseAddr + MMCSD_MMCFIFOCTL, FIFORST);
USTIMER_delay(100);
SETBIT(baseAddr + MMCSD_MMCFIFOCTL, FIFODIR);


// Tell the controller how much to expect
HWREG(baseAddr + MMCSD_MMCNBLK) = count;



for (j = 0; j < 8; j++)
HWREG(baseAddr + MMCSD_MMCDXR) = *src_buffer++;



if (count == 1) {
rtn = sendCmd(baseAddr, DMATRIG| WDATX | DTRW | MMCSD_CMD_WRITE_SINGLE_BLOCK, in_block * MMCSD_DEFAULT_BLKLEN, 0); //
}
else {
rtn = sendCmd(baseAddr, DMATRIG| WDATX | DTRW | MMCSD_CMD_WRITE_MULT_BLOCK, in_block * MMCSD_DEFAULT_BLKLEN, 0);
}

if (rtn != ERR_NO_ERROR){
printf("command timeout on sector: %d\n", in_block);
return (rtn);
}


for (s = 0; s < count; ++s) {

// write the data to the fifo.
for (i = 0; i < 16; i++)
{
cnt = 0;

// wait for transmit buffer to be ready.
while (!CHKBIT(baseAddr + MMCSD_MMCST0, DXRDY))
{
if (cnt++ > RW_TIMEOUT)
{
// timed out waiting for data.
printf("timeout transmit buffer ready@ sector: %d , count: %d, s: %d \n", in_block, count, s);
return (ERR_TIMEOUT);
}
}

// copy data to fifo.
for (j = 0; j < 8; j++)
HWREG(baseAddr + MMCSD_MMCDXR) = *src_buffer++;
}

}

// confirm the data transfer is complete.
cnt = 0;
while (!CHKBIT(baseAddr + MMCSD_MMCST0, DATDNE))
{
if (cnt++ > RW_TIMEOUT)
{
// timed out waiting for data.
printf("timeout confirm the data transfer @ sector: %d , count: %d \n", in_block, count);
return (ERR_TIMEOUT);
}
}

if (count > 1) {
rtn = sendCmd(baseAddr, MMCSD_CMD_STOP_TRANSMISSION, 0, 0);
if (rtn != ERR_NO_ERROR)
USTIMER_delay(20);
return (rtn);
}



return (ERR_NO_ERROR);
}

[/code]
//=====================================================================================================

What do i miss? 
I'm not using any interrupt, and it is in CPU modus, no DMA
Its on a TMS320c6748 (Developboard & custom design board)
regards,

Pieter