cancel
Showing results for 
Search instead for 
Did you mean: 

Generate variable duty pulse immediately upon receiving external event.

SoftHard-dev
Associate

I need to generate a pulse which is activated high immediately by rising/falling input signal around 100Hz with varied width.  I have tried One Pulse Mode and Gated Mode on STM32f334R8T6 so far but none of them were successful. Even I tried on HRTIM, but I did not get how to generate a pulse with determined width after receiving an event.

The image below shows the problem. I appreciate any help in this regard.

 

1 REPLY 1

Hello, 

In case you are using the HRTIM, you can use the mode Single-shot.

In this mode the counter is started by a reset event and it stops when it reaches the period value set in the HRTIM_PERxR register.

The reset signal would be the input signal configured as an external event (you can choose the active polarity of this event, in your case: rising edge).

Then you configure the SET source for the output with Period, or with the reset signal configured as external event.

The RESET source of the output will be a Compare event configured with value x by SW (equivalent in term of fHRCK periods number).

 

Hope it helps, 

Best regards.