cancel
Showing results for 
Search instead for 
Did you mean: 

STM32F303CB is missing peripherals definitions in the HAL and LL drivers

SThom.7
Associate II

I am using an STM32F303CB with HAL/LL version 1.10.0

It seems that TIM2 is not available in the drivers for this part as RCC_CFGR3_TIM2SW is not defined.

Is this a fault with the driver library or a configuration from Cube?

Thanks

1 ACCEPTED SOLUTION

Accepted Solutions

Check the configuration of TIM2 in STM32CubeMX.

Choose the TIM2 from the list. See if "Clock Source" is set in the "Mode" part of the GUI. Most likely you want it to be set as "Internal Clock".

Go to "NVIC Settings" tab in the "Configuration" part of the GUI to enable the TIM2 "global" interrupt.

View solution in original post

4 REPLIES 4

From the RM0316 reference manual:

9.4.13 Clock configuration register 3 (RCC_CFGR3)

...

Bit 24 TIM2SW:

...

Note: STM32F303xDxE and STM32F398xE only.

Thanks, I missed that note in the datasheet. So the STM32F303CB definitely does have a TIM2 peripheral. Enabling Timer 1 and 2 from Cube creates the following inconsistencies:

TIM1 is setup correctly. The clock source for TIM2 is not enabled by default, I had to use the macro __HAL_RCC_TIM2_CLK_ENABLE instead. The NVIC interrupt was also not enabled, where TIM1 was.

Is this intended due to the different clock source configurations of TIM2?

Check the configuration of TIM2 in STM32CubeMX.

Choose the TIM2 from the list. See if "Clock Source" is set in the "Mode" part of the GUI. Most likely you want it to be set as "Internal Clock".

Go to "NVIC Settings" tab in the "Configuration" part of the GUI to enable the TIM2 "global" interrupt.

I see now, apologies for the confusion. Thanks