2022-09-23 01:28 AM
I want to develop my own PCB using STM32F4. I want to use one external clock (16 MHz). I wonder where I have to connect the clock: OSCIN32-OSCOUT32 (pins 3 and 4) or OSCIN-OSCOUT (HSE) (pins 5 and 6 in STM32F446RET).
I can see in the development board's schematic how there is an empty footprint for X3 (pins 5 and 6) and I don't know if it is using the debugger's clock.
Thanks in advance.
2022-09-23 01:40 AM
Hello,
the OSC32 pins are for LSE (32kHz) oscillator, so in your case it is the second pair.
For more information about PCB design guidelines for oscillators refer to AN2867 (https://www.st.com/resource/en/application_note/cd00221665-oscillator-design-guide-for-stm8afals-stm32-mcus-and-mpus-stmicroelectronics.pdf).
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-09-23 03:15 AM
Ok, thank you. I did not know if it were necessary to add two capacitors even if you just want the HSE one. I was having some trouble trying to run code and I think it had to do with the oscillator.
2022-09-23 03:23 AM
The NUCLEO / DISCO boards typically source an 8 MHz crystal based source from the ST-LINK's MCO output.
Watch for solder bridges or zero ohm routing of signal.
HSE should use BYPASS mode for external clocks. Use OSCIN only. Check is source or TCXO expects capacitive loading.
2022-09-23 03:35 AM
In my PCB I use an external 16 MHz crystal oscillator connected directly to the OSCIN-OSC-OUT pins. The schematic includes two capacitors (value = 2 * (Cload - Cstray) = 26 pF). Do I need to set anything special (apart from basic clock configuration, input, freq, etc) in STMCubeIDE?
2022-09-23 05:02 AM
Regarding your schematics, I would definitely NOT recommend you those jumpers J2 or J3 - keep the tracks between MCU and the oscillator as short as possible to reduce capacitive and inductive effects. Otherwise the oscillations might be unstable.
Try to follow the application note...
In the CubeMX, just enable the HSE in RCC menu and configure the clocks on the "Clocks" tab accordingly (selecting the HSE, setting PLL/dividers etc.).
Jaroslav
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2022-09-23 06:18 AM
Also, the load capacitors C5 and C6 seem to be much too large, moreover, each crystal typically requires different capacitor values, especially if the crystal frequency differs greatly.
Please follow the mentioned AN2867 for the capacitors, also section 7 is very important because there is a lot of layout information. As Jaroslav said: make the tracks between crystal and STM32 as short as possible and also avoid vias.
Regards
/Peter
2022-09-23 12:47 PM
Cross-linking related https://community.st.com/s/question/0D53W00001pIaLwSAK/stm32f4-hardfaulthandler-haltimeout-errors