Updated question, How to set PA15 to GPIO Output, and PWM questions...
Posted: Tue Oct 13, 2020 2:51 pm
updated question heres there more detailed problem please reread...
Hi
I have 5 LEDs.
The leds are attached to
PA1 PA11 PA15 PB4 and PB5.
Ive picked these pins as

says these pins are PWM driven.
I need pwm control on these leds as ground sinks...
PA15 and PB4 are normally reserved for JTAG. But im not using JTAG, however i am using SWD Stlink for programming.
Bellow Mr Burnette mentioned linked me to that forum post to use
disableDebugPorts();
enableDebugPorts();
But this doesnt work and kills SWD for programming. Ive had to hotwire a reset line to the reset pin (this isnt currently broken out on my PCB design) and erase the chip from stlink utility to get it back up and running.
But while this did free up those pins, they wouldnt function with PWM controls at all. Either with analogWrite or pwmWrite.
Now the diagram listed above says these are PWM pins.
So firstly how do i set the jtag pins to gpio without breaking SWD as the method already mentioned doesnt work. And 2 how do I get PWM working on those pins, assuming theres something else im missing?
Old question//////////////////////////////////////////////////////////////////////////////////////////////////////
Hi i slight oversight on my pcb design... I need to free up PA15, im using SWD to program but not jtag.
When ever i try to use PA15 the pin is stuck high. Found out its a Jtag reserved pin, but struggling to find how to disable the jtag to free up the io.
google suggests this but its not working for me...
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN; // Enable A.F. clock
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
RCC and AFIO not declared in this scope.
Anyone know how to disable this?
Hi
I have 5 LEDs.
The leds are attached to
PA1 PA11 PA15 PB4 and PB5.
Ive picked these pins as

says these pins are PWM driven.
I need pwm control on these leds as ground sinks...
PA15 and PB4 are normally reserved for JTAG. But im not using JTAG, however i am using SWD Stlink for programming.
Bellow Mr Burnette mentioned linked me to that forum post to use
disableDebugPorts();
enableDebugPorts();
But this doesnt work and kills SWD for programming. Ive had to hotwire a reset line to the reset pin (this isnt currently broken out on my PCB design) and erase the chip from stlink utility to get it back up and running.
But while this did free up those pins, they wouldnt function with PWM controls at all. Either with analogWrite or pwmWrite.
Now the diagram listed above says these are PWM pins.
So firstly how do i set the jtag pins to gpio without breaking SWD as the method already mentioned doesnt work. And 2 how do I get PWM working on those pins, assuming theres something else im missing?
Old question//////////////////////////////////////////////////////////////////////////////////////////////////////
Hi i slight oversight on my pcb design... I need to free up PA15, im using SWD to program but not jtag.
When ever i try to use PA15 the pin is stuck high. Found out its a Jtag reserved pin, but struggling to find how to disable the jtag to free up the io.
google suggests this but its not working for me...
RCC->APB2ENR |= RCC_APB2ENR_AFIOEN; // Enable A.F. clock
AFIO->MAPR |= AFIO_MAPR_SWJ_CFG_JTAGDISABLE;
RCC and AFIO not declared in this scope.
Anyone know how to disable this?