cancel
Showing results for 
Search instead for 
Did you mean: 

How do I have to configure the standard debug PINS (PA13 and PA14) on STM32F030F4P6 if I want to use them as GPIO output?

PCana.1
Associate II

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.

10 REPLIES 10
Peter BENSCH
ST Employee

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
PCana.1
Associate II

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

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

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.

What does it mean exactly: "this should work, but on my HW it doesn't", i.e. what output levels do you get?

  • I read in the community that setting the pin as output should work
  • the output is zero

What else is connected there?

  • find attached the schematic (out is ouput)0693W00000GZGIyQAP.jpg

I see the same behavior if nothing is connected to the output pins

> After every reset i set them as output with the MODER register.

How, exactly?

JW

((RCC->AHBENR) |= (RCC_AHBENR_GPIOAEN))

((GPIOA->MODER) |= (GPIO_MODER_MODER14_0))

((GPIOA->MODER) |= (GPIO_MODER_MODER13_0))

after initialization I set them to zero with:

((GPIOA->BRR) |= (GPIO_BSRR_BS_14))

((GPIOA->BRR) |= (GPIO_BSRR_BS_13))

> ((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