cancel
Showing results for 
Search instead for 
Did you mean: 

STM32H723 Setting TIMx counter to specified value on rising edge of an input pin

P3terF
Associate

Hello all,

I am using STM32H723 MCU and need to set TIMx Counter (TIMx_CNT) to a specified value different than 0 on rising edge of external input pin - TI1 or TIMx_ETR. From the MCU reference manual (RM0468 Rev 3) I understand, the TIMx Counter (TIMx_CNT) is initialized to 0 if the trigger condition is detected:

0693W00000UnTqTQAV.png 

Is there a way to specify the value (different than 0) which is automatically set to TIMx_CNT register when the trigger condition is detected by Timer module? I know SW solution will work, but I need to avoid any delays caused by interrupts processing.

Thank you for your help,

Peter

3 REPLIES 3

This is an unusual requests and thus the logical question is: why would you want that? Isn't there a different and better way to accomplish your goal?

You can pull it off by using the input as DMA trigger in some way, where DMA would write the required value to TIMx_CNT.

JW

P3terF
Associate

Hello @Community member​,

Thank you for your reply. DMA looks like solution but I have some concerns about time needed to transfer the value to TIMx_CNT by DMA.

The MCU is controlled from master device and receives the rising edge as a request to start counting from the specified value and generate appropriate PWM signal. The rising edge defines a point when the PWM needs to be shifted.

Regards,

Peter

Why can't you set TIMx_CNT beforehand, and then start the counter using Trigger mode in the Slave-mode controller?

JW