cancel
Showing results for 
Search instead for 
Did you mean: 

PA13 and PA14 how do i make these GPIO outputs

Kevin Bain
Associate II
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

1 ACCEPTED SOLUTION

Accepted Solutions
Posted on June 20, 2017 at 04:15

Thanks for that Zhitai, all working.

View solution in original post

2 REPLIES 2
Zt Liu
Senior III
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

Posted on June 20, 2017 at 04:15

Thanks for that Zhitai, all working.