Skip to main content
NSemrHomeInit
Associate III
October 16, 2020
Solved

Couldn't set and reset a GPIO using the HAL_GPIO_Write function

  • October 16, 2020
  • 1 reply
  • 1478 views

Dear ST Hello,

I couldn't understand why I couldn't set and reset the PB4 GPIO. I am trying to visualize the GpIO signal using an oscilloscope.

I am using CubeMx for this project

0693W000004K6jXQAS.pngI am using this GPIO for CS with SPI3.

0693W000004K6kVQAS.png 

HAL_GPIO_WritePin(SPI3_CS_GPIO_Port, SPI3_CS_Pin, GPIO_PIN_RESET);
	status = HAL_SPI_TransmitReceive(&hspi3, (uint8_t*)aTxBuffer, (uint8_t *)aRxBuffer, BUFFERSIZE, 5000);
	HAL_GPIO_WritePin(SPI3_CS_GPIO_Port, SPI3_CS_Pin, GPIO_PIN_SET);

Thank you in advance

S.Tarik

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

Why do you think you can't set/reset PB4? Did you start the clock? These should be done in the generated code, but you can also check the GPIO registers to see if it's set correctly.

1 reply

TDK
TDKBest answer
October 16, 2020

Why do you think you can't set/reset PB4? Did you start the clock? These should be done in the generated code, but you can also check the GPIO registers to see if it's set correctly.

"If you feel a post has answered your question, please click ""Accept as Solution""."
NSemrHomeInit
Associate III
October 18, 2020

I have a ground problem, it's okay now, Thank you.