cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay() not working on STM32F103ZET6 (LED Blinking Example)

Helmish
Associate II

I am using a stm32F103ZET6 to just blinking a led but the HAL_Delay() is not working.

I change the HAL_Delay() with for loop and it work.
this is the code that i am using :

while (1)

{

HAL_GPIO_WritePin(Led_301_GPIO_Port, Led_301_Pin, 1);

HAL_Delay(500);

//for (int i=0; i < 500000; i++);

HAL_GPIO_WritePin(Led_301_GPIO_Port, Led_301_Pin, 0);

//for (int i=0; i < 500000; i++);

}

}

I want to work with HAL_Delay because i need to use it in a project with this mcu

 

15 REPLIES 15

I programmed the board using a CAN connection. I converted the compiled code into an SREC file and then transmitted it to the board via the CAN bus using a PCAN and microboot on my laptop.
Since my code upload method has been successfully tested, I'm confident

because when i add a for loop to the code that will enable the LED to blink. but without HAL_Delay

Not sure what do you do with these steps, but from software point of view I don't see an issue.

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.

Attached a project which toggling PA8 GPIO pin.

Tested it on STM3210E_EVAL.

Hope it 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.
SofLit
ST Employee

Seems you're executing the code from the SRAM (you didn't mentioned that important information) but it overlaps with r/w data and with VTOR. That's why the Systick interrupt (used by HAL_Delay) is not working

You need to rethink/rework your project.

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.

Can you please explain this. What do you mean by rethink/rework 

Also i have to add some information.

I change the flash memory in the file .std from 512ko to 484ko and the start address from 0x8000000 to 0x8006000. Because in the project specification i have to do that.