2021-09-08 03:47 AM
Hello!
In my app there are the master (stm32wb55) and up to three slaves (stm32wb55 too). In addition to this I need to scan the air permanently. At some point the ble stack of the central stops responding. It means that it becomes impossible to start scanning and the central stops receiving notification from slaves. This situation could be fixed by reinitialisation of the stack ( APP_BLE_Init() command) but I need to know how to prevent this. Why could this be happening?
Maybe someone had the same issue?
Best regards,
Den
2021-09-08 06:16 AM
To configure parameters for multi ble connections I used PM0271 section 5 "BLE multiple connection timing strategy".
2021-09-08 06:29 AM
Scanning window = scanning interval means you do not let any air time for the 3 established connections to exchange data as it would mean a continuous scanning. The RF block would remain in reception all the time. No slot time for the central to communicate via one of the 3 connections.
What is the purpose of keeping scanning other devices if you are interested by the 3 devices of the mask?
You have to either stop the scanning phase for a while until the 3 planned data exchanges happened and then resume the scanning phase; or you have to reduce the window size vs the interval duration.
I am sure that if you stop scanning after the 3 connections are established (test to do), you will face no issue.
2021-09-08 06:30 AM
That's ok too.
2021-09-08 06:38 AM
When there are 3 successful connection established I need to scan beacons. Besides there could be situation when I need to disconnect one device and connect another one.
2021-09-08 06:51 AM
According to 5.3 of PM0271 I set the anchor period equal to 100 ms, Maximum_CE_Length for 3 connectable devices = 20 ms, Minimum_CE_Length = 15 ms and scanning window = scanning interval = 30 ms for scanning. All devices successfully connect and the scanning starts too and repeats but once in a while after some time the ble stack doesn't respond.
2021-09-08 06:52 AM
Understood! as I wrote before, you should stop the scanning phase regularly to let some air time for the connections... or you set the scan window to half the scan interval to check whether the situation improves.
2021-09-08 06:55 AM
Ok, thank you, I'll try it.
2021-09-09 12:35 AM
I set the scan window to half the scan interval and reduced the interval between starts of scans. That didn't help.
I stucked in this loop. It occurred when no one device was connected, there was only the scanning.
/**
* wait for the new event
* note: that means that if the previous waited event occurs, it will not exit
* the while loop below.
* The system is waiting only for the last waited event.
* When it will go out, it will wait again from the previous one.
* It case it occurs while waiting for the second one, the while loop will exit immediately
*/
while ((EvtSet & EvtWaited) == 0U)
{
UTIL_SEQ_EvtIdle(wait_task_idx, EvtWaited);
}
But I added new events in the queue.
It's the different situation. Now I don't even enter the main loop.
Could I somehow reset the queue?