help getting a BLE end to end application working

I am trying to get an end to end BLE application working. I have an nRF52832 board that is running peripheral_uart. It is advertising and sending a text stream to the connected device. If I run "nRF Toolbox" on my iPhone I can connect to the nRF52832 and see the BLE strings come across every N seconds as setup in my program. I have a nRF9160DK board that I want to be able to see the BLE text strings in the nRF52840 on the nRF9160DK board and send those strings to the nRF910 on the nrf9160DK board.

I am using samples/hci_uart in the nRF52840 and samples/central_uart in the nRF9160.. I have not looked at BLE in a very long time so I may have the wrong programs. Are these the correct projects to create an end to end BLE application?

first I want to connect to my advertising device and see the notifications with the text strings in the nRF52840. is hci_uart the correct program? I have made no changes in this program except to print a message on startup. I can build and flash into the RF52840 (SW10 set to nRF51) but I do not see anything printing on any of the 3 created COM ports and I do not see a connection on my advertising device. It is still advertising and not connected to anything.

second I want to get the strings from the nRF82840. I am running the central_uart in the nRF9160 (SW10 set to nRF91). I do see startup messages as show below but it keeps rebooting with a timeout as shown below

*** Booting nRF Connect SDK v2.5.0 ***
Starting central_uart
Passed register authorization callbacks.
Passed register authorization info callbacks.
ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:338
command opcode 0x0c03 timeout with err -11

*** Booting nRF Connect SDK v2.5.0 ***
Starting central_uart
Passed register authorization callbacks.
Passed register authorization info callbacks.
ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:338
command opcode 0x0c03 timeout with err -11

This is for an end to end production system so any help you can give to get BLE strings from my nRF52832 to the nRF9160 would be greatly appreciated.

Parents
  • Hi again, 
    As I mentioned earlier you should do this: 
    My suggestion is to get familiar with how you can use BLE on the nRF9160 DK before you move to UART (NUS) application. Please take a look at the lte ble gateway sample

    The sample may need a Thingy52 to test with, but if you don't I think the first step is to see how the setup is done on the nRF9160 and the nRF52840 to make it scan. 

    You would need to get familiar with the BLE central code in ble.c file. 
    My suggestion is to first try to get familiar with BLE central and peripheral code for nRF52 first (host + controller on the same chip) before you move to the nRF9160+nRF52840 setup.
    Try testing central_uart and peripheral_uart on 2 nRF52s. Study the code there on the central and implement it to the lte_ble_gateway. 

  • Hung Bui

    the lte ble gateway application tells you to load the samples/bluetooth/hci_lpuart application into the nRF9160DK board with SW10 set to nRF52. I did that with the following build configuration:

    1. Board Target - nrf9160dk/nrf52840  Revision - 0.14.0

    2. Base Configuration files - prj.conf   boards/nrf9160dk_nrf52840.conf

    3. Base Devicetree Overlays - boards/nrf9160dk_nrf52840.overlay

    It builds and flashes fine but I see nothing on any of the 3 COM ports created by the nRF9160DK board on power up.

    I then built samples/cellular/lte_ble_gateway  as mentioned with SW10 set to nRF91 using the following:

    1. Board Target - nrf9160dk/nrf9160/ns  Revision - 0.14.0

    2. Base Configuration files - prj.conf   boards/nrf9160dk_nrf9160_ns.conf

    3. Base Devicetree Overlays - boards/nrf9160dk_nrf9160_ns.overlay

    it builds and flashes fine and does print out information but it fails quickly with a timeout. see below.

    so I am using the programs you suggested they are building but I still have the following questions.

    1. how do I get the hci_lpuart to print to the serial terminal?

    2. how do I get the gateway program to connect to LTE?

    3. how do I connect to mynRF52832 that is BLE advertising and receive the strings it is sending every 10 seconds?

    *** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
    *** Using Zephyr OS v4.0.99-f791c49f492c ***
    [00:00:00.395,843] <inf> lte_ble_gw: LTE Sensor Gateway sample started
    [00:00:00.396,026] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.643,463] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    ASSERTION FAIL [success] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:432
    command opcode 0x0c03 timeout
    [00:00:10.406,585] <err> os: r0/a1: 0x00000003 r1/a2: 0x00000000 r2/a3: 0x00000002
    [00:00:10.406,585] <err> os: r3/a4: 0x00000003 r12/ip: 0x20019a60 r14/lr: 0x00010177
    [00:00:10.406,616] <err> os: xpsr: 0x01000000
    [00:00:10.406,616] <err> os: Faulting instruction address (r15/pc): 0x00010184
    [00:00:10.406,646] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:10.406,707] <err> os: Current thread: 0x2000f2b8 (unknown)
    [00:00:10.460,998] <err> os: Halting system

  • Hello Hung,

    I am working with Timothy and I can verify that the changes you recommended for the first red line error are corrected with your two CONFIG_TFM_PROFILE_TYPE... lines but with the proviso that they are done in the nRF9160 project rather than the nRF52 project. Thanks.

    Burt

  • Hi Burt, 
    Thanks for the info. So my understanding is that now all is good and you can proceed with the lte_ble_gateway  correct

  • Hung Bui

    No all is not good! I cannot connect to the custom board running peripheral_uart. all that Burt is saying is that the first red message is not there as you mentioned.

    the problem is exactly the same

    1. what does the 1 message in Red mean?

    2. how do I make the UART services connection to my device? What am I missing? my device is a custom board with a nRF52832 running peripheral_uart. this is advertising and connecting via the UART services in nRF Toolbox. I can see the strings being sent every 10 seconds in nRF Toolbox. I need to see them in the nRF9160.

    3. how do I connect to my advertising nRF52832 board running hci_lpuart?

    4. how do I receive the strings being sent when there is a connection?

    5.how do I see the strings on nRF Cloud? what LTE device do I create? do I create the nRF9160DK device or do I create a device with my custom nRF52832?

    6. If I create the LTE device on nRF Cloud using my custom nRF52832 where do I get the device ID and the PIN I need to create the LTE device?

    could you please answer these questions.

    thank you for your help this is for a production system that needs to send strings from nRF52832 over BLE to the cloud.

  • Hung Bui

    this is the message on the COM port.

    *** Booting nRF Connect SDK v3.0.2-89ba1294ac9b ***
    *** Using Zephyr OS v4.0.99-f791c49f492c ***
    LTE Sensor Gateway sample started Version: 0.1 Date: 10/30/25
    [00:00:00.384,857] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.633,514] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    [00:00:01.151,824] <inf> bt_hci_core: HW Platform: Nordic Semiconductor (0x0002)
    [00:00:01.151,855] <inf> bt_hci_core: HW Variant: nRF52x (0x0002)
    [00:00:01.151,885] <inf> bt_hci_core: Firmware: Standard Bluetooth controller (0x00) Version 137.20634 Build 2617349514
    [00:00:01.169,769] <inf> bt_hci_core: Identity: EE:F0:7B:84:FC:21 (random)
    [00:00:01.169,799] <inf> bt_hci_core: HCI: version 6.0 (0x0e) revision 0x10f3, manufacturer 0x0059
    [00:00:01.169,830] <inf> bt_hci_core: LMP: version 6.0 (0x0e) subver 0x10f3
    [00:00:01.169,860] <inf> lte_ble_gw: Bluetooth ready
    [00:00:01.182,861] <inf> lte_ble_gw: Scanning...
    +CEREG: 2,"9E03","026B8102",7
    +CSCON: 1
    +CEREG: 5,"9E03","026B8102",7,,,"11100000","11100000"
    [00:00:12.039,337] <inf> nrf_cloud_info: Device ID: nrf-351901936291081
    [00:00:12.039,733] <inf> nrf_cloud_info: IMEI: 351901936291081
    [00:00:12.040,283] <inf> nrf_cloud_info: Modem FW: mfw_nrf9160_1.3.4
    [00:00:12.040,313] <inf> nrf_cloud_info: Protocol: MQTT
    [00:00:12.040,344] <inf> nrf_cloud_info: Download protocol: HTTPS
    [00:00:12.040,344] <inf> nrf_cloud_info: Sec tag: 16842753
    [00:00:12.040,405] <inf> nrf_cloud_info: Host name: mqtt.nrfcloud.com
    [00:00:19.320,587] <err> nrf_cloud_transport: Failed to save session state: -2
    [00:00:19.321,380] <inf> lte_ble_gw: Initializing GNSS
    [00:00:19.327,087] <inf> lte_ble_gw: GNSS initialized
    [00:00:19.329,772] <inf> lte_ble_gw: GNSS started with interval 30 seconds, and timeout 15 seconds
    [00:00:19.329,833] <inf> nrf_cloud_info: Team ID: 45c9165d-a392-4543-96c3-d17ba0aaf166
    [00:00:19.330,017] <inf> lte_ble_gw: Requesting A-GNSS Data
    +CSCON: 0

  • Hi Timothy, 
    The nRF52 has nothing to do with nRF Cloud. 

    What I meant when I say " mak sure nRF9160 works first" is that you need to test with other sample of nRF9160 and make sure it can communicate and send data to the cloud. 

    The lte_ble_gateway has nothing to do with the NUS/UART service. So you shouldn't expect it to send any string on nRF Cloud. You are expected to write code to achieve what you need as I don't see we have any example doing exactly what you need. lte_ble_gateway is the closest one ( please read the documentation to see what it does). 

    Have you followed my link to add: 

    CONFIG_SETTINGS=y
    CONFIG_SETTINGS_FCB=y
    CONFIG_FCB=y

    To the configuration?

    RE: nrf_cloud not connecting in thingy91X



    If you are not so familiar with the nRF9160 please take my recommendation to go through the Nordic Academy course: https://academy.nordicsemi.com/courses/cellular-iot-fundamentals/

    You need to be able to do a simple MQTT sample before moving to BLE + nRF9160 application . https://docs.nordicsemi.com/bundle/ncs-latest/page/nrf/samples/cellular/nrf_cloud_mqtt_device_message/README.html

Reply Children
No Data
Related