cancel
Showing results for 
Search instead for 
Did you mean: 

LED BLINKING in EMBEDDED C

arunoday
Associate II

I built a project in STM32F411E-DISC . project is built successfully and also  when we debugged no issue is found ,but after debugging only ORANGE LED is toggling rest 3 LED is not toggling . kindly help me to resolve this issue .kindly  find for code and microcontroller.WhatsApp Image 2024-05-21 at 11.16.40 AM.jpegCapture-3.PNGCapture-2.PNGCapture-1.PNGCapture.PNG 

1 ACCEPTED SOLUTION

Accepted Solutions
SofLit
ST Employee

Hello,

Are you sure you’re configuring the right GPIOs?

Enabled RCC clock for the GPIO ports?

PS: please in next time either you put the source code in the comment using </> button or simply attach it.

Please don't attach code screenshots.

Thank you.

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.

View solution in original post

9 REPLIES 9
SofLit
ST Employee

Hello,

Are you sure you’re configuring the right GPIOs?

Enabled RCC clock for the GPIO ports?

PS: please in next time either you put the source code in the comment using </> button or simply attach it.

Please don't attach code screenshots.

Thank you.

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.
arunoday
Associate II

where is RCC clock for the GPIO ports in CUBEIDE and how to enable this 

Hello,

You need to use CubeMx (in CubeIDE) to configure the peripherals and generate the corresponding code.

I've attached a project running on F411-DISCO board toggling the 4 LEDs. I didn't test it but should work.

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.
hayat
Associate III

Always use CubeMx to generate a code template.

This does the necessary initialization of the GPIOs including the clock enabling.

 

Thereafter, simply one line code to toggle LEDs.

 

 

Your attached project running fine and all LED is toggling but , what is the issue in my code . can you please help me.

Apparently, you are running multiple tasks and using the HAL_Delay() function.

 

This creates a problem. The solution is to change the Time Base from sysTick to another Timer.

 

The SysTick is a special timer in most ARM processors that’s generally reserved for operating system purposes. By default, SysTick will be used for things like HAL_Delay() and HAL_GetTick(). As a result, the STM32 HAL framework gives SysTick a very high priority. However, FreeRTOS needs SysTick for its scheduler, and it requires SysTick to be a much lower priority. Therefore, a quick workaround is to use a Timer as a Time-base source in the cases of freeRTOS.

 

You can adapt the example from the attached tutorial material.

Refer to Page 22.

 

 

 

arunoday
Associate II

why  code generation section is blank . i build 2 project but still in both project code generation section is blink , how to resolve this issue Capture-4.PNG

 

hayat_0-1716551077779.png

 

refer to the snapshot, and Click the Right-Top Corner to generate the Code.

 

The one you have circled up is to setup the parameters.

 

 

hayat
Associate III

Alternatively,

 

Refer to the attached file, 

 

follow the steps from page 38.