cancel
Showing results for 
Search instead for 
Did you mean: 

HAL_Delay() --> SysTick_Handler never be called

bibah
Associate II

Hi all,

Version: 1.15.1

MCU : g473

Before investigate deeply on my own I wonder whether if anyone have faced the same problem with Interrupt table in general ...

I placed a breakpoint there :

void SysTick_Handler(void)

{

/* USER CODE BEGIN SysTick_IRQn 0 */

 

/* USER CODE END SysTick_IRQn 0 */

HAL_IncTick();

/* USER CODE BEGIN SysTick_IRQn 1 */

 

/* USER CODE END SysTick_IRQn 1 */

}

and surprisingly the code is never executed !

Best regards,

 

 

 

1 ACCEPTED SOLUTION

Accepted Solutions
Sarra.S
ST Employee

Hello @bibah

Uncommenting the "define USER_VECT_TAB_ADDRESS" allows for the relocation of the vector table, which can be necessary for certain applications (that's why I asked about the bootloader) or when the application needs to be located at a specific address in memory, that's why maybe some details are required on your application...

In previous STM32CubeMX versions, the line #define USER_VECT_TAB_ADDRESS was uncommented by default, which would automatically relocate the vector table, but in later versions, for more flexibility,  you have the choice to uncomment it if you need to.

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

4 REPLIES 4
Sarra.S
ST Employee

Hello @bibah

Have you used CubeMX to generate the code? if yes, what's the version? 

Also, maybe provide some context, are you using a bootloader, or have remapped the vector table?

The SysTick timer needs to be initialized before it can trigger interrupts, I assume you did that

Maybe verify systick interrupt priority? and ensure that global interrupt is enabled

 

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.

Hi Sarra,

 

STM32CubeMX - STM32 Device Configuration Tool

Version: 6.11.1-RC2

Build: 20240411-0753 (UTC)

 

No BootLoader and no remapped the Vector Table

 

Early in the code generated by CubeMX

  • HAL_Init();
  • SystemClock_Config();
  • MX_NVIC_Init()
  • ....

And finally I found a solution detailed here :

 I uncommented /*#define USER_VECT_TAB_ADDRESS*/ in system_stm32g4xx.c so it lay on Flash now

/************************* Miscellaneous Configuration ************************/

/* Note: Following vector table addresses must be defined in line with linker

configuration. */

/*!< Uncomment the following line if you need to relocate the vector table

anywhere in Flash or Sram, else the vector table is kept at the automatic

remap of boot address selected */

#define USER_VECT_TAB_ADDRESS

 

#if defined(USER_VECT_TAB_ADDRESS)

/*!< Uncomment the following line if you need to relocate your vector Table

in Sram else user remap will be done in Flash. */

/* #define VECT_TAB_SRAM */

#if defined(VECT_TAB_SRAM)

#define VECT_TAB_BASE_ADDRESS SRAM_BASE /*!< Vector Table base address field.

This value must be a multiple of 0x200. */

#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.

This value must be a multiple of 0x200. */

#else

#define VECT_TAB_BASE_ADDRESS FLASH_BASE /*!< Vector Table base address field.

This value must be a multiple of 0x200. */

#define VECT_TAB_OFFSET 0x00000000U /*!< Vector Table base offset field.

This value must be a multiple of 0x200. */

#endif /* VECT_TAB_SRAM */

#endif /* USER_VECT_TAB_ADDRESS */

/******************************************************************************/

 

My question :

 

Is it a normal situation the Vector Table will not be generated by default ?

 

Best Regards, H

Sarra.S
ST Employee

Hello @bibah

Uncommenting the "define USER_VECT_TAB_ADDRESS" allows for the relocation of the vector table, which can be necessary for certain applications (that's why I asked about the bootloader) or when the application needs to be located at a specific address in memory, that's why maybe some details are required on your application...

In previous STM32CubeMX versions, the line #define USER_VECT_TAB_ADDRESS was uncommented by default, which would automatically relocate the vector table, but in later versions, for more flexibility,  you have the choice to uncomment it if you need to.

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.

Ok Sarra,

Got it ! Thanks. May be you should include this feature in CubeMX ... no ?

Habib