2024-05-15 1:08 AM - edited 2024-05-15 1:37 AM
Hello everyone,
I am configuring an STM32F401RE and its RTC on the STM32CubeIDE software
I've written an program that debug without errors. But ErrorHandler() is called during the RCC Oscillators initialization (during the "SystemClock_Config(void)" process).
I think i'have followed the steps and the right parameters, but would you have a clue of where could it be from ? Let me know if you need additional pictores of the system configuration of the .ioc file maybe
/** Initializes the RCC Oscillators according to the specified parameters
* in the RCC_OscInitTypeDef structure.
*/
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSI|RCC_OSCILLATORTYPE_LSE;
RCC_OscInitStruct.LSEState = RCC_LSE_ON;
RCC_OscInitStruct.HSIState = RCC_HSI_ON;
RCC_OscInitStruct.HSICalibrationValue = RCC_HSICALIBRATION_DEFAULT;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSI;
RCC_OscInitStruct.PLL.PLLM = 16;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV4;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler(); //the call of ErrorHandler() happens here
}
Solved! Go to Solution.
2024-05-15 2:32 AM
Hello @willow ,
Thank you for sharing the file.
I didn't reproduce the behavior with NUCLEO-F401 board. Could you confirm you're using that board?
Also did you modify something on it? especially LSE part of the board?
2024-05-15 2:03 AM
Hello @willow and welcome to the community,
Could you please share your ioc file?
2024-05-15 2:14 AM
Of course @mƎALLEm and thank you for your answer, here is my .ioc file attached
2024-05-15 2:21 AM
Another Top Tip - for debugging:
The return values from functions like HAL_RCC_OscConfig() are there to tell you what went wrong - so make sure you have some way to see what was returned.
eg, instead of just
if( HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK )
{
Error_Handler(); //the call of ErrorHandler() happens here
}
do:
HAL_StatusTypeDef HAL_result; // Have a variable to catch the result
HAL_result = HAL_RCC_OscConfig(&RCC_OscInitStruct); // Catch the result
if( HAL_result != HAL_OK )
{
// Now you can put a breakpoint here,
// and see what is in HAL_result
Error_Handler(); //the call of ErrorHandler() happens here
}
2024-05-15 2:32 AM
Hello @willow ,
Thank you for sharing the file.
I didn't reproduce the behavior with NUCLEO-F401 board. Could you confirm you're using that board?
Also did you modify something on it? especially LSE part of the board?
2024-05-15 2:38 AM
2024-05-15 2:46 AM
Check especially that part of the board:
2024-05-15 5:26 AM
Yes in deed, im using the NUCLEO F401RE ! No i didnt modify the hardware
2024-05-15 5:27 AM
it has previous user and uses but always for my project purpose
2024-05-15 5:28 AM
im gonna try do that and ill update you what it shows, thank you very much