2020-06-01 01:08 PM
Dear all,
i have a F412 and SDIO enabled (1Bit). Also, set the corresponding GPIOs to pullup in the GPIO settings. However, I do not see generated code to initialize these Pins at all (they are not showing up).
Tried removing them and adding again - no change.
Any advice?
Best regards
Stefan
2020-06-01 07:23 PM
Maybe you're not looking in the right place, or maybe there's a bug in CubeMX. Hard to tell. Share your IOC file.
2020-06-02 12:01 AM
hello @SSchu.4
Could you please check under stm32f4xx_hal_msp.c ?
Otherwise, please share your ioc file to check more the issue.
Best Regards,
Khouloud
2020-06-02 05:16 AM
So, I am still debugging.
Things I need some help to understand:
1)
I found the GPIO Init code in stm32f4xx_hal_msp.c
This is in a function HAL_SD_MspInit which is called from HAL_SD_Init which is never called.
The generated code never calls it:
static void MX_SDIO_SD_Init(void)
[...]
/* USER CODE END SDIO_Init 1 */
hsd.Instance = SDIO;
hsd.Init.ClockEdge = SDIO_CLOCK_EDGE_RISING;
hsd.Init.ClockBypass = SDIO_CLOCK_BYPASS_DISABLE;
hsd.Init.ClockPowerSave = SDIO_CLOCK_POWER_SAVE_DISABLE;
hsd.Init.BusWide = SDIO_BUS_WIDE_1B;
hsd.Init.HardwareFlowControl = SDIO_HARDWARE_FLOW_CONTROL_DISABLE;
hsd.Init.ClockDiv = 8;
/* USER CODE BEGIN SDIO_Init 2 */
/* USER CODE END SDIO_Init 2 */
}
I added the call manually, and the code ends with setting the state.
HAL_SD_STATE_READY in the hsd handle.
But when I call the SD card to create a file, i get FR_NOT_READY.
IOC File is attached.
Thanks for any hint.
2020-06-02 06:12 AM
Problem solved!
I called the code outside of RTOS task (before scheduler was running).
Calling it inside the task - all fine now!