Skip to content

Guide to enable STDIO over bluetooth (using nimble)

Hendrik van Essen edited this page Oct 10, 2019 · 2 revisions

Beside USB-serial you can also access for example the device's shell via bluetooth. The following guide will explain how you enable this feature for your application on supported devices (e.g. nrf52dk)

  1. Enable the stdio-module by including USEMODULE += stdio_nimble in your application's Makefile
  2. (optional) UART can be disabled with CFLAGS += -DSTDIO_NIMBLE_DISABLE_UART, otherwise UART runs and can be used in parallel to the bluetooth connection
  3. To use automatic advertising of the device include USEMODULE += auto_nimble_advertise in your application's Makefile. It will take care to enable advertising on disconnect and disable on connect.
  4. Define the device name with CFLAGS += -DAUTO_NIMBLE_ADVERTISE_DEVICE_NAME='"name"'

At the moment the following change in nimble is REQUIRED:

After calling make open the file bin/pkg/nrf52dk/nimble/nimble/host/src/ble_gap.c and search for the function ble_gap_notify_tx_event. Before the line ble_gap_call_conn_event_cb(&event, conn_handle); add the following line: ble_gap_event_listener_call(&event);. That's it.

You can download the matching android app (source) which was developed specifically for this module at the Google Playstore for your smartphone, but you can also use any other bluetooth developement app, like Nordics "nRF Connect"-App, available for Android and iOS.

Clone this wiki locally