cancel
Showing results for 
Search instead for 
Did you mean: 

Code Generator not generating Code on GPIOs for SDIO?

SSchu.4
Associate II

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

4 REPLIES 4
TDK
Guru

Maybe you're not looking in the right place, or maybe there's a bug in CubeMX. Hard to tell. Share your IOC file.

If you feel a post has answered your question, please click "Accept as Solution".
Khouloud ZEMMELI
ST Employee

​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

SSchu.4
Associate II

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.

SSchu.4
Associate II

Problem solved!

I called the code outside of RTOS task (before scheduler was running).

Calling it inside the task - all fine now!