2020-07-22 05:44 AM
I have found an old video
https://www.youtube.com/watch?v=0NbBem8U80Y
telling CubeMX 4.24 and 4.23 had a bug with SDIO, 4 bit mode, DMA.
It seems for them 4.21 worked.
I am using newest CubeMX 5.6.1. When was bug fixed? I assume it was fixed also in version 5.6.1?
I first started on a STM32F412, meanwhile on a Nucleo Evalboard with STM32F411,
but I can't seem to be able to access SD card. I see CLK line toggling. I see bits on CMD
(recorded with a logic analyzer)
but can't interpret them. I assume SD card is not answering at all, because makes
not much difference if card is in or not. It is a 32GB uSD.
I have no pullup. Do I need (external/internal) pull ups to get it working?
I want to work without interrupt, and also without DMA, to make it easier.
Is it possible? Is looks like I can't disable "Use dma template" in FatFS dialog.
I don't have a detect pin, just select no pin and ignore warning.
I can't switch power, 3.3V for uSD card is always on. Is this a problem?
Does someone have a working project with source code, so I can adapt, try out and compare? I can use STM32F411 and also STM32F412, but with first one I am more flexible.
I am using arm-gcc in WSL with latest Ubuntu.
Dont know if helpful, this is what I logged out:
[ 0.000][p][Task] sizeof(FATFS)=564
[ 0.000][p][Task] sizeof(FIL)=560
[ 0.000][p][Task] In f_open Pos 1
[ 0.000][p][Task] In f_open Pos 2
[ 0.000][p][Task] In find_volume Pos 1
[ 0.000][p][Task] In find_volume Pos 3
[ 0.000][p][Task] In find_volume Pos 4
[ 0.000][p][Task] In find_volume Pos 5
[ 0.000][p][Task] In disk_initialize
[ 0.000][p][Task] I am in SD_initialize
[ 0.000][p][Task] I am in SD_initialize Pos 2
[ 0.000][p][Task] I am in SD_initialize Pos 3
[ 0.000][p][Task] I am in BSP_SD_Init Pos 1
[ 0.000][p][Task] I am in BSP_SD_Init Pos 2
[ 0.000][p][Task] I am in HAL_SD_Init Pos 1
[ 0.000][p][Task] I am in HAL_SD_Init Pos 2
[ 0.000][p][Task] I am in HAL_SD_Init Pos 3
[ 0.000][p][Task] I am in HAL_SD_InitCard Pos 1
[ 0.000][p][Task] I am in HAL_SD_InitCard Pos 3
[ 0.000][p][Task] I am in HAL_SD_InitCard Pos 4
[ 0.000][p][Task] I am in SD_PowerON
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=00000000 CmdIndex=00000000 Response=00000000 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SDMMC_GetCmdError
[ 0.000][p][Task] I am in SDMMC_GetCmdError -> SDMMC_ERROR_NONE
[ 0.000][p][Task] I am in SD_PowerON Pos 2
[ 0.000][p][Task] I am in SDMMC_CmdOperCond
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=000001aa CmdIndex=00000008 Response=00000040 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SDMMC_CmdOperCond Pos 2
[ 0.000][p][Task] I am in SDMMC_GetCmdResp7 SystemCoreClock=72000000 count=45000000
[ 0.000][p][Task] I am in SDMMC_GetCmdResp7 -> SDMMC_ERROR_CMD_RSP_TIMEOUT
[ 0.000][p][Task] I am in SD_PowerON Pos 3
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=00000000 CmdIndex=00000000 Response=00000000 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SDMMC_GetCmdError
[ 0.000][p][Task] I am in SDMMC_GetCmdError -> SDMMC_ERROR_NONE
[ 0.000][p][Task] I am in SD_PowerON Pos 5
[ 0.000][p][Task] I am in SD_PowerON Pos 9
[ 0.000][p][Task] I am in SD_PowerON Pos 10
[ 0.000][p][Task] I am in SDMMC_CmdAppCommand
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=00000000 CmdIndex=00000037 Response=00000040 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SDMMC_CmdAppCommand Pos 2
[ 0.000][p][Task] I am in SDMMC_GetCmdResp1
[ 0.000][p][Task] I am in SDMMC_GetCmdResp1 -> SDMMC_ERROR_NONE
[ 0.000][p][Task] I am in SD_PowerON Pos 12
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=c1100000 CmdIndex=00000029 Response=00000040 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SD_PowerON Pos 14
[ 0.000][p][Task] I am in SD_PowerON Pos 15
[ 0.000][p][Task] I am in SD_PowerON Pos 16 validvoltage=0 count=0
[ 0.000][p][Task] I am in SD_PowerON Pos 10
[ 0.000][p][Task] I am in SDMMC_CmdAppCommand
[ 0.000][p][Task] I am in SDIO_SendCommand Argument=00000000 CmdIndex=00000037 Response=00000040 WaitForInterrupt=00000000 CPSM=00000400
[ 0.000][p][Task] I am in SDMMC_CmdAppCommand Pos 2
[ 0.000][p][Task] I am in SDMMC_GetCmdResp1
[ 0.000][p][Task] I am in SDMMC_GetCmdResp1 -> SDMMC_ERROR_CMD_RSP_TIMEOUT
[ 0.000][p][Task] I am in SD_PowerON Pos 11
[ 0.000][p][Task] I am in HAL_SD_InitCard Pos 5
[ 0.000][p][Task] I am in HAL_SD_Init Pos 4
[ 0.000][p][Task] I am in BSP_SD_Init Pos 5
[ 0.000][p][Task] I am in SD_initialize Pos 7
[ 0.000][p][Task] I am in SD_initialize Pos 16
[ 0.000][p][Task] In f_open Pos 12
[ 0.000][p][Task] In f_open Pos 13
[ 0.000][p][Task] After f_open fr=3
[ 0.000][p][Task] FatFS: before call f_close
[ 0.000][p][Task] FatFS: after call f_close
[ 0.000][p][Task] Test fat fs done
2020-07-22 06:20 AM
Generally the way the forums work, we only hear bad news. If I believed the forum I'd assume nothing with CubeMX worked properly.
Polled operation on the F4 should be viable. DMA should also be viable, needs 32-bit (4-byte) aligned buffers.
Should be several working examples for EVAL and DISCO boards in the CubeF4 repository, often in the Applications\FatFs directories for boards shipping with SD card sockets.
Pull-up of data/command pins at the socket is generally recommended. Lacking them I'd use the internal ones.