2019-11-27 02:23 AM
2019-11-27 02:40 AM
Hello, it looks like PA2 is not connected to any PWM timer.
You could programm a (software) PWM using interruptions and toggling up and down the GPIO
2019-11-27 02:53 AM
Can you provide examples?
Because i am a new guy!!
2019-11-27 03:05 AM
can you use another pin?(maybe PA4)
What software are you using for developing in your PC?
2019-11-27 03:20 AM
I am sorry , i can only use PA2 .
I use keil uVision5
2019-11-27 03:56 AM
do you use cubeMX for the configuration?
why you can only use PA2?
maybe pictures of your board or code would help
2019-11-27 04:13 AM
YES ,I use cubeMX for the configuration
but ,hardware is ready ,so i can't switch.
2019-11-27 04:19 AM
you can see the picture , now pwm out is PB1
but i want switch to PA2
2019-11-27 04:24 AM
there is no PWM functionality in PA2.
PWM functionality is a feature some specific pins have, (because they can be connected to the timmer pwm outputs).
If the pin you want to use doesnt have that access to the pwm timmer function you need to create your own pwm thing.
How to do it:
Select your timmer in cubeMX, start the timmer as compare and match interruption.
Inside the ISR(interruption function) of the timmer you just configured put some gpio_toggle function or counters.
The rest is just playing around with it
2019-11-27 04:44 AM
you can see the functionalities of the PB1 or PA2 pin if you leftclick on it.
PB1 has the Timmer channel 1 functionalities (like pwm and more)
PA2 is only linked with ADC, UART, and GPIO functionalities