AnsweredAssumed Answered

FatFs/SDIO on STM32L1xx

Question asked by eds on Feb 28, 2015
Latest reply on Mar 5, 2015 by eds

I am having problems with the SDIO interface on STM32L1 series of processors.

The SDIO option is available on the STM32L152D-EVAL, but the price of this board is rather high, so I am working with a modified Nucleo board. The SDIO option is not available on the Nucleo board (Nucleo-L152RE), however, I replaced the stock STM32L152RE with STM32L151RD which has an SDIO. I wired the SD card the same way as it is wired in L152D-EVAL, modified the sample IAR project with FatFS example for STM32L152D-EVAL to change the target (the project is attached) and ran the code.

The interface “sort of” works. My code will attempt 10000 writes, each 512 bytes, to the card, but will crash anywhere between 1 and 5000 writes. It always crashes with error code FR_DISK_ERR that is thrown by ABORT in fs_write:

#if _FS_TINY

          if (fp->fptr >= fp->fsize) {               /* Avoid silly cache filling at growing edge */
         
if (sync_window(fp->fs)) ABORT(fp->fs, FR_DISK_ERR);
         
fp->fs->winsect = sect;

                                             }

#else

          if (fp->dsect != sect) {                     /* Fill sector cache with file data */

          if (fp->fptr < fp->fsize &&disk_read(fp->fs->drv, fp->buf.d8, sect, 1))
                  ABORT(fp->fs, FR_DISK_ERR);

                                             }

#endif

The results is that the file is created and will have several lines written, but never the full 10000 lines.

In addition, 4-bit SDIO refuses to work on any card (tried 5 different cards 1Gb – 8Gb). To see if my soldering skills are to blame, I made another L151RD board and the behavior is identical. Any pointers on getting the SDIO to work properly, complete the writes and work with the 4-bit interface? Am I missing something obvious?




20150227_165355.jpg
20150227_165325.jpg

Attachments

Outcomes