cancel
Showing results for 
Search instead for 
Did you mean: 

An error on AN4013 OPM Pulse Length Formula

Seng Tak Goh
Associate III
Posted on March 04, 2018 at 22:18

Spotted a small error on the Timer application note AN4013r6 (Cross Series Timer Overview), page 15.

Pulse Length of a One Pulse Mode is shown as: Pulse-Length = (ARR - CCRy)/(TIMx_CLK/(PSC + 1))..but by referring to the timing diagram in the Reference Manual (RM0090) of a MCU (STM32F407 for example), with my own experiment to confirm it to boot, that it should be Pulse-Length = (ARR - CCRy-1)/(TIMx_CLK/(PSC + 1)) instead.

I am not sure if there is another way to interpret or apply the equation..but it costs me some minutes to counter-check my config to find out because I started with the application note before digging further into the reference manual.

Please correct me if I am wrong.

I0690X00000609IEQAY.png

#an4013 #error #pwm #timer #stm32f4 #opm
3 REPLIES 3
Posted on March 05, 2018 at 01:03

Well spotted!

However, your formula needs proper bracketing

Pulse-Length = (ARR - (CCRy-1))/(TIMx_CLK/(PSC + 1))

or, it would be more appropriate to write

Pulse-Length = ((ARR + 1) - CCRy)/(TIMx_CLK/(PSC + 1))

as the raw reason is in that the 'pulse' lasts from CCRy to ARR *inclusive* (and the delay before that lasts from  0 to (CCR-1) inclusive).

Btw. that AN contains also Clive's 'favourite' errorneous calculation of the time between two consecutive captures... :)

JW

Seng Tak Goh
Associate III
Posted on March 05, 2018 at 08:24

Almost committed another mistake to the already wrong formula, thanks for pointing out!

Amel NASRI
ST Employee
Posted on March 06, 2018 at 13:37

Hi

Goh.Seng_Tak

‌ &

Waclawek.Jan

‌,

This error is confirmed. It is reported, and will be fixed in next version of the application note.

Thanks for bringing it to our attention.

-Amel

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.