Krys Lasam
Krys Lasam

Reputation: 1

Looking for BLE peripheral dongle for Windows IoT core with Raspberry Pi

I am developing a UWP project to run on Raspberry Pi 3b that will advertise a Gatt Server. I based my program on the 3rd scenario in the windows IoT samples provided by Microsoft. I am using unpaired communication. Initially using the on-board BLE of the raspberry pi I get BSOD/restarts.

I narrowed the problem and suspected that it happens when:

I did find on Microsoft documentation that it only supports low bandwidth devices so I limited my mtu/packet size, and added intervals on notification.

To fix the crash issue, I added a check for session status before sending notification to each individual subscribers. This seem to solve my issue on the crash. it hasn't happened again on my recent test. I am using 10.0.17763.1397 so maybe they also have some fix.

 foreach (var client in characteristic.SubscribedClients)

{

    try{

         if (client.Session.SessionStatus == GattSessionStatus.Active)

        {
              GattClientNotificationResult result = await characteristic.NotifyValueAsync(data.AsBuffer(), client);

        }

    }

    catch(Exception ex)

    {

    //if client is not disconnected properly, like
    // bluetooth in client is turned off or becomes out of 
    //range it throws and error that on client.Session.SessionStatus

    }

}

I also restart the GATT server every 60 seconds, like stopping the advertising and creating/restarting it again every 60 seconds if no client is subscribed/connected.

Now my problem is if I try to cycle scanning-connecting-reading, after some tries (6-20 tries) my client stops detecting the device. Only rebooting the device could solve the issue as I already tried restarting radio from my app and from powershell (using devcon). It didn't solve the issue.

Since I needed a perfect stable solution. I am opting to use BLE dongle with peripheral mode. I did see suggested BLE dongles from (I couldn't reply because it was already archived).

https://social.msdn.microsoft.com/Forums/SECURITY/en-US/344fc709-7e13-499a-94ee-3c935ad503bb/ble-gatt-server?forum=WindowsIoT

but I was hoping for some proof of concept before I buy them. (I did buy a bunch of CSR BLE dongles from hardware compatibility list of microsoft but none of them work)

If anyone have already tested:

Please let me know your thoughts and how you made it work. I also saw the Bluefruit LE Friend from Adafruit but I'm not sure if it is compatible with Windows IOT.

Suggestions on my current imperfect solution are also most welcome.

Upvotes: 0

Views: 191

Answers (0)

Related Questions