cancel
Showing results for 
Search instead for 
Did you mean: 

TIMx_RCR function description from STM32F103 to STM32L475 change in manual

Harish1
Associate III

Hi,

I found that TIMx_RCR functionality reversed w.r.t timer counter started from F103 to L475 as per the article. Here, I just want to know whether this bug is in the manual or is it reversed when comparing F103 to L475.

Please find below two screenshots from both manuals.

F103:

0693W00000StfVlQAJ.png 

L475:

0693W00000StfVqQAJ.png

18 REPLIES 18

I suspect the latter is more probable as the CNT is down-counting is the second half of the center-aligned mode, isn't it?

When in doubt, create some test cases and determine the exact behaviour to your own satisfaction.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

IMO this section is garbage in both versions. As RCR is unconditionally preloaded, writing it does nothing, and what happens after starting counter depends on current state of CNT and DIR.

I guess this sort of text is written by inexperienced staff using some "libraries", probably SPL in the first case and Cube in second, which could explain the difference.

Much of the narrative in TIM chapter is ridden by this crappy aproach.

JW

I agree. ST need to revise both the manuals with the correct solution.

I have tested in L475 and found that working like the description mentioned in the F103.

Vincent Onde
ST Employee

Hello,

I confirm that the correct description in the L475 one:

In Center aligned mode, for odd values of RCR, the update event occurs either on the overflow or on the underflow depending on when the RCR register was written and when the counter was launched: if the RCR was written before launching the counter, the UEV occurs on the underflow. If the RCR was written after launching the counter, the UEV occurs on the overflow.

The F103 RM needs to be corrected. We're sorry for this.

@Community member​ 

I confirm writing the RCR before or after starting the counter does modify the UEV position.

Best regards,

Vincent

Hi Vincent,

Thanks for the clarification.

> I confirm writing the RCR before or after starting the counter does modify the UEV position.

So, let's have TIM1 after reset, enable its clock in RCC, write ARR with some sane value, write CR1.CMS to nonzero, then write an odd value to RCR (ie. it's before enabling counter) and then write one into CR1.CEN to start counter. There was no reason to have UEV until this point, correct? So, you assert, that as RCR was written *before* starting counter (but it was not effectively transferred into the repetition counter as there was no UEV so far), the first UEV happens after timer counts up, then down and underflows, correct?

Jan

@Vincent Onde​ 

Here a simple program to try (for 'L476 Disco):

[salesforce accepted the code into the editor pane, but was so kind to throw an inexplicable "Maximum number of topic assignments have been exceeded." error upon attempting to post. Will try to append somehow below. #ditch_salesforce]

As expected, the order between writing RCR and setting CR1.CEN does not matter.

0693W00000UFN67QAH.pngWhat matters is order between RCR write and the next Update.

JW

The code

I didn't make it up:

0693W00000UFNEfQAP.png 

JW