Skip to main content
Harish1
Associate III
August 24, 2022
Question

TIMx_RCR function description from STM32F103 to STM32L475 change in manual

  • August 24, 2022
  • 18 replies
  • 10918 views

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

This topic has been closed for replies.

18 replies

Vincent Onde
ST Employee
October 10, 2022

Hi Jan,

Sorry... I've corrected the snippets (and indeed there's no need to RMW the EGR register).

Thanks and best regards,

Vincent

@Community member​ 

waclawek.jan
Super User
October 10, 2022

Hi Vincent,

thanks for the clarification.

Can you please try this sequence:

 TIM1->EGR = TIM_EGR_UG;

// insert delay ensuring that the update indeed happens before the RCR write

// as it's a known issue that the update may take time

// and that may cause additional confusion

 TIM1->RCR = 1;

 TIM1->CR1 |= TIM_CR1_CEN;

In short, IMO, you should remove the section talking about relationship between TIM start and position of updates from the RM entirely.

Jan

@Vincent Onde​ 

Vincent Onde
ST Employee
October 12, 2022

Hi Jan,

I've tested your sequence, and indeed 1 DMB instruction delay is needed to have the correct result. This is why I prefer to start the counter first to let some time for the update to happen.

Anyway, we'll follow your recommendation and better document this, with diagram and timings. And a snippet on top (even if I understand this is not your preferred way :), some customers do prefer).

Best regards,

Vincent

@Community member​ 

waclawek.jan
Super User
October 10, 2022

One more thing.

> also adding some pseudo code to make it clearer.

I'm not sure. I personally prefer schematics and diagrams, as code IMO often badly reflects timing-related issues (and indeed timing is one of the crucial problems of microcontroller programming). So, I'd suggest to copy the correct narrative from description of TIMx_RCR register, and add one or several timing diagrams such as those which are throughout the whole TIM chapter before the Repetition counter subchapter, except this time showing the varying content of both TIMx_RCR and the internal RCR_CNT, plus the events around them.

JW

waclawek.jan
Super User
October 12, 2022

Thanks, Vincent, for having a look at this and commenting.

Jan

@Vincent Onde​