2020-03-17 05:45 AM
Hello guys,
I got a "STM32F407-DISC1" board and if I configure the external oscillator, it goes into "error_handling:
RCC_OscInitStruct.OscillatorType = RCC_OSCILLATORTYPE_HSE;
RCC_OscInitStruct.HSEState = RCC_HSE_ON;
RCC_OscInitStruct.PLL.PLLState = RCC_PLL_ON;
RCC_OscInitStruct.PLL.PLLSource = RCC_PLLSOURCE_HSE;
RCC_OscInitStruct.PLL.PLLM = 8;
RCC_OscInitStruct.PLL.PLLN = 336;
RCC_OscInitStruct.PLL.PLLP = RCC_PLLP_DIV2;
RCC_OscInitStruct.PLL.PLLQ = 7;
if (HAL_RCC_OscConfig(&RCC_OscInitStruct) != HAL_OK)
{
Error_Handler();
}
Afterwards program stops and does not continue. What do I need to change in my code? or is it due to a hardware failure?
Cheers
2020-03-17 07:40 AM
Hello @JBlaz.1
Could you please share your ioc file ?
Thanks,
Khouloud
2020-03-17 01:03 PM
Hello @Khouloud ZEMMELI ,
I use platformio with HAL. Can you guide me to this file?
[env:disco_f407vg]
platform = ststm32
board = disco_f407vg
framework = arduino
Cheers
2020-03-17 01:32 PM
RCC_OscInitStruct.HSEState = RCC_HSE_BYPASS; // external clock source rather than crystal
Make sure the 8 MHz is present from ST-LINK, not sure if any jumpers or solder bridges involved.
Make sure HSE_VALUE define is 8000000
2020-03-17 07:52 PM
You can either use the MCO output from ST-Link like clive1 says, or you can use the HSE crystal. In either case, consult UM1472 for the jumpers/components that need fitted/removed.
• MCO from ST-LINK. From MCO of the STM32F103. This frequency cannot be
changed, it is fixed at 8 MHz and connected to PH0-OSC_IN of the STM32F407VG.
Configuration needed:
– SB13, SB14 OPEN
– R25(b) removed
– R68(b) soldered
• Oscillator on board. From X2 crystal. For typical frequencies and its capacitors and
resistors, refer to the STM32F407VG Datasheet at www.st.com. Configuration needed:
– SB13, SB14 OPEN
– R25(b) soldered
– R68(b) removed
2020-03-17 11:56 PM
also from the manual:
b) As the frequency supplied by X2 is the same as MCO (8 MHz), R25 and R68 are soldered.
So, I didnt change anything.
Nevertheless, I removed R68 now and the result is the same - goes straight into "Error_Handler"
2020-03-17 11:57 PM
Thanks for your input. I changed as you suggested but still goes into "Error_Handler()"
HSE_VALUE is already set to 8000000U
2020-03-18 01:18 AM
You have created a project from CubeMX , after the save, the CubeMX project is saved as .ioc file, you can share you project .zip
Best Regards,
Khouloud
2020-03-18 02:15 AM
I use platformio, where do I find the ioc file? Or can I provide the information from an alternate location?
regards
2020-03-19 04:19 PM
You have the HAL source code and a board with a debugger - step through the code and look for where and why it fails!