cancel
Showing results for 
Search instead for 
Did you mean: 

the built in led of stm32l4r9 discovery kit works plus led attached to other gpios don't work

kanuz_khan
Associate III

i'm using stm32l4r9 discovery kit and the built in led of stm32l4r9 discovery kit works but led attached to other gpios don't work. no mater if i set or rest it.

17 REPLIES 17
SofLit
ST Employee

You need to have this config for PH4:

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;
GPIO_InitStruct.Pull = GPIO_NOPULL;
GPIO_InitStruct.Speed = GPIO_SPEED_LOW;

GPIO_InitStruct.Pin = GPIO_PIN_4;
HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

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.

this is for the built in led 

/*Configure GPIO pins : MIC_VDD_Pin DSI_SPI_USART_CS_Pin greenled_Pin */

GPIO_InitStruct.Pin = MIC_VDD_Pin|DSI_SPI_USART_CS_Pin|greenled_Pin;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(GPIOH, &GPIO_InitStruct);

 and this for the external 

/*Configure GPIO pin : external_led_Pin */

GPIO_InitStruct.Pin = external_led_Pin;

GPIO_InitStruct.Mode = GPIO_MODE_OUTPUT_PP;

GPIO_InitStruct.Pull = GPIO_NOPULL;

GPIO_InitStruct.Speed = GPIO_SPEED_FREQ_LOW;

HAL_GPIO_Init(external_led_GPIO_Port, &GPIO_InitStruct);

external is pd8 and built in is ph4

ph4 works perfectly fine its pd8 thats not working. thank you so much for helping out

SofLit
ST Employee

Could you please verify if PH4 is set for greenled_Pin in CubeMx?

Did you remove the serial resistor connected to the green LED (I think R5)?

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.

Next time please be more specific on the issue .. Your problem description is confusing.

Now for PD8:

- Check the connections using continuity between the LED and GPIOD8.

external_led_Pin: does it correspond to GPIO_PIN_8?

- external_led_GPIO_Port: does it correspond to GPIOD?

- HAL_GPIO_WritePin(external_led_GPIO_Port, external_led_Pin, GPIO_PIN_RESET); try to toggle it instead of writing a value. I suspect that the external LED is pulled down to GND and not pulled up to the VDD like Green LED.

 

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.
gbm
Lead III

Your code in main() does not toggle PD8. Also, if you give a symbolic name to the pin, use that name and port name while setting it.

i've checked the continuity its fine but there is no voltage change on d13 even after toggling it every 2 seconds inside the while loop in main the voltage remains same i.e 0.2 volts on the pin

kanuz_khan_0-1702967972350.png

On the documentation it states d13 as PB13?
the positive leg of the led is attached to 3.3v and the negative to d13 i just added a resistor equal to r5 on between ground and negative le and its working now