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

How to use HCI over UART interface to create Win10 app that communicates using NUS

I have a device that uses the Nordic UART Service (NUS) to provide a serial port like interface to my product.  Now I need to start working on the PC side of the system.  The ideal solution would use the BLE hardware inside the PC to connect to the NUS interface on my device as a virtual com port on the PC.  I doubt I will find that solution any time soon.

I would like to use the BLE hardware inside my PC; I can pair my device with the PC using the internal hardware so I know the PC's internal hardware supports BLE.  The problem is that I tend to write my PC code in Java (just starting to learn) and there do not appear to be any standard BLE interface libraries for Java on Windows.  For this project I am required to use Windows.

It looks like the simplest way forward is to use either the Zephyr hci_uart, hci_usb, hci_usb_h4, or Nordic's ser_s140_usb_hci.  One of these projects (along with the appropriate hardware board) would provide an HCI interface to the BLE device on the hardware.  I could then use a virtual com port connection from my Java application on the PC to access the NUS service.  But it might not be so simple because I have not as yet found any information on what is sent over the HCI interface.  I have found the Bluetooth spec that "describes the UART transport layer (between the Host and the Host Controller)" but I have not found the spec that describes the commands that are sent.  

Does the HCI interface have a simple single command that says "Start Discovery" or is there a whole lot of software required to handle the HCI interface?

My end goal is to create an application running on Windows 10 that communicates with my device over the Nordic UART Service with the application written in Java (although I would prefer C since I have 30+ years of embedded C experience, maybe 3 months of Java learning).  Whatever is the shortest path to getting the app written, debugged, and deployed is the path I would most like to take.  Any suggestions?

PS

  Microsoft does have some information about accessing BLE devices at "https://docs.microsoft.com/en-us/samples/microsoft/windows-universal-samples/bluetoothle/" but the code appears be in C# and crashes when trying to connect to my device.  It might be easier to learn C# and debug someone else's code if it turns out the HCI interface method is a no-go.

Parents
  • Hi.

    HCI is used for communication between the Bluetooth Controller, which is responsible for the radio link, and the Bluetooth Host, which contains the rest of the Bluetooth stack.

    So in most cases, you wouldn't use HCI directly, but instead use a Bluetooth Host library, which interfaces with the Controller over HCI. After some searching, it seems that BlueCove is the most used Java host. The library seems to use the built-in Bluetooth device, but I am no Java expert, so I am not quite sure.

    Another option to those you have mentioned is to use our pc-ble-driver: https://github.com/NordicSemiconductor/pc-ble-driver

    It is built around our SoftDevice, so it does not use HCI, but you should be able to achieve the same things, just with the host running on the dongle as well.

    Best regards,

    Didrik

Reply
  • Hi.

    HCI is used for communication between the Bluetooth Controller, which is responsible for the radio link, and the Bluetooth Host, which contains the rest of the Bluetooth stack.

    So in most cases, you wouldn't use HCI directly, but instead use a Bluetooth Host library, which interfaces with the Controller over HCI. After some searching, it seems that BlueCove is the most used Java host. The library seems to use the built-in Bluetooth device, but I am no Java expert, so I am not quite sure.

    Another option to those you have mentioned is to use our pc-ble-driver: https://github.com/NordicSemiconductor/pc-ble-driver

    It is built around our SoftDevice, so it does not use HCI, but you should be able to achieve the same things, just with the host running on the dongle as well.

    Best regards,

    Didrik

Children
  • As far as I can tell BlueCove does not support BLE well.  From the BlueCove.org website:

    BlueCove provides JSR-82 Java interface for following Bluetooth Profiles:
    
    SDAP - Service Discovery Application Profile
    RFCOMM - Serial Cable Emulation Protocol
    L2CAP - Logical Link Control and Adaptation Protocol
    OBEX - Generic Object Exchange Profile (GOEP) profile on top of RFCOMM and TCP

    Looks like JSR-82 was released in 2008, about 2 years before BLE spec came out in 2010 or so.  I'll research it some more.

Related