Trying to replicate the functionality of the project example for FatFs_uSD_DMA_RTOS on the STM32H743I_Eval board using CubeMX I have run into the next layer of problems, this one involves the SDMMC clock. There is none!
In the project example from the repository STM32Cube_FW_H7_V1.2.0, I noticed the initialization for the SDMMC clock is missing and yet the example works. The PLL and bus clock dividers are setup but nothing is done for the peripheral clocks like what happens inside the CubeMX generated code.
So the question becomes what is the default state if no initialization is done for the peripheral clocks? In particular, what happens to the SDMMC clock mux if PeriphClkInitStruct.PeriphClockSelection = ...|RCC_PERIPHCLK_SDMMC|... does not occur and no source is set like:
PeriphClkInitStruct.SdmmcClockSelection = RCC_SDMMCCLKSOURCE_PLL2;
which I copied from the CubeMX code?
I read somewhere else on the forum regarding PPL2 cannot be driving more than two destinations so I changed:
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL2;
to be :
PeriphClkInitStruct.AdcClockSelection = RCC_ADCCLKSOURCE_PLL3;
and now the code in the low level driver (stm32h7xx_ll_sdmmc.c) where the SDMMC_SendCommand is called completes with the command sent bit set (SDMMC_STAR = 0x80 - IAR) and the clock pin of the sdmmc is showing activity. If both are set to PLL2 the SDMMC_SendCommand completes with the Hardware Status flag set meaning it is busy and the flag stays set. On the next command to get the error state the operation times out which does not happen if PLL3 is used for the ADC.
The trouble I have with this behavior is something that Clive pointed out in another thread which is that CubeMX is very unclear in two regards. 1) CubeMX allows the errant selection when it clearly does not work, 2) The ADC mux selection indicates that PLL2P output is used and SDMMC mux indicates PLL2R output is used which can be interpreted as the sources are not exactly shared. Or is there a typo in CubeMX and the ADC mux source is really PLL2R?
This all said the FatFs operations from the project example still do not work. So I am on to the next layer.
And yes I using the latest CubeMX V26