cancel
Showing results for 
Search instead for 
Did you mean: 

Hi I need to generate a one pulse mode, but I need to trigger PWM inside software by writing code not by trigger a pin in CPU.. How could I do it ? which register should be 1 ?

Hamid1
Associate II

I mean, I setup TIM1 CH1 as output PWM, One pulse mode, but I need to trigger it by my codes

for example which register should be set to high or low to generate a pulse on TIM1 CH1

This discussion is locked. Please start a new topic to ask your question.
1 ACCEPTED SOLUTION

Accepted Solutions
waclawek.jan
Super User

You don't need any "trigger source" if you want to start the timer by software.

"Trigger" there means an input which, through hardware and the slave-mode controller (see TIMx_SMCR) enables the same TIMx_CR1.CEN bit.

https://community.st.com/s/question/0D53W00000ZWPHkSAP/generate-single-pulse-using-timer-using-hal-cubemx is a post of somebody who had a similar problem recently.

JW

View solution in original post

6 REPLIES 6
waclawek.jan
Super User

TIM1->CR1 |= TIM_CR1_CEN;

JW

Hamid1
Associate II

Thanks Waclawek.. so that, which is trigger source ? which trigger source I should select in config ?

Hamid1
Associate II

is it right ?

Trigger source : ITR0

waclawek.jan
Super User

You don't need any "trigger source" if you want to start the timer by software.

"Trigger" there means an input which, through hardware and the slave-mode controller (see TIMx_SMCR) enables the same TIMx_CR1.CEN bit.

https://community.st.com/s/question/0D53W00000ZWPHkSAP/generate-single-pulse-using-timer-using-hal-cubemx is a post of somebody who had a similar problem recently.

JW

Thanks, I will try it and hope to reach it:grinning_face:

Dear Jan

It is working now,.. thank you