2018-07-09 04:10 PM
I am comparing an application project for stm32H7 with a project created from CubeMX that is meant to replicate the application project function. The CubeMX project fails to run and I suspect a problem with the setup and initialization. Comparing the SystemClock_Config function in main from CubeMX with the application project matching function I see a minor difference which when I try to correct the CubeMX code throws the execution into the _Error_Handler which points to a failure of the HAL_RCC_OscConfig() function.
The error was caused after I commented out the CubeMX code and lines 249 and 253 and entered the code at lines 248 and 250 which match with the application code. The other PLL values being set also do not match with the application but I do not think this relevant (correct me if I am wrong).
I do not understand why the system is picky about the HSI_OFF and CSI_OFF settings when they are not being used to drive anything anyway.
2018-07-09 04:48 PM
I'd definitely recommend clearing these structures.
I don't think the code is smart enough to know if you enable/disable things, you set a bit flag saying you want it to touch HSI and HSE, and it copies several fields together and writes them to a register. Some things it range checks and generates an error, but don't assume it catches everything, or that the stack is clean.