Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
5 years, 2 months ago.
Is it possible to scan periodic advertising on coded phy and scan on 1M Phy in parallel?
Hi all,
Can Mbed OS support scan on multiple phy simultaneously?
I'm exploring if it is possible to carry out the following 3 tasks on NRF52840 DK in parallel? (Time shared): 1. scan on 1M phy 2. periodic scan on coded phy - try to maintain periodic advertising while scanning on 1M phy 3. advertising on coded phy
Can anyone provide me some suggestions/ insight on how to do it? One concern is that the scan on 1M phy / advertising on coded phy could cause loss of sync for periodic scan. I recon some kind of resource reservation / scheduling could prevent this? Does Mbed OS have any scheduling in place already to help on this?
Thanks for you attention, Carl
1 Answer
5 years, 2 months ago.
Hi Carl,
The BLE link layer is in charge of RF task scheduling, so you don't need to handle it in your application.
But it is important that how you set all the scan/advertise parameters, those interval and window shouldn't be too dense, or some task might not get the resources, because the priority of scanning or advertising are fixed already and there is no priority inversion in it.
Thanks, Desmond
Thanks Desmond. That's very helpful.
When you say the priorities of scanning and advertising are fixed, which one has higher priority? Can you please point me to the files where the RF scheduling is done? I'm keen to find out some details.
Cheers, Carl
posted by 27 Aug 2019Hi Carl,
You can check reschPolicy
and the policy macro in this file
Thanks, Desmond
posted by 28 Aug 2019Thanks Desmond, appreciated.
I did some quick experiments using 2 nRF52840 DKs (Mbed OS 5.13.1) but seems that as soon as I turned on 1M phy scan in parallel with coded phy scan (also adv on coded phy), the scan on coded phy stopped - no more advertising reported found on the coded phy while adv reports on the 1M phy keep coming. As soon as scan on 1M phy is stopped, I can see code phy scanning works well.
I am using fairly sparse advertising and scanning parameters to avoid conflict for now: adv interval 1000ms, scan interval 800ms with a window of 75ms (coded scan) and interval 800ms /window 37.5ms on 1M phy.
I tried code phy scan on the third DK and I can see the advertising on coded phy is working as normal.
I've configured both 1M phy scand and coded phy scan to run indefinitely (duration of 0). Also please note that due the bug https://github.com/ARMmbed/mbed-os-example-ble/issues/258 (periodic advertising broken), the code phy is just scan on normal extended non-connectable advertising).
So is this normal? Or should I raise a bug?
Thanks again, Carl
posted by 29 Aug 2019Hi Carl, Yes, please raise an issue here https://github.com/ARMmbed/mbed-os/issues. Since this may need more digging, would you also attach your code on GitHub and share it with us?
Thanks, Desmond
posted by 30 Aug 2019Hi Desmond,
I've created a minimum example to demonstrate the issue: https://github.com/lichangche/mbed-os-example-ble/tree/master/dual_phy_scan
Also raised Github issue: https://github.com/ARMmbed/mbed-os/issues/11397
Thanks a lot for your kind help, Carl
posted by 02 Sep 2019