cancel
Showing results for 
Search instead for 
Did you mean: 

Setting specific GPIO_Output pins high/low

RRobi.1
Associate II

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);
  }

1 ACCEPTED SOLUTION

Accepted Solutions
KnarfB
Principal III

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

View solution in original post

6 REPLIES 6
Houssem CHAABANI
Senior II

Hi @RRobi.1​ ,

Could you share you .ioc file ?

Thanks

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)

KnarfB
Principal III

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

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 !

Hi there,

Thank you for your response. I realise the .ioc file I had sent you did not have the PA pins configured to GPIO_Output. I was testing all the PA pins in batches and so had reset the lower number pins when testing the higher numbers which is why only 11-15 were set to GPIO_Output. Please see attached the .ioc file of what I was trying to do. I believe I did use the board selector when I created the project and didn't see anything on any of the PA pins.

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