AnsweredAssumed Answered

Bug in HAL_SD_WideBusOperation_Config: ClockDiv gets overwritten

Question asked by hartung.robert on Aug 18, 2015
Latest reply on Jan 27, 2016 by Nesrine M

I am using generated code from CubeMX. Here you can specify the clock divider.:

The generated code looks like this:

void MX_SDIO_SD_Init(void){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 = 4;HAL_SD_Init(&hsd, &SDCardInfo);HAL_SD_WideBusOperation_Config(&hsd, SDIO_BUS_WIDE_4B);}

The problem is the WideBusConfiguration function which looks like this:

Init.ClockDiv            = SDIO_TRANSFER_CLK_DIV;                /* Configure SDIO peripheral interface */        SDIO_Init(hsd->Instance, Init);

It overwrites the clock divider field and thus the configuration will never be used. Thus I cannot use a different clock divider than "0" which results in (0+2) and is equal to 48MHz/2 = 24MHz that is hardly the specification limit.

- Robert