Skip to main content
cjaya.2
Associate III
April 28, 2023
Question

I am turning on/off a LED using HAL_GPIO_WritePin() but still one of the LED showing dim even though its being RESET. any idea?

  • April 28, 2023
  • 6 replies
  • 1947 views

..

This topic has been closed for replies.

6 replies

Peter BENSCH
ST Technical Moderator
April 28, 2023

Then a small current flows, which may well cause the LED to glow. Unfortunately, you have not included any initialisation code, but I suspect that one of the internal pull resistors is switched on or that current is flowing externally. What does your hardware look like around the LED?

Regards

/Peter

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
cjaya.2
cjaya.2Author
Associate III
April 28, 2023
 GPIO_InitStruct.Pin = GPIO_PIN_12|GPIO_PIN_13|GPIO_PIN_14|GPIO_PIN_15
 |GPIO_PIN_4|GPIO_PIN_8|GPIO_PIN_9;
 GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
 GPIO_InitStruct.Pull = GPIO_NOPULL;
 GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;
 HAL_GPIO_Init(GPIOB, &GPIO_InitStruct);

The GPIO_PIN_15 connected to the LED is showing dim light on even though is reset.

Peter BENSCH
ST Technical Moderator
April 28, 2023

And what about the hardware, i.e. the schematics around the LED?

How is it connected to the voltage?

In order to give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
Senior III
April 28, 2023

You have NOPULL - It means can pick up noise. Try set GPIO_PULLDOWN for GPIO_InitStruct.Pull

Dudo
Bob S
Super User
April 28, 2023

WHAT??????? That is nonsense. The pin is defined as out push-pull output. It will drive high or drive low. Enabling the internal pull up or pull down will only draw more current.

Senior III
April 28, 2023

You right . I mistake with open drain. Soooorrrry :)​

Dudo