How to set OUTPUT_OPEN_DRAIN with HardwareTimer?
Posted: Fri Jul 07, 2023 11:40 am
Hi, I have searched for hours but could not find a solution to this issue.
I am using a STM32F103 board (blue pill) and I need to output a few channels of 5V PWM signals. I have learned to use the HardwareTimer library to output PWM signals, but they are only 3.3V. I have read on other posts that this can be achieved by setting the pinmode to OUTPUT_OPEN_DRAIN and using additional pull-up resistors. But since the pin configuration is handled by the HardwareTimer library, I could not find a way to set pinmode myself.
The only walkaround I can find so far is to use "software PWM" instead of hardware PWM, as shown in this example:
https://github.com/stm32duino/STM32Exam ... ration.ino
But it does not seem to be the best solution...
Any suggestions? Many thanks!!
I am using a STM32F103 board (blue pill) and I need to output a few channels of 5V PWM signals. I have learned to use the HardwareTimer library to output PWM signals, but they are only 3.3V. I have read on other posts that this can be achieved by setting the pinmode to OUTPUT_OPEN_DRAIN and using additional pull-up resistors. But since the pin configuration is handled by the HardwareTimer library, I could not find a way to set pinmode myself.
The only walkaround I can find so far is to use "software PWM" instead of hardware PWM, as shown in this example:
https://github.com/stm32duino/STM32Exam ... ration.ino
But it does not seem to be the best solution...
Any suggestions? Many thanks!!