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

  • General discussion

  • 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:

    - client is not disconnected properly, i.e. android device is not disconnected properly

    - i try to notify using IAsyncOperation<IReadOnlyList<GattClientNotificationResult>> NotifyValueAsync(IBuffer value) on all devices even on devices not properly disconnected.

    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)
             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).

    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:

    - BLE-USB-CR (RoHS)

    - BT900-US Laird

    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. 

    • Edited by krys.pat Monday, September 14, 2020 6:35 AM change in restart period
    Monday, September 14, 2020 6:26 AM