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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-09 07:18 AM
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?
- Labels:
-
Flash
-
STM32CubeMX
-
TIM
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-11 07:35 AM
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.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-11 11:34 AM
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)
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-11 11:35 AM
to be more specific. The HAL_ERROR comes from FLASH_WaitForLastOperation() which is called by FLASHEx_Erase. I even rebuilt a project and only added the TIM16 and wrote a simple flash write script and it still fails when TIM16 os active.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Email to a Friend
- Report Inappropriate Content
‎2022-03-11 11:36 AM
I also cleared Error flags before the call and it didn't help. Additionally, I am getting ErrorCode 160, but can't seem to trace back what is causing it.