In the HAL_RCC_DeInit function, switching the SYSCLK to MSI only uses this function CLEAR_BIT(RCC->CFGR, RCC_CFG_SW). But, to select MSI as system clock source, I think that it is required to use after that the following instruction SET_BIT(RCC->CFGR, RCC_CFGR_SW_MSI). Please, can you verify if there are some problems in the function HAL_RCC_DeInit?
Many thanks for your time and look forward for your response.
Wassim Ben Chikha