Skip to main content
RRobi.1
Associate
December 17, 2020
Solved

Setting specific GPIO_Output pins high/low

  • December 17, 2020
  • 6 replies
  • 2129 views

I am able to set pins (high/low) that I have specified to be GPIO_Output in the Pinout& Configuration tab of the .ioc file.

Using the code written below (changing the pin number) I am able to observe the expected behaviour on a oscilloscope using all of the PA pins except (PA2,PA3 and PA8).

Why am I not able to observe the behaviour on these pins? I am using the STM 32L072 Nucleo-64.

Thanks in advance

while (1)
 {
 /* USER CODE END WHILE */
 
 /* USER CODE BEGIN 3 */
	 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_15,GPIO_PIN_SET);
	 HAL_Delay(100);
//	 HAL_ADC_Start(&hadc);
//	 HAL_ADC_PollForConversion(&hadc,HAL_MAX_DELAY);
//	 raw = HAL_ADC_GetValue(&hadc);
 
	 HAL_GPIO_WritePin(GPIOA,GPIO_PIN_15,GPIO_PIN_RESET);
	 HAL_Delay(500);
 }

This topic has been closed for replies.
Best answer by KnarfB

Check UM1724 User manual STM32 Nucleo-64 boards (MB1136) for how the pins are connected on the board, especially the solder bridges.

6 replies

Houssem CHAABANI
Visitor II
December 17, 2020

Hi @RRobi.1​ ,

Could you share you .ioc file ?

Thanks

RRobi.1
RRobi.1Author
Associate
December 17, 2020

I have now attached the .ioc to the question. Note only the last few PA pins are set to GPIO_Output ( I was testing them in batches)

Houssem CHAABANI
Visitor II
December 17, 2020

Hello @RRobi.1​ ,

In order to set GPIO as HIGH/LOW you need first to configure this GPIO as GPIO_Output .

After that you can set the GPIO as HIGH/LOW with HAL_GPIO_WritePin function.

I see form .ioc file that you you didn't configured PA2,PA3 and PA8 as GPIO_Output that's why you didn't get the expected result.

It's recommenced to select the board that you are using under Board Selector to know if the pin is free or attached to another component.

Thanks !

KnarfB
KnarfBBest answer
Super User
December 17, 2020

Check UM1724 User manual STM32 Nucleo-64 boards (MB1136) for how the pins are connected on the board, especially the solder bridges.

RRobi.1
RRobi.1Author
Associate
December 17, 2020

Ahh I think this may be it. I see that PA2 and PA3 are set up the USART2 interface with default setup of the solder bridges and need to be changed if these pins are needed for something else.

Thanks very much