Skip to main content
Kevin Bain
Associate
June 19, 2017
Solved

PA13 and PA14 how do i make these GPIO outputs

  • June 19, 2017
  • 2 replies
  • 2151 views
Posted on June 19, 2017 at 07:43

I am using a custom STM32L051xxx, I want to change these two programing ports to PP outputs.

I think I need to DeInit them then apply the normal Init procedure, I cand see how to DeInit these ports.

Thanks

Kevin NZ

    This topic has been closed for replies.
    Best answer by Kevin Bain
    Posted on June 20, 2017 at 04:15

    Thanks for that Zhitai, all working.

    2 replies

    Zt Liu
    Senior III
    June 19, 2017
    Posted on June 19, 2017 at 17:59

    If you are using hal library......

    DeInit pins:

    void HAL_GPIO_DeInit(GPIOA, GPIO_PIN_13 |GPIO_PIN_14);

    Config as Output PushPull:

    GPIO_InitTypeDef GPIO_InitStruct;

    __HAL_RCC_GPIOA_CLK_ENABLE();

    GPIO_InitStruct.Pin = GPIO_PIN_13 | GPIO_PIN_14;

    GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

    GPIO_InitStruct.Pull = GPIO_NOPULL;

    HAL_GPIO_Init(GPIOA, &GPIO_InitStruct);

    Is that what you want? You may check this routines in stm32l0xx_hal_gpio.c

    Kevin Bain
    Kevin BainAuthorBest answer
    Associate
    June 20, 2017
    Posted on June 20, 2017 at 04:15

    Thanks for that Zhitai, all working.