2022-11-03 08:04 AM
Hello,
I am planning to use the PWM feature in the timer (PWM Generation CH1). I want to send that PWM signal to an external device and am doing preliminary testing on the code. This PWM duty cycle changes based on the press of a button. I want to verify the signal but I do not have access to a oscilloscope at the moment. To get around this, my plan is to slow down the PWM (0.1 Hz signal) and create an LED tester. The function would be:
If PWM State = High: LED ON
If PWM State = Low: LED OFF
Then I can visually confirm the PWM signal via an LED visual.
The part I cannot find is a function that checks the state of the Timer PWM pulse. Is this possible?
If it is not, is there another way to verify the PWM signal without an oscilloscope or similar hardware?
EDIT:
For additional information, I am using an STM32H7B3I-EVAL evaluation board that has push buttons, LEDs and an LCD display.
2022-11-03 08:10 AM
To add upon this, I am using an STM32H7B3I-EVAL board, which has push buttons, LEDs and an LCD display
2022-11-03 08:25 AM
McGyver way: Select an LED and turn its io pin as input. Wire your pwm pin to drive the LED.
If your PWM reaches kHz and has more than 500 steps, you will affect the LED dimming. It will be non linear brightness, saturate quickly because the eye uses log transfer function. At least should be a crude way to check.
The io turned as input can be wired to EXTI block whic PR bit are set when edge is detected. In debug mode, stop the user code and manually check and clear the PR flags, is another way... if stopping the code is ok. (Drivi g a motor with PWM and putting a breakpoint might be explosive....)
Good luck and rent a scope.... not a logic analyser...
2022-11-03 09:23 AM
You not having access to an oscillocope is the real issue here,
you can find ugly but enoughish oscis for 20€ https://es.aliexpress.com/item/1005004643801011.html
>I want to verify the signal
Are you looking to build an external tester or to debug your code?