2025-07-17 9:16 AM - last edited on 2025-07-18 1:34 AM by Saket_Om
I create A project for STM32F411 Discovery board with STM32CubeIDE 1.19.0
and coding :
while (1)
{
/* USER CODE END WHILE */
MX_USB_HOST_Process();
HAL_GPIO_TogglePin(LD3_GPIO_Port, LD3_Pin);
HAL_Delay(500);
/* USER CODE BEGIN 3 */
}
and don't set anything else.
(I saw that the connection settings for the leds were automatically created when Creating project)
i Build and Run code sucessfully but i dont see led Blink. Thanks
Edited to apply source code formatting - please see How to insert source code for future reference.
2025-07-17 6:15 PM
>>so i think my board have an external crystal
You can add one as an option
Usually you can get an 8 MHz from the ST-LINK/V2-1, so HSE in BYPASS mode
2025-07-17 9:32 PM
yes, i did it from beginning
2025-07-18 3:47 AM
Hello @studentof and welcome to the community,
You have two projects in the zip file you attached:
And the Drivers folder has "BSP" folder:
Not clear how that was generated by CubeIDE? did you copy and did some changes in the folder structure?
I've attached a project where 4 user LEDs are toggling. No need to add BSP or other stuff.
If you need to add EXTI function you need to add it in the CubeMx: activate GPIO as GPIO EXTI and enable the related NVIC line.
Hope that helps.
2025-07-18 6:28 AM
Sorry but i didn't attach any zip file, my project:
- i used your code but it didn't work, i still have to disable USB_OTG and select HSI to BLINK successfully
2025-07-18 6:47 AM
In the project I've attached previously select Crystal for HSE:
Comment out MX_USB_HOST_Process()
and keep:
HAL_GPIO_TogglePin(GPIOD, LD4_Pin|LD3_Pin|LD5_Pin|LD6_Pin);
HAL_Delay(500);
@studentof wrote:
Sorry but i didn't attach any zip file, my project
Maybe I confused with another thread...
2025-07-18 7:58 AM
i still have to disable USB_OTG (commenting out MX_USB_HOST_Process() doesn't allow select HSI, only disable USB_OTG can help me to select HSI), i have to select HSI to Blink successfully, not HSE.
2025-07-18 9:24 AM
I ran the same code as you on a STM32F407VG-DISC board it it works, even with MX_USB_HOST_Process(); in place.
The LED's are on the same PD12-PD15 pins. Being it's the same family, it uses the same FW. I'm currently using STM32Cube FW_F4 V1.28.2
You've mentioned that the LED only blinks in HSI. Go back to using HSE and use an oscilloscope to verify if you see clocking on PH0 pin of the STM32.
Also make sure R25 and R24 resistors are in place.