BLE 5 Long Range (Coded Phy, 125 kbps) mode. How to engage?

Working on a design that requires the Boron to scan and connect to a BLE sensor using Long Range mode – i.e. Coded PHY, 125 kbps. This is required to get enough coverage in large houses.

I’m using Particle DeviceOS 2.0.0 with the VSCode IDE. I find the BLEScanParams datatype only includes version, size, interval, window, timeout, active, none of which allow selecting Coded PHY modes. There’s nothing I can find in the documentation either.

Particle’s blog entry ([Bluetooth 5 and NFC for IoT: Now available on Particle third generation devices – Particle Blog]) from June 2019 lists BLE 5 Long Range as a feature arriving in Device OS 1.3.0, so it should be there. I know it’s supported by the nRF52840 chip w/SD140, and I’ve written C code for the Nordic DevKit that uses it as well. So, how can I engage it in code using the Particle OS? Thanks in advance!

2 Likes

It’s not currently possible to enable it using Device OS APIs. There’s an open feature request for this feature, but there isn’t a timeline for it yet.

Well that is a real shame. There should be and it should be a priority now that Particle has taken away mesh.

2 Likes

I have all other features working nicely, but because Coded Phy/125 kbps is still not supported, I’m unable to make a recommendation to order 100 Boron units for pilot testing of our project. Yet this BLE 5 capability is clearly supported according to your current marketing materials.

Can anyone point me in the right direction to add this support? I don’t mind working in C, I’ve written firmware for the nRF52840 using Nordic’s SDK, and I have debugger capability. Would be happy to share any progress with others too.

1 Like

I’m also very interested in this for an application. I second @mark_pdx and am happy to help get this done if people are needed.

@spegoraro @jackpot thanks for the encouragement. I have made some progress in investigating the problem already, but need some advice first: Is it best to do this is a forum thread? Or by raising an issue in the Particle Github repo?

I now have a basic working example, by making a few mods to some of my local Device OS files. It nicely extends the range of BLE by about 50% in brief testing. But I would need help to properly file an issue, start a branch, test, and request it to be incorporated for everyone to use. Any volunteers?

Hey @zach , do you think someone from Particle can help Mark here?
Thank you!

Thanks @gusgonnet for bringing to my attention, and @mark_pdx excited to hear that you’ve done some exploration on this. Would love to get internal attention on this at Particle and talk about where this would fall on our priority list for official support.

Given that you’ve already done some great work on this, my request, if you would be so kind - can you create a Pull Request in Github for BLE 5 support with the modifications to Device OS? Testing and such would be great but if that doesn’t exist yet just label it a WIP and that will help get some internal visibility on it amongst the engineering team. In the meantime I’m also going to pull @vikram @toddparticle and @mariano into the thread who are the PM for Device OS, the Eng. Manager for Device OS, and the Solution Architect who has done a lot of customer development with BLE.

Curious what you’re using on the other side of the BLE connection in your testing? Are you connecting it to another nRF52840?

1 Like

@mark_pdx that's great that you've made progress on this, and I'd love to do some testing with it. Can you submit a Pull Request with your changes into the DeviceOS Github repo? Feel free to message me if you need help with any part of that.

1 Like

Yes, we have custom-designed sensors based on the nRF52840. The application is very timely -- in-home monitoring of basic activities and environmental temperature in homes of elderly living alone. The Boron would give us a plug-and-play cellular gateway. Just need BLE 5 Coded Phy to get reliable range in most all homes. Happy to share more about project, which was awarded a National Academy of Medicine grant.

And thank you for bringing in tech help. I will work with Mariano on a pull request.

1 Like

@mariano thank you for the offer! I have created a fork and cloned it to a local repo. But I haven’t figured out how to make Particle Workbench in VSCode use that repo instead of one of the DeviceOS releases – the command “Particle: Install Local Compiler Toolchain” only offers the official releases as choices. Any tip?

@mark_pdx you can test your application with your DeviceOS changes by using a “custom DeviceOS build” in Workbench. See the first FAQ here to see how to set that up:

Note that when you do this, you should “Flash application & DeviceOS (local)” any time that you make a change to DeviceOS. When you’re done, you’ll want to go back to a normal release and flash that, so that cloud updates will work normally again.

1 Like

@mariano Thanks for the tip, it worked for me! I have submitted Pull Request 2287 in DeviceOS, and a corresponding PR in Docs.

This is my first time contributing here so I beg your patience if I’ve done anything improperly. I did not know how to write a unit test, but did provide a sample app. You would need a BLE device to transmit to the Particle Boron in PHY_CODED to fully test. Let me know if I can help with that.

3 Likes

Well done @mark_pdx!
For those that want to interact with this from an Android device, Nordic themselves have this repo: GitHub - NordicSemiconductor/Android-BLE-Library: A library that makes working with Bluetooth LE on Android a pleasure. Seriously. which allows you to choose your preferred PHY. Coded PHY is supported in it as well.

1 Like

Very nice! Yes if you can, please share some more.

@gusgonnet Re my project, should I post more info here, or would an email exchange be better?

@mark_pdx I compiled your code and it seems to be working, but I can’t currently test it because I don’t have any devices that advertise with coded PHY. Do you know have a device that does that? Or ideally if you have the corresponding code to turn a Boron/Argon/Tracker into an advertiser that uses the CODED_PHY. I tried briefly to set that up, but I could not switch it away from the 1M PHY.

1 Like

@mariano I have sensors I designed that use CODED_PHY.

If you have a newer smartphone that supports BLE 5, you may be able to set up a CODED_PHY advertiser with the nRF Connect app (try this search on Nordic Dev Zone).

The engineers have responded to my PR with a request that it support CODED_PHY in advertiser as well as scanner mode. If I get that working, you could use another Boron as the advertiser. But it may take a few days…

1 Like

I’ve created a Pull Request for this functionality, and it is now awaiting review. It includes support for BLE Coded Phy advertising as well as scanning, with example apps that will let you test the range improvement using two Particle Boron devices.

4 Likes