cancel
Showing results for 
Search instead for 
Did you mean: 

Can't Blink Led in STM32F411 Discovery board

studentof
Associate II

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.

16 REPLIES 16

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

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

yes, i did it from beginning

Hello @studentof and welcome to the community,

You have two projects in the zip file you attached:

mALLEm_0-1752835439748.png

And the Drivers folder has "BSP" folder:

mALLEm_1-1752835486428.png

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.

 

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.

Sorry but i didn't attach any zip file, my project:

studentof_0-1752845114678.png

 

- i used your code but it didn't work, i still have to disable USB_OTG and select HSI to BLINK successfully

 

In the project I've attached previously select Crystal for HSE:

mALLEm_0-1752846118504.png

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

 

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.

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.

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.  

KarlYamashita_0-1752855682554.png

 

If you FIFO doesn't work, then it's called GIGO.
TimerCallback tutorial! | UART and DMA Idle with multiple UART instances tutorial!

If you find my solution useful, please click the Accept as Solution so others see the solution.