2023-12-18 05:16 AM
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.
Solved! Go to Solution.
2023-12-18 05:46 AM
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);
2023-12-18 05:48 AM
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
2023-12-18 05:55 AM
ph4 works perfectly fine its pd8 thats not working. thank you so much for helping out
2023-12-18 06:01 AM
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)?
2023-12-18 06:09 AM - edited 2023-12-18 06:10 AM
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.
2023-12-18 07:25 AM - edited 2023-12-18 07:26 AM
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.
2023-12-18 09:53 PM
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
2023-12-18 10:40 PM - edited 2023-12-18 11:10 PM
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