Question
STM32f4-Discovery SDIO problems
Posted on July 12, 2012 at 13:52
Hi, I have been trying to get SDIO to work on an STM32f4-Discovery board using the std-periph library and the mass storage class example from the USB device library. I was able to get SDIO+FatFs+USB to work but it works very unreliably. I have found a couple of bugs in the library code like the
SD_LowLevel_DMA_TxConfig
(..) andSD_LowLevel_DMA_RxConfig
(..) functions ignoring the Buffersize argument and setting it to 0. Also the usage of the SD card driver (stm324xg_eval_sdio_sd.c
) is asStatus = SD_WriteMultiBlocks(buffer, address, 512, NUMBEROFBLOCKS);
Status = SD_WaitWriteOperation(); while(SD_GetStatus() != SD_TRANSFER_OK); There seems to be no error checking here, for which I am doing something like: again: Status=SD_WriteMultiBlocks ((uint8_t *)(&buf[0]), blk_addr, 512, blk_len); if(Status!=SD_OK) { SD_StopTransfer(); return -1; } Status = SD_WaitWriteOperation(); if(Status!=SD_OK) { SD_StopTransfer(); goto again; } do { state=SD_GetStatus(); if(state==SD_TRANSFER_ERROR) { SD_StopTransfer(); goto again; } }while(state!=SD_TRANSFER_OK); I am still getting a few errors at random times, like read and/or write error while copying a large file using USB. What might be the problem? I have also tried lowering the clock speed. #stm32f4 #usb #sdio #microsd