This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Matlab Bluetooth Connection with nRF52

Has anyone been able to connect the nRF52 to MATLAB using their new Bluetooth Low Energy Communication interface (https://www.mathworks.com/help/matlab/bluetooth-low-energy-communication.html)? For me, their "ble" function to connect to a BLE device times out.

Specifically, I'm using the nRF52840 with S140 v7.0.1 trying to connect to MATLAB 2020a on Windows 10.0.18636.

My device works as expected with the nRF Connect tools on both Windows and Android. When connecting via MATLAB, the nRF52 believes the connection was completed successfully and connection parameter negotiation completes normally. However, the "ble" matlab function stalls for ~30secs and returns with: "Failed to connect to device. Make sure device is within proper range and not connected elsewhere. For more information, see Troubleshooting section in Documentation."

As far as the device is concerned, it is still connected after the failure and I have to disable/enable the bluetooth via Windows Settings for it to drop the connection.

Are there any special connection requirements for MATLAB or the latest version of Windows?

Thanks!

Parents Reply Children
  • Its so great that you solved the issue! Can you tell more about how you actually solved it? I tried reading about connection parameter negotiation failed, but it all seems really confusing and I am a newbie to all of this. Maybe you can share some link or your solution. Thanks for your help! 

  • It was awhile ago, but I believe I had the acceptable connection interval on the device side set beyond what Windows was willing to provide. I was also requiring that Data Length Extension be supported and dropping the connection if it wasn't. I believe relaxing that requirement solved the problem.

    To solve your problem, I recommend investigating each point of the connection negotiation process and see where the nRF52 fails.

Related