Skip to main content
KHarb.1
Senior
June 3, 2024
Solved

Can STM32 Timers be reset to non-zero values to generate 'signed' capture values?

I seem to remember a way to make a reset event set a timer’s value to a non-zero value. However, I didn’t see anything in the docs for the part I’m using so I’m not sure if this is a feature in STM32 parts. Is it?

An alternative is a DMA trigger on the reset that loads the CNT value. Is there a better way?

I have an in input capture value that represents a signed value. If a 16 bit timer resets to a value above 65535/2, input capture values within a known range can be sent away via DMA to the FMAC without processing steps to sort out the sign.

 

 

This topic has been closed for replies.
KHarb.1
KHarb.1Best answer
Senior
June 21, 2024

I don't think that accomplishes what I need. I'd need an auto-reload value and then a value other than zero to specify as the value to be reloaded.  Looks like DMA is the only way.

2 replies

Uwe Bonnes
Chief
June 6, 2024

Check "Downcounting mode" :

In downcounting mode, the counter counts from the auto-reload value (content of the
TIMx_ARR register) down to 0, then restarts from the auto-reload value and generates a
counter underflow event.

KHarb.1
KHarb.1AuthorBest answer
Senior
June 21, 2024

I don't think that accomplishes what I need. I'd need an auto-reload value and then a value other than zero to specify as the value to be reloaded.  Looks like DMA is the only way.