2016-05-20 06:37 PM
I am trying to get the Clock Configuration of an STM32F302CB to work. We are using 16 MHz Oscillators.
With the STM32F4 I used the clock configuration tool to generate the system_stm32xxx.c file. Unfortunately, I did not find a version for the STM32F3. I would use the new HAL with the Cube tool but unfortunately we are using the IDE Tasking that is not supported by the tool (Would be great if Tasking would be supported in the future). When I configure the Clocks in Cube and generate the code for any supported IDE, I find a generated system_f30x.c file in the project folder, but this seems to be a template without my configured settings (e.g. HSE Value 16.000.000). Please let me know if there is any comfortable way to do the clock configuration with the STM32F3 (As with the F4). I then tried to configure the clocks manually. The code is attached. My problem is that a read of RCC_GetClocksFreq delivers the correct values: HCLK_Frequency = 72000000SYSCLK_Frequency = 72000000PCLK2_Frequency = 72000000PCLK1_Frequency = 36000000also: SystemCoreClock = 72000000But my segger debugger warns that the CPU is running at low speed, about 8 MHz (HSI? The oscillator works fine so this should not be the problem) Therefore, also FreeRTOS is not running properly (The Systick IRQ seems to be much too slow). And therefore the whole system is not working. Of course I have set the HSE_VALUE in the stm32f30x.h to 160000002016-05-23 09:49 AM
Hi ott.simon,
With CubeMX, you have just to set your clock source and expected output value then the calculation will be done by the tool.You may use the generated code with a given IDE in your own project (as you already did it).You can also output the HSE on the MCO pin to check if it is working as expected or not.If you debug your application and execute the clock configuration step by step, you will be able to monitor the RCC registers and flags to check if the HSE is really used.-Mayla-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.
2016-05-24 01:47 AM
Hi ott.simon,
Regarding your request to support Tasking in CubeMX: please note that there is no plan, at least in the nearest future.-Mayla-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.
2016-06-02 09:21 AM
Unfortunately, it does not work to configure the clock in STM32CubeMX, then generate the code for an arbitrary project.
I tried it for the stm32f407VG and the STM32F302CB. I set the RCC_OSC_IN and RCC_OSC_OUT Pin via RCC ant then HSE = Crystal Ceramic Oscillator and then configure the clock.I then generate the code for an arbitrary project and search for the system_stm32f4xx.c file respectively the system_stm32f3xx.c file in the project because I want to copy it into my own project. Unfortunately, the only files I find in the project are: Project_Name\Drivers\CMSIS\Device\ST\STM32F4xx\Source\Templates\system_stm32f4xx.cProject_Name\Drivers\CMSIS\Device\ST\STM32F3xx\Source\Templates\system_stm32f3xx.cThese files do not contain the changes I made in the clock configuration (Choosing HSE with 16 MHz, adjusting PLLs, setting PLL as source and so on). Where do I find the file with the correct clock configuration (With the changes made in the STM32CubeMX clock config tab) in the auto generated project folder? With the old Excel Clock Configuration Tool it was possible to just generate the system_stm32fxxx.c file. It would be helpful if this would be possible in STM32CubeMX too, as not all IDEs are supported for full automatic code generation.