Skip to main content
kiilii
Visitor II
October 31, 2016
Question

F407 CubeMX 1.13.1FW, timer based tick error

  • October 31, 2016
  • 2 replies
  • 1305 views
Posted on October 31, 2016 at 04:19

I use CubeMX 4.17, F4xx firmware 1.13.1, created an automatically generated timer based hal tick funtion. I tested timer 6 and timer 10. BOTH results in tick running at 2000Hz(0.5ms per tick), but I think the correct state should be 1000Hz(1ms per tick)?

#timer #cubemx #f407
This topic has been closed for replies.

2 replies

Technical Moderator
November 18, 2016
Posted on November 18, 2016 at 14:32

Dear User,

Please note that your feedback is reported internally for checking.

We apologize for any inconvenience this may cause and thank you for your understanding.

Best Regards

STM32.forum

"When your question is answered, please close this topic by clicking ""Accept as Solution"".ThanksImen"
Graduate II
March 19, 2024

Hello

I have the same problem mentioned in the original post. I'm generating code for a NUCLEO-F429ZI board with the CubeIDE version 1.14.1. I've selected TIM6 for the timebase and I also see a tick every 0.5ms (should be 1ms).

In HAL_TIM_PeriodElapsedCallback I toggle a LED and watch the voltage on a scope.  Each half cycle is 0.5ms - so 2000 events per second.

Do we have an answer yet? The original question was in 2016.

Thanks,

Beep.

Graduate II
March 20, 2024

I'm now suspecting the HAL lib code doesn't take the setting of TIMPRESCALE into account and thus gets the output frequency of the timer wrong.

Jeanne Joly
Associate
November 21, 2016
Posted on November 21, 2016 at 14:28

Hello lee.kiilii,

The measuring os the Systick is done by toggling an IO in the timer IT.

When doing this, the signal period obtained in the scope is twice the systick frequency as a tick corresponds to a logical state (1 or 0) then to a half period. 

Please place the scope cursors on a half period and then read the frequency and tell me if it is OK.

On my side, the Systick is equal to 1 ms on the scope.

BR

Eric Dampierre.