2020-10-29 09:23 AM
Hi all,
Currently I am trying to intergrate the flash_driver from ble_RfWithFlash to my project because I was bumping in some issues with maintaining a bluetooth connection when erasing flash.
I was working with V1.3.0 so had to update the firmware stack (updated it to V1.9.0), updated the firmware accordingly using cubemx and added the following lines before the scheduler is started.
SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7);
__HAL_FLASH_CLEAR_FLAG(FLASH_FLAG_OPTVERR);
I've created a task to erase a few pages in the flash. If this task is started while ble core is idle or advertising the erase will be successfull. If the task is started while ble is connected it will not pass the following line (PESD bit set flash_driver.c) untill it disconnects.
while(LL_FLASH_IsActiveFlag_OperationSuspended());
I'm using STM32WB55RGv6 nucleo board and a slightly modified p2p-server as ble application.
What am I missing/doing wrong?
Thanks in advance,
Taxara
2020-11-19 04:52 AM
I'm still struggling with this, any help or direction will be welcome! :)
2020-11-20 09:54 AM
Hello,
There are two points to check :
1/ When you need to erase the flash, you need the RF to be idle for at least 25ms to have enough time to erase one sector. If you are locked in the checking of the PESD, it means the CPU2 blocked the flash to protect its BLE timing versus flash erase activity for ever. The only reason would be that your connection interval is shorter than 25ms.
2/ I guess the command SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7() has not been properly sent to the CPU2. When this command is succefully received on the CPU2 side, it does not set any more the PES bit so the PESD bit is never set and there is no way you are getting locked on the PESD bit checking.
However, in the case of a too short connection interval, you will get locked on the semaphore for the same reason.
Anyway, I would check the reason why SHCI_C2_SetFlashActivityControl(FLASH_ACTIVITY_CONTROL_SEM7() has not been sent properly even though this wil not solve your issue.
Regards.
2020-11-23 12:22 AM
Thanks for the reply!
I should be able to change the connection interval using the aci_l2cap_connection_parameter_update_req (example p2pServer does this when button 2 is pressed). Ill dive into this and come back here with the results.