cancel
Showing results for 
Search instead for 
Did you mean: 

Reset and hold counter value on low level

KMoge
Associate

Dear community

I am trying to make a timer/counter reset it's counter value on a falling edge and then hold the value until a rising edge (see attached ​picture for illustration). I am at the moment working on a L152, but I might soon be working on a L471 and F373 as well.

From reading the L152 manual, it seems that I can either have the reset (Slave mode: Reset mode) or the holding of the value (Slave mode: Gated mode), but is there a smart way to achieve both? The dream is that the described functionality is done by the hardware without use of an interrupt. But any suggestions are more than welcome!

Thanks in advance!

1 REPLY 1

Maybe you could use the gated mode together with triggering a DMA transfer from a fixed memory position into the timer's CNT, which would perform the zeroing.

JW