cancel
Showing results for 
Search instead for 
Did you mean: 

SWCLK AND SWDIO ?

vitthal muddapur
Associate II
Posted on June 07, 2018 at 21:58

Hi,

i am beginner in stm32

I configured SWCLK AND SWDIO for Serial Debugging.

Can I Change SWCLK and SWDIO as input and output at runtime?

If Change the MCU is RESET or Not?

11 REPLIES 11
Posted on June 07, 2018 at 22:22

>>Can I Change SWCLK and SWDIO as input and output at runtime?

Yes

>>If Change the MCU is RESET or Not?

No, but the debugger connectivity will drop/fail. If you leave the debugger attached it is likely to interfere with other GPIO usage.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Artur IWANICKI
ST Employee
Posted on June 08, 2018 at 06:40

Hello,

Could you please share with us bit more part of the code when complete configuration of those IOs and its data manupulation is vitible, please? Is the debugger connected all the time during this rpocess?

Thank you in advnac,e

Best Regards,

Artur

Artur IWANICKI
ST Employee
Posted on June 08, 2018 at 07:06

At which moment MCU is resetting? Before or after GPIOA->ODR=1<<15; ? Is MCU resetting as well if you do not modify PA15?

Would it be possible for you to have a look at RCC->CSR register after the reset, please? It would give us some guidance about possible root cause.

Posted on June 08, 2018 at 06:32

I set GPIO GPIOA->ODR=1<<15 That time also change the SWCLK and SWDIO in STM32l071

but MCU is resetting 

why MCU is resetting?

Posted on June 08, 2018 at 06:49

int main()

{

while(1)

{

     if(wakeupflag==1)

  {

     

   EEPROM_READ();

  GPIOA->ODR=1<<15;

  post_data();

  

GPIOA->ODR=0<<15;

  }

}

}

static void MX_GPIO_Init(void)

{

GPIO_InitTypeDef GPIO_InitStruct;

/* GPIO Ports Clock Enable */

__HAL_RCC_GPIOB_CLK_ENABLE();

__HAL_RCC_GPIOA_CLK_ENABLE();

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_15, GPIO_PIN_RESET);

/*Configure GPIO pin : PA15 */

GPIO_InitStruct.Pin = GPIO_PIN_15;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

/*Configure GPIO pin Output Level */

HAL_GPIO_WritePin(GPIOA, GPIO_PIN_4, GPIO_PIN_RESET);

/*Configure GPIO pin : PA4 */

GPIO_InitStruct.Pin = GPIO_PIN_4;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

}

i have connect GSM control pin porta 15 pin after wakeup flag set using RTC write data to eeprom and read eeprom 

but device resetting

Posted on June 08, 2018 at 07:23

i am testing with debugging resetting is not getting after remove debugger and after 3 hours wakeup flag set that time device is resetting 

Posted on June 08, 2018 at 12:07

Why write all the other bits to zero? What else is connected on Bank A?

Use

GPIOA->ODR |= (1<<15); // Set PA15

and

GPIOA->ODR &= ~(1<<15); // Clear PA15

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..
Posted on June 08, 2018 at 12:15

Thank you but i need information  any possibility to resetting the MCU to write like this 

GPIOA->ODR = 1<<15; // Set PA15

and

GPIOA->ODR = 0<<15; // Clear PA15

So my MCU resetting for this reason or else ?

Posted on June 08, 2018 at 12:38

FFS, what else have you got connected on your board for pins PA0 thru PA14? Your code sets these all to ZERO, arbitrarily, with whatever ramifications that has with your design, which you haven't really shared.

Tips, buy me a coffee, or three.. PayPal Venmo Up vote any posts that you find helpful, it shows what's working..