cancel
Showing results for 
Search instead for 
Did you mean: 

BUG: STM32F446 timers on APB1 run faster than indicated in Cube and datasheet

andre239955_st
Associate II
Posted on February 21, 2018 at 09:23

Hi all,

We use the STM32F446 for a new project. We noticed that the clock for the timers on the APB1 is x4 instead of x2 when the APB1 prescaler is not equal to 1. 

In our test we have used a system clock of 168MHZ and APB1 prescaler /4 which gives 42MHz. Cube says that the APB1 timer clock is 84MHz but my output signals on the timers are twice as fast. We have checked the 42MHz on the other APB1 peripherals with UART5, there the timing is correct.

Please udate the reference manual and the Cube for this device.

And maybe also indicate that the USB peripheral for this device is like the F7 USB core...

Thanks,

André

8 REPLIES 8
andre239955_st
Associate II
Posted on February 21, 2018 at 15:42

Another bug detected: RCC_DCKCFGR_CK48MSEL define is not active for the STM32F446 inside the stm32f4xx.h file!

Posted on February 23, 2018 at 07:03

Please post more information: read out and post the content of RCC and timer registers' content, together with the expected and observed behaviour.

JW

Posted on February 23, 2018 at 08:38

Ok, here is some additional information.

Debugging has been done with TIM4 which is on APB1.

APB1 clock is mentioned by Cube MX to be 90MHz. Following the reference manual this should be right.

0690X000006042JQAQ.jpg

RCC configuration with this application:

0690X00000604HNQAY.jpg

In the picture above it can be seen that the bit CK48MSEL is present for this micro (second bug mentioned). I use the USB and it is working correctly which proves it.

Now for the clock multiplication for APB1.

Here are the registers of TIM4:

0690X00000604MkQAI.jpg

TIM4 CCR4 is set to 0x03A7 = 935. For the pulse length this would be 1/90E+06 x 936 = 10.4 micro seconds.

Measuring with a scope on the output gives HALF this time:

0690X00000604PiQAI.jpg

This means that the clock on the APB1 timers is not X2 but X4 the 45MHz.

Hope this is enough information.

Posted on February 23, 2018 at 09:06

And the period is 29.4us?

JW

Posted on February 23, 2018 at 09:14

You have DCKCFGR=0x0100'0000, i.e. TIMPRE set.

0690X00000609khQAA.png0690X00000609nGQAQ.png0690X00000609lSQAQ.png

This is not the default-after-reset setting, so you must have set that actively.

I don't Cube/CubeMX so I am not going to comment on that.

Jan

Posted on February 23, 2018 at 10:29

I don't use Cube either, I just used it to get the PLL values. 

Sorry I forgot about TIMPRE, the code is from a previous project which I made two years ago. I remember now having seen this X4 for TIMPRE.

The

RCC_DCKCFGR_CK48MSEL remark however is a real bug. I had to modify stm32f4xx.h to get the define acivated.

André

Posted on February 23, 2018 at 10:41

I had to modify stm32f4xx.h

You mean that from SPL?

JW

Posted on February 23, 2018 at 10:57

Yes, from the latest version available on the website from ST.

André