cancel
Showing results for 
Search instead for 
Did you mean: 

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?

cjaya.2
Associate II
 
6 REPLIES 6
Peter BENSCH
ST Employee

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.
 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.

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.
Kamil Duljas
Senior III

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

Dudo

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.

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

Dudo