cancel
Showing results for 
Search instead for 
Did you mean: 

stm32 pwm signal

GCocc.1
Associate II

Hi guys,

I would like to know how can I read PWM (duty cycle) generated from stm32?

And how I can read Pwm generated from 1 stm32 send to another stm32?

Sorry my bad english

Ty

7 REPLIES 7
Peter BENSCH
ST Employee

Essentially the same question as this one, which @Imen DAHMEN​ has already answered.

Regards

/Peter

In order 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.

You can look at the registers PSC, ARR and CCR1 to determine the frequency and duty cycle being generated.

You can use an Input Capture mode to measure period and duty, basically allowing one edge to clear the timer count, and latch the prior value, and other edge to latch the count relative to the starting point.

Basically a TIM and two channels, from one pin, for each PWM signal you want to measure.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..
MasterT
Lead

You can get an examples if install Stm32CubeMX. Somethings like TIM_PWMInput - depends on a board/ uCPU

GCocc.1
Associate II

Ok ty all but I don't understand how I can send Pwm signal to another stm32?

I need to link the PWM pin (from the first STM32) to what pin of the other stm32?

MasterT
Lead

Pin number depends on a model. What kind of board do you have?

GCocc.1
Associate II

I have NUCLEO-H7A3ZI-Q

MasterT
Lead

Unfortunately, there is no such example for H7A3ZI. But you can study a code for H743ZI,

https://github.com/STMicroelectronics/STM32CubeH7/tree/master/Projects/NUCLEO-H743ZI/Examples/TIM/TIM_InputCapture

I'm not sure if pins match between this two uCPU. I'd recommend to download Stm32CubeMX and generate C code for H7A3ZI yourself