Skip to main content
voyvoda .
Senior
February 19, 2018
Question

STM32 IAP UART Bootlader

  • February 19, 2018
  • 2 replies
  • 2046 views
Posted on February 19, 2018 at 08:50

Hello,

      I want to use the STM32 IAP UART Bootlarder in the CubeMX. The example is working fine. However I have a problem with my own code. When I use HAL_Delay() function, the code is crashing. If I do not use the HAL_Delay() function, everything is so good.

     What could be the problem ? Can anybody help ?

Best Regards 

#stm32-f4 #bootloader #stm32-uart-bootloader
This topic has been closed for replies.

2 replies

Andrew Neil
Super User
February 19, 2018
Posted on February 19, 2018 at 09:51

Can anybody help ?

Not from the vague description you've given.

What debugging have you done?

When you say, 'crash' - what does that actually mean?

Some debugging tips for you:

http://www.8052.com/faqs/120313

 

http://www.ganssle.com/articles/developingagoodbedsidemanner.htm

 
A complex system that works is invariably found to have evolved from a simple system that worked.A complex system designed from scratch never works and cannot be patched up to make it work.
voyvoda .
voyvoda .Author
Senior
February 19, 2018
Posted on February 19, 2018 at 13:21

Hello Andrew

It waits in the while in the below code, because HAL_GetTick() always returns 0. There is no increment on the uwTick.

__weak void HAL_Delay(__IO uint32_t Delay)

{

uint32_t tickstart = HAL_GetTick();

uint32_t wait = Delay;

/* Add a period to guarantee minimum wait */

if (wait < HAL_MAX_DELAY)

{

wait++;

}

while((HAL_GetTick() - tickstart) < wait)

{

}

}
voyvoda .
voyvoda .Author
Senior
February 19, 2018
Posted on February 19, 2018 at 13:25

I Just change the memory address at the file 'STM32F407VETx_FLASH.ld' like below.

Original:

FLASH (rx)      : ORIGIN = 0x8000000, LENGTH = 512K

Modified

FLASH (rx)      : ORIGIN = 0x8004000, LENGTH = 512K

Mike_ST
Technical Moderator
February 19, 2018
Posted on February 19, 2018 at 14:23

Hello,

Please make sure that you are calling the HAL_Init() function at the beginning of your main() function.

This should start the SysTick.

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. 
voyvoda .
voyvoda .Author
Senior
February 19, 2018
Posted on February 19, 2018 at 14:31

 ,

 ,

Hello I resolve the issue by just changing the the following line in the 'stm32f407xx.h' file.

Original:

♯ define FLASH_BASE ,  ,  ,  ,  ,  , 0x08000000U

Modified:

♯ define FLASH_BASE ,  ,  ,  ,  ,  , 0x08004000U

Mike_ST
Technical Moderator
February 19, 2018
Posted on February 19, 2018 at 15:17

>> Modified

>> FLASH (rx)      : ORIGIN = 0x8004000, LENGTH = 512K

If you're adding 0x4000 to ORIGIN, LENGTH can't be 512K.

should be 512K - 0x4000 = 507904

In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question.