cancel
Showing results for 
Search instead for 
Did you mean: 

STM32WBA65RI FlashManager stuck writing to FLASH

JFisher-Legato
Associate II

Hello,

I am working to incorporate BLE bonding into our project, and have run into a tricky issue where the Flash Manager gets stuck trying to write a key to flash. I've enabled the Flash Manager and SNVMA_NVM modules in the IOC file:

JFisherLegato_0-1758046734786.png

I'm currently using RTT Viewer for logging, and this is the output I see:

00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00000000)
00> FM_BackgroundProcess - Flash operation not complete yet, request a new time window
00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00020000)
00> FM_BackgroundProcess - Flash operation not complete yet, request a new time window
00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00020000)
00> FM_BackgroundProcess - Flash operation not complete yet, request a new time window
00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00020000)
00> FM_BackgroundProcess - Flash operation not complete yet, request a new time window
00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00020000)
00> FM_BackgroundProcess - Flash operation not complete yet, request a new time window
00> FM_WindowAllowed_Callback
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Time window granted
00> FM_BackgroundProcess - Case FM_BKGND_WINDOWED_FLASHOP - Write operation
00> HAL_FLASH_Program: Address: 0x081FE000, DataAddress: 0x2002F610 (status: 0x00020000)
(continues...)

Note: I've added the logging line in HAL_FLASH_Program. As you can see, it is the WDW bit that appears to be stuck, which to me indicates that the write did not happen fully. When I pause in the debugger and step through the code, the write works fine. However, it is failing when I let it run as a program.

I'm happy to share our IOC file directly, if that's useful.

Thank you,
Jonathan

 

1 REPLY 1
JFisher-Legato
Associate II

An interesting piece of information is that despite FLASH_Program_Burst() never being called, the FLASH_NSCR1.BWR bit is set, indicating burst write. Digging into this further!