Skip to main content
vitthal muddapur
Associate III
June 7, 2018
Question

SWCLK AND SWDIO ?

  • June 7, 2018
  • 11 replies
  • 3802 views
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?

    This topic has been closed for replies.

    11 replies

    Tesla DeLorean
    Guru
    June 7, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    vitthal muddapur
    Associate III
    June 8, 2018
    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?

    Tesla DeLorean
    Guru
    June 8, 2018
    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 (See Profile) Up vote any posts that you find helpful, it shows what's working..
    ST Employee
    June 8, 2018
    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

    vitthal muddapur
    Associate III
    June 8, 2018
    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

    ST Employee
    June 8, 2018
    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.

    vitthal muddapur
    Associate III
    June 8, 2018
    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