cancel
Showing results for 
Search instead for 
Did you mean: 

STM32G474 HAL_FLASHEx_Erase returns error when TIM1 is enabled and TIM17 is used as systick

STB
Associate II

I found a strange behavior when using TIM1 / TIM17 together with HAL_FLASHEx_Erase.

I'm using CubeMX 6.9.2 to generate the project.

 

My application is using the HAL_FLASHEx_Erase function to erase some pages of the flash.

This was working fine until I enabled TIM1. When TIM1 is enabled. Basically it is enough to set the TIM1 clock source to internal using CubeMX. The flash erase function returns HAL_ERROR.

Disabling TIM17 as systick solves the problem and everything works normal. Also disabling TIM1 solves the problem.

 

Any ideas? I might have overseen some relationship between TIM1 and FLASH but I red the Refman and found nothing suspicious.

 

Regards,

Dirk.

5 REPLIES 5
Sarra.S
ST Employee

Hello @STB, which product are you using? 

Try calling HAL_FLASH_GetError 

Also, try using another timer to see if the problem is related to TIM1 specifically 

 

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 !

I'm using STM32G474VET6.

As I wrote, it can be solved by either disabling TIM1 or disabling TIM17 which was used for the SysTick.

I'm currently using as workaround TIM6 for the Systick and TIM1 for the initially intented usecase.

If you are interested in reproducing it I can send a PoC for the Nucleo-G474 board.

Regards,

Dirk

Yes, please! 

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.

Hi!

I attached the PoC. Runs on the G474-Nucleo or or the STM32G474VET6.

TIM1 is enabled and TIM17 is used as SysTick. This produces the error.

Use CubeMX to alter SysTick to TIM6 and everything works fine.

Regards,

Dirk

Could you reproduce it?

 

Regards,

 

Dirk