Hey there,
in my project I have an external 16 MHz crystal connected to my STM32F103CB. So I need to reconfigure my clock, by maintaining 72 MHz SYSCLK and 48 MHz for USB. I know that two things need to be done, change the HSE predivider, and adjust the value of HSE. In my case HSE/2, and HSE = 16000000.
I already changed the HSE predivider by redefining the WEAK SystemClock_Config(void) in my sketch (Sloeber Eclipse project) with RCC_OscInitStruct.HSEPredivValue = RCC_HSE_PREDIV_DIV2.
I saw that adjusting HSE can be done in stm32f1xx_hal_conf_default.h: #define HSE_VALUE 8000000U, but apart that it's inconvenient to change this value all the time (because only this project uses 16 MHz, other projects use 8 MHz from eval boards) I also guess that changing a value in a default file is not a proper way to do it.
For this project I also have two hardware configs, one eval board (8 MHz) and the final board (16 MHz), and I select the proper board per #define. But this #define isn't recognized in stm32f1xx_hal_conf_default.h. So each time I want to compile for my eval board of the final board, I have to change the HSE value.
I found out that copying the stm32f1xx_hal_conf_default.h into the project directory works, so at least this would be a solution to not change the default file, but I guess that's not proper, too. Also, the mentioned #define selection is not working either.
So, is there a way to change the HSE properly outside of the mentioned file?
Thanks and regards!
Setup external clock (HSE) at project level
Re: Setup external clock (HSE) at project level
With Arduino IDE you can define the HSE_VALUE using build_opt.h because value is under !#ifndef in the configuration default but this is not properly managed by Sloeber.
I guess you could add the define in your project configuration.
I guess you could add the define in your project configuration.
Re: Setup external clock (HSE) at project level
Hi,
I'm having the same problem. Did you figure it how to do it, tyllurius?
I'm having the same problem. Did you figure it how to do it, tyllurius?
Re: Setup external clock (HSE) at project level
Hi mwon,
sorry, saw your post only now...
No, I haven't figured it out, because as I read "...but this is not properly managed by Sloeber" I deferred from it, because it took me weeks to get Sloeber running properly with STM32 and I wanted to proceed with my project. But it's still on my list and I will reply as soon as I figure it out.
Have you figured it out?
sorry, saw your post only now...
No, I haven't figured it out, because as I read "...but this is not properly managed by Sloeber" I deferred from it, because it took me weeks to get Sloeber running properly with STM32 and I wanted to proceed with my project. But it's still on my list and I will reply as soon as I figure it out.
Have you figured it out?