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.

SD multiblock write problem.

I am using a SD card on my L138 and i have the thing working pretty well. It reads/writes a FAT32 filesystem and works with SDHC too and all but single block writes to SD cards are painfully slow. So i set out to implement the multiple block write.

First i have had problems with the L138 refusing to clock more than 1 block in to the card. I have set MMCNBLK to the number of blocks i wanted or to 0 for infinite blocks but it the fifo kept stopping to raise the data ready flag after 1 block. Then i tried to set the STRMTP bit inside the MMCCMD register to turn on this stream transfer mode thing. That finally made it clock out the full number of blocks i wanted and the card responded to the stop transfer command in the end without errors and was busy for about 10us afterwards but when i put the card back in the PC anything that was written using the multiple block write was left the same as it was before writing.It doesnt mater if i write 2 blocks of 32 blocks of data and i tried it with two different cards.

So does the stream write not include a CRC or something to make the card not want to write the data? Or am i missing a crucial step in the process?Oh and while im at it, is this the best way to check when to feed it more data, because the sd clock is being halted at times.

Here is the part of my write routine that does multi block write

....

if(count > 1)
{//Multi block operation
    mmcsd->MMCNBLK = count;
    /*
    if(type != CARDTYPE_MMC)
        rtn = sendCmd(mmcsd, MMCSD_CMD_APP, 0, 1);
    rtn = sendCmd(mmcsd, SD_CMD_APP_SET_WR_BLK_ERASE, count, 0);//Erase the area on the card
    */
    if(type == CARDTYPE_SDHC)
       rtn = sendCmd(mmcsd, 0x12800 | MMCSD_CMD_WRITE_MULT_BLOCK, in_block, 0);
    else
         rtn = sendCmd(mmcsd, 0x12800 | MMCSD_CMD_WRITE_MULT_BLOCK, in_block * MMCSD_DEFAULT_BLKLEN, 0);
    if (rtn != ERR_NO_ERROR)
         return (rtn);
               
    for (i = 0; i < 8 * count; i++)
   {
         while (!CHKBIT(mmcsd->MMCST0, DXRDY)) {}
      for (j = 0; j < 16; j++)
         mmcsd->MMCDXR = *src_buffer++;
   }
   rtn = sendCmd(mmcsd, MMCSD_CMD_STOP_TRANSMISSION, 0, 1);//End multiblock write
}
else

...