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

Need a simple terminal program to communicate with BLE UART service

We need a simple program that can be used as a terminal program on Windows (with nRF52840 dongle attached) to a remote device running the BLE UART service.

Essentially, this would be the same as the android nRF UART 2.0 app, but runs on Windows.  I've seen this topic talked about in multiple threads, but not with a clear solution.  This would be used with the Nordic nRF52840 dongle.

In a perfect world, this is a simple c app that builds under gcc (cygwin?).  As a secondary option, a full python app would be "okay", but we've seen notably slower performance in python than in a compiled windows app.

We would then modify this app appropriately to meet our needs, but if it has the functionality of that android app we'd be 90% there.

The nRF Connect app is much bulkier than what we want, and displays only in hex (not ASCII text), and doesn't appear to support logging.

  • Hi 

    Would it be sufficient to set up the dongle as a BLE to USB CDC bridge, and use a terminal program on Windows to connect to the dongle, or do you need to be able to build your own interface on top?

    If you need more functionality on top then pretty much all the Windows development environments supports connecting to serial port devices, assuming you set up this in the dongle.

    Best regards
    Torbjørn

  • A simple terminal program would work fine if the dongle did BLE<-->USB-CDC, but there needs to be commands for controlling the BLE connections such as scanning for other devices, and selecting one to connect with.  Basically, the same thing a dial-up modem needs to do but BLE vs. POTS.

  • Hi

    Would it be acceptable to interleave the commands with the normal CDC data, using some kind of escape character (that would not occur during normal communication), or would you need a separate dedicated control channel?

    I should be able to provide an example showing how to combine the USB CDC and the ble_app_uart_c example, but the existing example simply tries to connect to anything advertising the UART service, it does not allow control over the comport. 

    Because of the modular structure of the USBD driver it is quite straight forward to add a second CDC comport, but some work would have to be done to set up a command interface and have the ble_app_uart_c controlled from the CDC interface. 

    Best regards
    Torbjørn

  • Hayes modem style is fine as that solved the problem well for common channel link control.

    We dozens of devices advertising in our vicinity, so we need some ability to select the device to connect to, and command the tear-down of the connection as well.

  • Hi 

    I have included an example that I believe should provide a good starting point for what you need:

    usbd_ble_uart_c_v3.zip

    It combines the CDC ACM example with the ble_app_uart_c example, and includes project files for both the nRF52840DK and the nRF52840 dongle. 

    The function used to process incoming data from the CDC port is called cdc_acm_user_ev_handler(..), on line 714 of main.c. 
    Inside this handler the APP_USBD_CDC_ACM_USER_EVT_RX_DONE case will run when more data is received from the CDC port, and in here it should be possible to add some code to detect incoming commands and separate them from normal data.

    Best regards
    Torbjørn

Related