2024-09-30 02:17 PM - edited 2024-09-30 02:21 PM
I am refactoring the BLE_OTA sample to work on the WB5M chipset for a custom board. I am moving the call to Delete_Sectors() from boot initialization time to when the OTAS_STM_WIRELESS_FW_UPLOAD characteristic write is performed so that I can erase different sets of flash pages (starting index and length) depending upon the context from which OTA is called rather than compiling in the starting index and page length to be updated.
I have read through the previous concerns with flash erases during characteristics updates and call:
aci_l2cap_connection_parameter_update_req(BleApplicationContext.BleApplicationContext_legacy.connectionHandle, 48, 48, 0, 400);
upon connection establishment to establish a 60 ms connection interval to allow for sufficient flash erase time. I am using flash_driver.c from the BLE_OTA sample unchanged to perform the necessary SHCI_C2_FLASH steps.
When I execute my code and attempt to erase 0x0B pages at offset 0x0800E000, I can step through the debugger and see FD_EraseSingleSector execute 'properly' 11 times, then when the erasing is complete and the call is made to SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_OFF); I get a HardFault with UFSR 0x00010000 or UNDEFINSTR == 1 which seems to imply there is memory corruption occurring. When I step through the code, it is performing a memcpy in shci_send at the time and I cannot see an issue with the memcpy itself, so I wonder if this is occurring in the M0 core firmware after receiving the shci message that I cannot debug.
Thoughts?
Using firmware stm32wb5x_BLE_Stack_full_fw.bin 1.20.0
2024-10-08 03:14 AM
hello @JayBeavers
You should ensure that the call of the SHCI_C2_FLASH_EraseActivity(ERASE_ACTIVITY_OFF) happen after the last flash operation time frame. You should also avoid any conflict between flash and RF activity. The AN5289 also should be helpful.
Best Regards.
STTwo-32
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.