2022-09-03 01:51 AM
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
2022-09-03 06:04 AM
Essentially the same question as this one, which @Imen DAHMEN has already answered.
Regards
/Peter
2022-09-03 06:25 AM
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.
2022-09-03 09:19 AM
You can get an examples if install Stm32CubeMX. Somethings like TIM_PWMInput - depends on a board/ uCPU
2022-09-03 09:31 AM
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?
2022-09-03 09:52 AM
Pin number depends on a model. What kind of board do you have?
2022-09-03 10:16 AM
I have NUCLEO-H7A3ZI-Q
2022-09-03 10:31 AM
Unfortunately, there is no such example for H7A3ZI. But you can study a code for H743ZI,
I'm not sure if pins match between this two uCPU. I'd recommend to download Stm32CubeMX and generate C code for H7A3ZI yourself