2021-11-29 02:21 AM
Currently I only set the MODER register to 0 and set the outputs to 0 with the BRR register since I don't need further configurations. I allready use other PINs with the same configuration and they work. I read that this should work, but on my HW it doesn't.
2021-11-29 02:52 AM
Welcome, @PCana.1, to the ciommunity!
These pins are the SWD pins, usually used for debugging. It also takes some precautions to use the pins for both debugging and GPIO.
Please note the note in the datasheet under Table 11 if you want to use them:
After reset, these pins are configured as SWDIO and SWCLK alternate functions, and the internal pull-up on SWDIO pin and internal pull-down on SWCLK pin are activated.
Regards
/Peter
2021-11-29 03:05 AM
Thank you for the quick response.
After every reset i set them as output with the MODER register. I also tried with resetting the PUPDR bits after reset with the same results.
Do you have further suggestions?
Best regards
2021-11-29 03:10 AM
What does it mean exactly: "this should work, but on my HW it doesn't", i.e. what output levels do you get?
What else is connected there?
Regards
/Peter
2021-11-29 03:31 AM
What does it mean exactly: "this should work, but on my HW it doesn't", i.e. what output levels do you get?
What else is connected there?
2021-11-29 04:11 AM
I see the same behavior if nothing is connected to the output pins
2021-11-29 04:41 AM
> After every reset i set them as output with the MODER register.
How, exactly?
JW
2021-11-29 05:23 AM
((RCC->AHBENR) |= (RCC_AHBENR_GPIOAEN))
((GPIOA->MODER) |= (GPIO_MODER_MODER14_0))
((GPIOA->MODER) |= (GPIO_MODER_MODER13_0))
2021-11-29 05:25 AM
after initialization I set them to zero with:
((GPIOA->BRR) |= (GPIO_BSRR_BS_14))
((GPIOA->BRR) |= (GPIO_BSRR_BS_13))
2021-11-29 05:29 AM
> ((GPIOA->MODER) |= (GPIO_MODER_MODER14_0))
> ((GPIOA->MODER) |= (GPIO_MODER_MODER13_0))
As PA13 and PA14 are set to AF after reset, i.e. 0b10, this sets them to 0b11 i.e. Analog, not Out.
JW