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

Connecting the nRF9160DK to the nRF52833 over Bluetooth

Hi,

I would like to set up a couple of boards communicating over Bluetooth; I was hoping someone could provide some pointers.

I would like to connect the nRF9160DK to the nRF52833DK. 

I have programmed the nRF52 on the nRF9160DK with the HCI UART code and the nRF9160 with the LTE_BLE_Gateway code. 

Is this correct?

What should I program the nRF52833 with?

Thanks,

Rod

Parents
  • Hello Rod, 

    The LTE_BLE_Gateway sample, or LTE Sensor Gateway sample, is designed to be used with the Thingy:52. It will look for Thingy (name or service UUID) and expect to find Thingy services. Your best chance is to configure the LTE Sensor Gateway sample to connect with e.g. Bluetooth Peripheral LBS

    Kind regards,
    Øyvind

  • Hi Øyvind,

    Thank you for your reply. So, just to clarify.

    1. The LTE_BLE_Gateway code is designed to run with the Thingy52 (or '91 I assume) only

    2. If I want want to connect the nRF9160DK to the nRF5233DK I should use the BT Peripheral LBS code. Do I use that on both systems? i.e on both the nRF9160DK and the nRF5233DK

    I'm having problems building the LTE_BLE_Gateway code for the nRF9160DK; please could you send me the merged.hex file for this board? I will try and get a Thingy52 to test.

    Thanks,
    Rod

  • Hi Øyvind,

    Ok, that worked, thanks. I was able to build and flash "at_client". 

    When I tried to build "lte_ble_gateway", the code is looping continually. 

    Watts-MBP-2:lte_ble_gateway Watt$ pwd
    /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway
    Watts-MBP-2:lte_ble_gateway Watt$ west build -b nrf9160dk_nrf9160ns
    -- west build: generating a build system
    Including boilerplate (Zephyr base): /Users/Watt/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway
    -- Zephyr version: 2.3.0-rc1 (/Users/Watt/ncs/zephyr)
    -- Found Python3: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 (found suitable exact version "3.8.1") found components: Interpreter 
    -- Board: nrf9160dk_nrf9160ns
    -- Found west: /Library/Frameworks/Python.framework/Versions/3.8/bin/west (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Found dtc: /usr/local/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/Users/Watt/gcc-arm-none-eabi-8-2019-q3-update)
    -- Found BOARD.dts: /Users/Watt/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns.dts
    -- Found devicetree overlay: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/nrf9160dk_nrf9160ns.overlay
    nrf9160dk_nrf9160ns.dts.pre.tmp:394.32-398.5: Warning (simple_bus_reg): /soc/cryptocell-sw: missing or empty reg/ranges property
    nrf9160dk_nrf9160ns.dts.pre.tmp:93.42-105.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@40000000/kmu@39000)
    nrf9160dk_nrf9160ns.dts.pre.tmp:202.18-208.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/uart@a000: duplicate unit-address (also used in node /soc/peripheral@40000000/i2c@a000)
      also defined at nrf9160dk_nrf9160ns.dts.pre.tmp:504.8-507.3
      also defined at nrf9160dk_nrf9160ns.dts.pre.tmp:611.8-619.3
    nrf9160dk_nrf9160ns.dts.pre.tmp:342.19-348.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@40000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@40000000/power@5000)
    -- Generated zephyr.dts: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/include/generated/devicetree_unfixed.h
    Parsing /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/Kconfig
    Loaded configuration '/Users/Watt/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160ns_defconfig'
    Merged configuration '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/prj.conf'
    Configuration saved to '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/.config'
    Kconfig header saved to '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 8.3.1
    -- The CXX compiler identification is GNU 8.3.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/Watt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc
    -- Cache files will be written to: /Users/Watt/Library/Caches/zephyr
    Changed board to secure nrf9160dk_nrf9160 (NOT NS)
    
    === child image spm - nrf9160dk_nrf9160 begin ===
    Including boilerplate (Zephyr base): /Users/Watt/ncs/zephyr/cmake/app/boilerplate.cmake
    -- Application: /Users/Watt/ncs/nrf/samples/nrf9160/spm
    -- Zephyr version: 2.3.0-rc1 (/Users/Watt/ncs/zephyr)
    -- Found Python3: /Library/Frameworks/Python.framework/Versions/3.8/bin/python3.8 (found suitable exact version "3.8.1") found components: Interpreter 
    -- Board: nrf9160dk_nrf9160
    -- Found west: /Library/Frameworks/Python.framework/Versions/3.8/bin/west (found suitable version "0.7.2", minimum required is "0.7.1")
    -- Found dtc: /usr/local/bin/dtc (found suitable version "1.6.0", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (/Users/Watt/gcc-arm-none-eabi-8-2019-q3-update)
    -- Found BOARD.dts: /Users/Watt/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160.dts
    -- Found devicetree overlay: /Users/Watt/ncs/nrf/samples/nrf9160/spm/nrf9160dk_nrf9160.overlay
    nrf9160dk_nrf9160.dts.pre.tmp:95.42-107.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/flash-controller@39000: duplicate unit-address (also used in node /soc/peripheral@50000000/kmu@39000)
    nrf9160dk_nrf9160.dts.pre.tmp:344.19-350.3: Warning (unique_unit_address_if_enabled): /soc/peripheral@50000000/clock@5000: duplicate unit-address (also used in node /soc/peripheral@50000000/power@5000)
    -- Generated zephyr.dts: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/spm/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/spm/zephyr/include/generated/devicetree_unfixed.h
    Parsing /Users/Watt/ncs/zephyr/Kconfig
    Loaded configuration '/Users/Watt/ncs/zephyr/boards/arm/nrf9160dk_nrf9160/nrf9160dk_nrf9160_defconfig'
    Merged configuration 'prj.conf'
    Merged configuration '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/child_secure_partition_manager.conf'
    Configuration saved to '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/spm/zephyr/.config'
    Kconfig header saved to '/Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/spm/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 8.3.1
    -- The CXX compiler identification is GNU 8.3.1
    -- The ASM compiler identification is GNU
    -- Found assembler: /Users/Watt/gcc-arm-none-eabi-8-2019-q3-update/bin/arm-none-eabi-gcc
    -- Cache files will be written to: /Users/Watt/Library/Caches/zephyr
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/spm
    === child image spm - nrf9160dk_nrf9160 end ===
    
    CMake Warning at /Users/Watt/ncs/zephyr/CMakeLists.txt:1384 (message):
      __ASSERT() statements are globally ENABLED
    
    
    Changed board to secure nrf9160dk_nrf9160 (NOT NS)
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build
    -- west build: building application
    [6/210] Performing build step for 'spm_subimage'
    [7/193] Preparing syscall dependency handling
    
    [188/193] Linking C executable zephyr/zephyr_prebuilt.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:         32 KB        48 KB     66.67%
                SRAM:        5416 B        64 KB      8.26%
            IDT_LIST:          40 B         2 KB      1.95%
    [193/193] Linking C executable zephyr/zephyr.elf
    [203/210] Linking C executable zephyr/zephyr_prebuilt.elf
    Memory region         Used Size  Region Size  %age Used
               FLASH:      163848 B       976 KB     16.39%
                SRAM:       58422 B       128 KB     44.57%
            IDT_LIST:         152 B         2 KB      7.42%
    [210/210] Generating zephyr/merged_domains.hex
    Watts-MBP-2:lte_ble_gateway Watt$ west flash
    -- west flash: rebuilding
    [0/9] Performing build step for 'spm_subimage'
    ninja: no work to do.
    -- west flash: using runner nrfjprog
    -- runners.nrfjprog: Flashing file: /Users/Watt/ncs/nrf/samples/nrf9160/lte_ble_gateway/build/zephyr/merged.hex
    Parsing hex file.
    Erasing page at address 0x0.
    Erasing page at address 0x1000.
    Erasing page at address 0x2000.
    Erasing page at address 0x3000.
    Erasing page at address 0x4000.
    Erasing page at address 0x5000.
    Erasing page at address 0x6000.
    Erasing page at address 0x7000.
    Erasing page at address 0xC000.
    Erasing page at address 0xD000.
    Erasing page at address 0xE000.
    Erasing page at address 0xF000.
    Erasing page at address 0x10000.
    Erasing page at address 0x11000.
    Erasing page at address 0x12000.
    Erasing page at address 0x13000.
    Erasing page at address 0x14000.
    Erasing page at address 0x15000.
    Erasing page at address 0x16000.
    Erasing page at address 0x17000.
    Erasing page at address 0x18000.
    Erasing page at address 0x19000.
    Erasing page at address 0x1A000.
    Erasing page at address 0x1B000.
    Erasing page at address 0x1C000.
    Erasing page at address 0x1D000.
    Erasing page at address 0x1E000.
    Erasing page at address 0x1F000.
    Erasing page at address 0x20000.
    Erasing page at address 0x21000.
    Erasing page at address 0x22000.
    Erasing page at address 0x23000.
    Erasing page at address 0x24000.
    Erasing page at address 0x25000.
    Erasing page at address 0x26000.
    Erasing page at address 0x27000.
    Erasing page at address 0x28000.
    Erasing page at address 0x29000.
    Erasing page at address 0x2A000.
    Erasing page at address 0x2B000.
    Erasing page at address 0x2C000.
    Erasing page at address 0x2D000.
    Erasing page at address 0x2E000.
    Erasing page at address 0x2F000.
    Erasing page at address 0x30000.
    Erasing page at address 0x31000.
    Erasing page at address 0x32000.
    Erasing page at address 0x33000.
    Erasing page at address 0x34000.
    Applying system reset.
    Checking that the area to write is not protected.
    Programming device.
    Applying pin reset.
    -- runners.nrfjprog: Board with serial number 960040578 flashed successfully.
    

  • RodWatt said:
    Ok, that worked, thanks. I was able to build and flash "at_client". 

    That's good news!  

    RodWatt said:
    When I tried to build "lte_ble_gateway", the code is looping continually. 

     I'm not sure I'm following, the output that you have attached looks good. Can you please elaborate?

    Thank you!

    Kind regards,
    Øyvind

  • Hi Øyvind,

    I have captured the terminal output below. Its reporting it can't find an LTE Link and them seems to reboot. 

    As I have just got this working, I have not set up the server side (nfcloud etc) I guess that's what causing the failure? Sorry, when I saw this initially I thought it was not finding a bootable image or similar. 

    As I'm not interested in writing to the cloud, I just want to get BLE working between the boards, I have commented out the code in main as below

    	buttons_leds_init();
    	ble_init();
    
    	work_init();
    //	cloud_init();
    //	modem_configure();
    //	cloud_connect(NULL);
    
    	while (true) {
    //		nrf_cloud_process();
    //		send_aggregated_data();
    		k_sleep(K_MSEC(10));
    		k_cpu_idle();

    This has enabled me to connect the nRF9160Dk to Thing52, I'm seeing this.

    SPM: NS image at 0xc000
    SPM: NS MSP at 0x2002bae0
    SPM: NS reset vector at 0x1245d
    SPM: prepare to jump to Non-Secure image.
    *** Booting Zephyr OS build v2.3.0-rc1-ncs1  ***
    Bluetooth Receiver Demo Started
    Initializing Bluetooth..
    Bluetooth ready
    Scanning...
    Device found: e0:54:b8:7a:61:9d (random)
    Connected: e0:54:b8:7a:61:9d (random)
    Orientation: 2

    So, I'm now back to my initial problem of connecting the nRF52833DK to the nRF9160DK

    Regards,

    Rod

  • Hi Rod, 

    I haven't been able to look much into your case, however, things are starting to normalize in the support department and that will leave more time to help you.

    Kind regards,
    Øyvind

  • Hi Øyvind,

    That would be great, thank you. (Since we talked, I modified some of the code on the Sensor gateway example so I could get an nRF52833 board to connect over BLE, I didn't get as far as sending data )

    I have also bought an NRF52840 dongle which seems to be a good fit for me.

    So, ideally I would like to be able to send sensor data from a sensor connected to the nRF52840 board (for example, a simple temperature sensor connected over I2C) back to the nRF9160DK.

    Any pointers you could provide would be much appreciated.

    Thanks,

    Rod 

Reply
  • Hi Øyvind,

    That would be great, thank you. (Since we talked, I modified some of the code on the Sensor gateway example so I could get an nRF52833 board to connect over BLE, I didn't get as far as sending data )

    I have also bought an NRF52840 dongle which seems to be a good fit for me.

    So, ideally I would like to be able to send sensor data from a sensor connected to the nRF52840 board (for example, a simple temperature sensor connected over I2C) back to the nRF9160DK.

    Any pointers you could provide would be much appreciated.

    Thanks,

    Rod 

Children
Related