cancel
Showing results for 
Search instead for 
Did you mean: 

Incomplet SystemInit() for STM32G474

p2399
Associate II

Hello,

Recently I spent some time solving the problem of incorrect CPU operation. After generating the project (completely basic, only TIM6 set as TimeSource for HAL), the program diverged when trying to enter the interrupt from TIM6 (I'm guessing). Known Issue: Signal Handler on 0xFFFFFFF9.
To confirm the problem, a colleague generated a similar project on another computer and received the same situation.
Running the example, however, did not cause such situations. However, generating a new project based on the *ioc file from the example again caused the above-mentioned problem.

It turned out that the following line of code was missing in the "system_stm32g4xx.c" file in the SystemInit() function:
SCB->VTOR = FLASH_BASE | VECT_TAB_OFFSET;

Tested on HAL library version 1.4.0 - 1.5.1
STM32CubeIDE 1.12.1

If the issue is known, sorry for spamming.

3 REPLIES 3
Pavel A.
Evangelist III

#bugreport

This seems to be a bug in the template system_stm32g4xx.c : missed `#else` after `#if defined(USER_VECT_TAB_ADDRESS)`

https://github.com/STMicroelectronics/STM32CubeG4/blob/c4132af65fe74ddd7f54aced85a0f4acce736405/Drivers/CMSIS/Device/ST/STM32G4xx/Source/Templates/system_stm32g4xx.c#L188

As alternative, Cube should define USER_VECT_TAB_ADDRESS in the project settings (and it must match the target address).

TDK
Guru

This is a deliberate design choice by ST. Unfortunately, they don't consider this a bug.

The solution is to #define USER_VECT_TAB_ADDRESS in your system_*.c file. By default it is commented out.

See:

https://community.st.com/t5/stm32-mcus-products/hal-delay-stuck-systick-not-triggered-workaround-for-stm32f105/m-p/585510

 

If you feel a post has answered your question, please click "Accept as Solution".
Pavel A.
Evangelist III

Maybe. Then the bug should be reported against the CubeMX/IDE generator not creating a viable project from the template.