Skip to main content
Graduate
September 2, 2024
Solved

Undocumented behavior of capture/compare registers

  • September 2, 2024
  • 4 replies
  • 1405 views

Hello,

I tried to set a capture/compare register to a value beyond that of the auto-reload register, and the timer I used (TIM8) behaved as if the value had not been written. Reading back gives the expected value though. I haven't dug more but I'm curious : is there some undocumented behavior that prevents the shadow capture/compare register from having the value of the preload register if that value is higher than the auto-reload register ?

Please don't ask why I would do such a thing, that's just not the point.

Thanks.

    This topic has been closed for replies.
    Best answer by waclawek.jan

    > The expected behavior is to never have a compare event such as an interrupt

    That's an incorrect expectation.

    waclawekjan_0-1725354610922.png

     

    JW

     

    4 replies

    Graduate II
    September 2, 2024

    It doesn't sanity check the content, they are just registers, there might be a comparator or equivalence signal, but I'm pretty sure it doesn't limit the setting, but rather drives an output used elsewhere in the TIM implementation

    Some one would need to dig into the RTL to determine specific implementation detail.

    @STOne-32  

    Super User
    September 2, 2024

    What is the behaviour to expect, and how is the observed one different from it? 

    JW

    rbraunAuthor
    Graduate
    September 3, 2024

    Right, my bad.

    The expected behavior is to never have a compare event such as an interrupt, since the value of the counter can never become equal to that of the C/C register. What I observe is that I do get interrupts, and the value of the counter is barely above zero, which is the previous value of the C/C register, as if the new value was somewhat ignored.

    Graduate II
    September 3, 2024

     

    BarryWhit_0-1725335737720.jpeg

    ?

    Super User
    September 3, 2024

    > The expected behavior is to never have a compare event such as an interrupt

    That's an incorrect expectation.

    waclawekjan_0-1725354610922.png

     

    JW

     

    rbraunAuthor
    Graduate
    September 3, 2024

    Thank you very much.