AnsweredAssumed Answered

SD Card failing 'disk_initialize' in standalone mode

Question asked by Eric P on Aug 11, 2017
Latest reply on Aug 11, 2017 by Eric P

I have an ST STM32F405 microprocessor. I generated my IAR Embedded Workbench 7.4 files using STM32 Cube software.  I'm trying to use the SD card resources to access a micro SD card on our custom board. When I use the debugger in IAR it can access the SD card and the data files on-board no problem. However, as soon as I disconnect the debugger and run in standalone mode, I can't access the SD card. I have traced it to a failure of function disk_initialize in the diskio.c file. When it runs the command:


stat = disk.drv[pdrv]->disk_initialize(disk.lun[pdrv]);


I get a value of 0 when it succeeds and the debugger is attached. But a value of 1 when running in standalone mode.


I read online that perhaps the SDIOCLK divide factor should be changed from 1 to 4 <= but I did that and it did not help.  I'm not sure what else to check.


How can I debug this?