Skip to main content
TDudl.1
Associate II
March 9, 2022
Question

HAL_FLASHEx_Erase returns HAL_Error only when TIM16 is activated in CubeMX. TIM16 is set up for 1Mhz PWM CH1. I am attempting to write to internal flash and have no issues until TIM16 is activated.

  • March 9, 2022
  • 1 reply
  • 2178 views

Additional Information:

STM32WB55

The PSC is set to 0

the ARR is set to 31

The pulse is set to 15

The problem starts when writing to internal flash after FLASHEx_Erase runs while TIM16 is activated. I tested the speeds for the given PSC, ARR and pulse, and it comes out to 1.002MHz.

Has anyone ran into this problem before?

This topic has been closed for replies.

1 reply

TDK
March 11, 2022

FLASH and TIM are independent peripherals and should not affect one another. If HAL_FLASHEx_Erase is returning HAL_ERROR, step through and determine why exactly.

See the ErrorCode and go from there. Verify error flags in flash are clear prior to the call.

"If you feel a post has answered your question, please click ""Accept as Solution""."
TDudl.1
TDudl.1Author
Associate II
March 11, 2022

I would like to believe that, but The FLASHEx_Erase only returns HAL_ERROR when the TIM16 is activated in cubeMX (even if it isn't started). If i activate TIM17 to do the same PWM 1Mhz output, the Flash can be written fine. It is specifically TIM16. (also, I have tried this on multiple boarads)