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

BLE usage on Thingy:91 with HCI_UART

Hi,

I am trying to develop an application for Thingy:91, which would allow me getting data from BLE and sending it to the cloud with LTE. I am working on NCS 1.3.0.

Of course the 'default' way to do it would be just to use lte_ble_gateway sample, but as you know it is not ported to the NCS 1.3.0. This issue has been noted  in this topic, where 8 months ago there was released a patch by to the NCS 1.1.0, but there was no updates for newer NCS since that time.

I tried to manually patch all necessary files, according to .diff files included by Sigurd, but I run into compilation errors I couldn't resolve. The problem was that in the file board.c that has been added in this patch in there are two defines DT_GPIO_P0_DEV_NAME and DT_GPIO_P1_DEV_NAME, which are not declared and apparently not used in the 1.3.0 or maybe used with other names:

p0 = device_get_binding(DT_GPIO_P0_DEV_NAME);
+	if (!p0) {
+		LOG_ERR("GPIO device " DT_GPIO_P0_DEV_NAME "not found!");
+		return -EIO;
+	}
+
+	p1 = device_get_binding(DT_GPIO_P1_DEV_NAME);
+	if (!p1) {
+		LOG_ERR("GPIO device " DT_GPIO_P1_DEV_NAME " not found!");
+		return -EIO;
+	}

I am attaching the patch package posted by Sigurd in that topic:

lte_ble_gateway_thingy91.zip

I am going to use another cloud for my usage, so the lte_ble_gateway sample is not the one I need to use, but I believe it is the closest to what I want and it's a good starting point for developing application sending data gathered from BLE.

My main question would be:

- how can I actually access data gathered on nRF52 chip on Thingy:91 to send it with LTE? Is there any solution that works on NCS 1.3.0?

If the only way is porting the HCI_UART and developing application on lte_ble_gateway sample,

- are you planning to release any official patches so that HCI_UART works on Thingy:91?

if no,

- would you have any tips as to how manually port HCI_UART sample to NCS 1.3.0?

I will be grateful for any help.

Maciek

Parents Reply Children
  • Hey Oyvind, thank you for quick reply!

    Yes, Connectivity Bridge did work - I could see the output from nRF91 application on the BLE TX characteristic, but the communication seemed to be not bidirectional. The data written on BLE RX characteristic did not appear in the serial terminal (I was using LTE Link Monitor for that purpose).

  • Maciek, can you please elaborate on what you are trying to achieve when using the Connectivity Bridge? Please add a more detailed plan with what each device shall do.
    Thank you!

  • Hey Oyvind,

    As usual - things started working after I asked about them... I had an at_client programmed on nRF91 chip and connectivity bridge on nRF52 SoC. I was trying to send AT commands by writing them on the RX characteristic, but it turned out the terminal I was using was not appending CR and LF, so the messages had no effect and were not causing any output. Now I am adding CR and LF manually and it works.

    So now I have the mentioned above configuration - at client on nRF91 and connectivity bridge on nRF52 SoC. As far as I understand, what happens now is that the data I write on BLE RX characteristic is received on BLE interface on nRF52 SoC and then is sent over UART_1 interface to nRF91 chip. Is that correct?

    If so, is there any sample application for nRF91 which would present how to access data received on UART_1 interface on nRF91 chip on Thingy:91?

    What I want to achieve is to get data from BLE devices (like heart rate sensors for example) and send it to the cloud. What I believe I should do is modify the connectivity bridge to scan and connect to my devices and then forward the data it gets to the nRF91 chip. I'm guessing I will then need some callback from UART interface on nRF91.

  • Hi Maciek, 

    I'm sorry, I may have misled you. Using the Connectivity Bridge you are not able to do what you are asking about. This is what hci_uart should be used for, along with e.g. peripheral_hr. See this github post

    I had a chat with , and he will look into porting the lte_ble_gateway sample to NCS v1.3.0. Do note that it is not an official sample for the Thingy:91. 

    Kind regards,
    Øyvind

  • Hey Oyvind,

    Thanks for information. I've been working with Connectivity Bridge now, trying to combine it with Zephyr's central_hr sample which worked well on the nRF52DK. central_hr is scanning for heart rate sensors in the area and getting their readings.

    I've managed to transfer data over UART_0 between nRF91 and nRF52 on Thingy, so I guess all that's left is to get the data I need on nRF52.

    Is that a bad approach? Or will that be somehow cumbersome to migrate zephyr's central_hr to connectivity bridge?

    Also, why in this case would I use the peripheral app on Thingy? Thingy should connect directly to heart rate sensor, so if I'm not mistaken it will act as central and the sensor would be peripherals.

    Regards,

    Maciek

Related