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

nRF9160 DK lte_ble_gateway sample write characteristic

Hi,

I am trying to use the Bluetooth low energy capability of the nRF9160 DK (nRF52840 chip) by using the lte_ble_gateway sample from Nordic. After changing some lines of code, I am able to establish a BLE connection with a smartphone (app acts as BLE server/peripheral) and discover the service and characteristics.
The problem I am facing is the following.
I want to write a value on the discovered characteristic, but the only function I could imagine to be a reference is the "bt_gatt_write(...)".
Could someone please provide me a sample, reference, guide or hint on how to manipulate the discovered characteristics on nRF9160 DK as BLE client?
Untill now it seems to me, that there is no simple template function prepared (like e.g. write_chrc( conn_params, buf, len )).

Best regards.

  • Hi,

     

    Could you explain a bit about your application?

    What is the end-goal here? Do you want to use the nRF52840 standalone, ie not connected to the nRF9160 at all? Or are you looking to developing a BLE-LTE bridging application?

    If you only need bluetooth, I would strongly recommend that you get a nRF52840-DK and continue developing on that platform instead.

     

    The lte_ble_gateway sample works in such a way that the nRF52 device is programmed with bluetooth HCI (UART), and the nRF9160 connects to it over UART and sends specific HCI commands to it, to make it search for a thingy and connect to it, meaning that the host layer runs on the nRF9160 application processor.

    The bluetooth GAP/GATT parts, where it states what UUIDs etc to look for is in the samples/nrf9160/lte_ble_gateway/src/ble.c file.

    Since the lte_ble_gateway example uses the zephyr bluetooth API, the API calls are basically the same as any other bluetooth LE example in NCS or zephyr.

     

    As a GATT client (a central), you can send data to a GATT server (a peripheral), via bt_gatt_write(). You can look at other central profile implementations, like nus_c.c:

    https://github.com/NordicPlayground/fw-nrfconnect-nrf/blob/master/subsys/bluetooth/services/nus_c.c#L86

     

    Kind regards,

    Håkon

  • Hi Håkon,

    thanks for the reference sample, I will try it that way.

    The application shall include a bidirectional wireless communication through two switchable channels - a BLE channel and a NB-IoT channel. Furthermore there should be a communication between modem and BLE module to organize a clean switch between the channels to save energy and avoid data loss.
    In general I would prefer a solution with an additional central processor/controller to manage the whole application including a user interface (buttons and leds), but in order to safe space and lower costs I thought about using the M33 application processor of the nRF9160 as the central controller.

    Best regards.

Related