cancel
Showing results for 
Search instead for 
Did you mean: 

HSE Failed to start

arunease
Associate II
Posted on February 08, 2016 at 10:01

Hi,

i have connected a external clock on stm32f4 microcontroller but the hse is failled to startup the application code (the internal clock works perfectly though.)

6 REPLIES 6
pkumar1883
Associate II
Posted on February 08, 2016 at 10:52

Dear emb_begin,

First deinit your RCC then Config RCC(HSE Enable). In HSE enable follow the following--

1.Reset HSEON bit.

2.Reset HSEBYP bit

3.Enable HSE

/*Please

 mark helpfull

 if this post helps you or solves your problem.*/

/**disclaimer**/

/* I am not a person from ST Technical Support Team. So please verify/test any support/suggestion at your end.*/

/* This post is only for general support purpose and free of any charge.If you need any personal support for your work please contact at 

embeddeddesign.help@gmail.com

*/

 

arunease
Associate II
Posted on February 08, 2016 at 14:30

i have done it and it runs the application..

Now the usart output(send some string) on tera term is not working and i am getting a garbage values. The usart output works fine with the internal clock.
Posted on February 08, 2016 at 17:36

You should perhaps review the timeout period, and the design/characteristics of your circuit. Evaluate how long it takes to start over voltage/temperature.

For odd data output, make sure that HSE_VALUE reflects the speed of your chosen external clock.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
arunease
Associate II
Posted on February 11, 2016 at 14:17

thank you,clive. 

Posted on February 11, 2016 at 14:58

HSE_VALUE is a define, either passed in the compiler's command line via project settings, or within the stm32f4x_conf.h type file.

For an 8 MHz clock it needs to be 8000000, if you have a different crystal frequency it will need to reflect that. Your PLL settings also need to match your design, see system_stm32f4xx.c

The HSE_VALUE is used in computing clocks related to the baud rates settings, so if it is wrong, all you serial data with be garbled.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
tema tema
Associate
Posted on April 02, 2017 at 14:43

Hi.

Maybe it help you.

If you use STM32CubeMX it's bug of STM32Cube code generator. When you don't use HSI new code don't have full initialization RCC_OscInintStruct for HAL_RCC_OscConfig() in main.c of created project.

I put into stm32f4xx_hal_rcc.c at start of function HAL_RCC_OscConfig the following code:

----------------------------------------------------------------------------------------------------------------------------------------

__weak HAL_StatusTypeDef HAL_RCC_OscConfig(RCC_OscInitTypeDef *RCC_OscInitStruct)

{

if (RCC_OscInitStruct->HSIState != RCC_HSI_ON)

{RCC_OscInitStruct->HSIState = RCC_HSI_ON; RCC_OscInitStruct->HSICalibrationValue = 16;};

if (RCC_OscInitStruct->LSIState != RCC_LSI_ON) {RCC_OscInitStruct->LSIState = RCC_LSI_OFF;};

if ((RCC_OscInitStruct->LSEState != RCC_LSE_ON) ||\

(RCC_OscInitStruct->LSEState != RCC_LSE_OFF)||\

(RCC_OscInitStruct->LSEState != RCC_LSE_BYPASS))

{RCC_OscInitStruct->LSEState = RCC_LSE_OFF;};

uint32_t tickstart = 0U;

/* Check the parameters */

----------------------------------------------------------------------------------------------------------------------------------------

Thank you.