2023-09-09 04:17 PM
I have a stm32g031k8 board. I was trying to give a pwm input signal like a square wave, measuring the frequency and duty cycle and generate pwm signal of that frequency and duty cycle using another timer. I was also changing the frequency and duty cycle of the input signal on the fly and it should change the output signal instantly. I was unable to do it. I was able to measure the frequency but nothing works. Please help me with the procedure. Thank You.
2023-09-09 04:30 PM
What Frequency are you attempting to measure.
Should use the PWM Input modes, when CH1 captures period and CH2 the duty. Look for examples using the various boards that come in the CubeG0 package. Perhaps also review the TIM Cook Book
2023-09-11 07:12 AM
Hello @ritayandhara10,
You can refer to the TIM_PWMInput example to measure the duty cycle, period
Since you're changing those parameters, you may want to use interrupts to capture the input signal edge and update PWM output signal
To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
2023-09-15 02:23 PM
I am giving an input frequency of 10 khz to like 500khz. I was using the timer 1 channel 1 for capturing the rising edge and channel 2 for capturing the falling edges. Then using the timer 2 I was trying to generate a PWM signal
2023-09-15 02:24 PM
I am giving an input frequency of 10 khz to like 500khz. I was using the timer 1 channel 1 for capturing the rising edge and channel 2 for capturing the falling edges. Then using the timer 2 I was trying to generate a PWM signal.