cancel
Showing results for 
Search instead for 
Did you mean: 

SWD Pins Using I/O Problem

dinccagri
Associate
Posted on October 25, 2014 at 22:32

Hi,

I tried and failed, now I'm asking here If someone please could provide. I use STM32F030.  

I want to use SWD pins (SWDIO and SWCLK) as I/O pins. But SWDIO always logic 1, SWCLK 0.

My code:

  RCC->AHB1ENR  |= 0x00000001;   //A port clock enable

  GPIOA->PUPDR   = 0;            //A port No pull up, no pull down  

  GPIOA->MODER  |= 0x04000000;   //A13 output

  GPIOA->ODR    |= 0x00002000;   //A13 logic 1

  GPIOA->MODER  |= 0x10000000;   //A14 output

  GPIOA->ODR    |= 0x00004000;   //A14 logic 1

#swd-pins-using-as-i/o
2 REPLIES 2
Posted on October 26, 2014 at 16:31

Perhaps you'd want to mask the bits before ORing in new ones. In other SPL releases there have been examples of turning off the SWD/JTAG interfaces.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
dinccagri
Associate
Posted on October 26, 2014 at 21:14

thanks Clive1 for answer.

Found the problem.first must  GPIO->MODER register reset.

True code:

  GPIOA->MODER  &= 0xC3FFFFFF;   //A13(SWDIO) ve A14(SWCLK) reset

  GPIOA->MODER  |= 0x14000000;   //A13 ve A14 output 

  GPIOA->PUPDR  &= 0x00000000;   //A port No pull up, no pull down  

  GPIOA->ODR    |=   0x00004000;   //A14 logic 1

  GPIOA->ODR    |=   0x00002000;   //A13 logic 1

Good working.