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

Bluetooth Beacon Setup on Thingy 91

Hello,

I am working on an IoT project using the Thingy 91 to send sensor data via Bluetooth to a remote device. Currently, I am trying to set up a simple beacon as shown in the Zephyr samples. I would like to set up the NRF9160 as the host and the NRF52 as the controller.
Therefore, I used the LTE/BLE example in the NRF samples and flashed the NRF52 with the patched HCI/UART sample provided in this post.
However, the system keeps crashing during HCI setup (in bt_enable). The error is due to a failing k_sem_take call (return value -11) in Zephyr's hci_core.c.

Is there some issue with the driver setup?


Best regards

Nils Ruf

  • Hello Nils, 

    What tag version of NCS are you working on? Please make sure you are on tag v1.1.0 for the provided sample in the post to work. Have you applied both patches provided in the .zip file? Can you please provide some more logs showing the error?

    Kind regards,
    Øyvind

  • Hello Øyvind,

    thank you for your fast answer. I was using the latest version of NCS. After switching back to v1.1.0 I got the following CMake error during the build process for the LTE/BLE sample:

    [main] Configuring folder: _lte_ble_gateway 
    [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DBOARD:STRING=nrf9160_pca20035ns -DBOARD_DIR:STRING=C:/_PROJECTS/nordic/nrf/boards/arm/nrf9160_pca20035 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -Hc:/_PROJECTS/nordic/_nrf9160_apps/_lte_ble_gateway -Bc:/_PROJECTS/nordic/_nrf9160_apps/_lte_ble_gateway/build -G Ninja
    [cmake] Not searching for unused variables given on the command line.
    [cmake] -- Zephyr version: 2.1.99
    [cmake] -- Found PythonInterp: C:/Program Files/Python37/python.exe (found suitable version "3.7.5", minimum required is "3.6") 
    [cmake] -- Selected BOARD nrf9160_pca20035ns
    [cmake] -- Found west: C:/Program Files/Python37/Scripts/west.exe (found suitable version "0.6.3", minimum required is "0.6.0")
    [cmake] -- Loading C:/_PROJECTS/nordic/nrf/boards/arm/nrf9160_pca20035/nrf9160_pca20035ns.dts as base
    [cmake] -- Overlaying C:/_PROJECTS/nordic/_nrf9160_apps/_lte_ble_gateway/nrf9160_pca20035ns.overlay
    [cmake] Devicetree configuration written to C:/_PROJECTS/nordic/_nrf9160_apps/_lte_ble_gateway/build/zephyr/include/generated/devicetree.conf
    [cmake] warning: 'title:' in C:/_PROJECTS/nordic/nrf/cmake/../dts/bindings\sensor\rohm,bh1749.yaml is deprecated and will be removed (and was never used). Just put a 'description:' that describes the device instead. Use other bindings as a reference, and note that all bindings were updated recently. Think about what information would be useful to other people (e.g. explanations of acronyms, or datasheet links), and put that in as well. The description text shows up as a comment in the generated header. See yaml-multiline.info for how to deal with multiple lines. You probably want 'description: |'.
    [cmake] warning: 'title:' in C:/_PROJECTS/nordic/nrf/cmake/../dts/bindings\sensor\rohm,bh1749.yaml is deprecated and will be removed (and was never used). Just put a 'description:' that describes the device instead. Use other bindings as a reference, and note that all bindings were updated recently. Think about what information would be useful to other people (e.g. explanations of acronyms, or datasheet links), and put that in as well. The description text shows up as a comment in the generated header. See yaml-multiline.info for how to deal with multiple lines. You probably want 'description: |'.
    [cmake] Parsing C:/_PROJECTS/nordic/_nrf9160_apps/_lte_ble_gateway/Kconfig
    [cmake] C:/_PROJECTS/nordic/bootloader/mcuboot/zephyr/Kconfig:37: WARNING: dt_int_val is deprecated.
    [cmake] C:/_PROJECTS/nordic/zephyr/scripts/kconfig/kconfig.py: C:/_PROJECTS/nordic/nrf/boards/arm/nrf9160_pca20035/Kconfig.defconfig:53: error: couldn't parse 'default $(dt_chosen_reg_size,$(DT_CHOSEN_Z_CODE_PARTITION))': macro expanded to blank string
    [cmake] CMake Error at C:/_PROJECTS/nordic/zephyr/cmake/kconfig.cmake:216 (message):
    [cmake]   command failed with return code: 1
    [cmake] Call Stack (most recent call first):
    [cmake]   C:/_PROJECTS/nordic/zephyr/cmake/app/boilerplate.cmake:461 (include)
    [cmake]   CMakeLists.txt:21 (include)
    [cmake] 
    [cmake] 
    [cmake] -- Configuring incomplete, errors occurred!

    The build of the HCI/UART bridge also failed with the following CMake error:

    [main] Configuring folder: _hci_uart_with_usb_uart_bridge_nrf52 
    [proc] Executing command: "C:\Program Files\CMake\bin\cmake.EXE" --no-warn-unused-cli -DBOARD:STRING=nrf52840_pca20035 -DBOARD_DIR:STRING=C:/_PROJECTS/nordic/nrf/boards/arm/nrf52840_pca20035 -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=TRUE -DCMAKE_BUILD_TYPE:STRING=Debug -Hc:/_PROJECTS/nordic/_nrf9160_apps/_hci_uart_with_usb_uart_bridge_nrf52 -Bc:/_PROJECTS/nordic/_nrf9160_apps/_hci_uart_with_usb_uart_bridge_nrf52/build -G Ninja
    [cmake] Not searching for unused variables given on the command line.
    [cmake] -- Zephyr version: 2.1.99
    [cmake] -- Selected BOARD nrf52840_pca20035
    [cmake] -- Found west: C:/Program Files/Python37/Scripts/west.exe (found suitable version "0.6.3", minimum required is "0.6.0")
    [cmake] -- Loading C:/_PROJECTS/nordic/nrf/boards/arm/nrf52840_pca20035/nrf52840_pca20035.dts as base
    [cmake] -- Overlaying C:/_PROJECTS/nordic/_nrf9160_apps/_hci_uart_with_usb_uart_bridge_nrf52/nrf52840_pca20035.overlay
    [cmake] Devicetree configuration written to C:/_PROJECTS/nordic/_nrf9160_apps/_hci_uart_with_usb_uart_bridge_nrf52/build/zephyr/include/generated/devicetree.conf
    [cmake] Parsing C:/_PROJECTS/nordic/zephyr/Kconfig
    [cmake] C:/_PROJECTS/nordic/bootloader/mcuboot/zephyr/Kconfig:37: WARNING: dt_int_val is deprecated.
    [cmake] Loaded configuration 'C:/_PROJECTS/nordic/nrf/boards/arm/nrf52840_pca20035/nrf52840_pca20035_defconfig'
    [cmake] Merged configuration 'nrf52840_pca20035.conf'
    [cmake] 
    [cmake] error: SOC_FAMILY_NRF (defined at C:/_PROJECTS/nordic/zephyr/soc/arm\nordic_nrf\Kconfig:6) is
    [cmake] assigned in a configuration file, but is not directly user-configurable (has no prompt). It gets its
    [cmake] value indirectly from other symbols. See
    [cmake] http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_SOC_FAMILY_NRF.html and/or look up
    [cmake] SOC_FAMILY_NRF in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    [cmake] Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    [cmake] too.
    [cmake] 
    [cmake] CMake Error at C:/_PROJECTS/nordic/zephyr/cmake/kconfig.cmake:216 (message):
    [cmake]   command failed with return code: 1
    [cmake] Call Stack (most recent call first):
    [cmake]   C:/_PROJECTS/nordic/zephyr/cmake/app/boilerplate.cmake:461 (include)
    [cmake]   CMakeLists.txt:15 (include)
    [cmake] 
    [cmake] 
    [cmake] -- Configuring incomplete, errors occurred!

    Do I have to use an older version of Zephyr for this example to work?

    Kind regards

    Nils

  • Have you remembered to run "west update" after "git checkout v1.1.0". Please verify that you have added each patch, needed for the provided sample to run. 

    Kind regards,
    Øyvind

  • Hello Øyvind,

    I have verified that I have added each patch and I also ran 'west update' (which I forgot). The samples are compiling properly now however, HCI still does not work. During the BLE initialization I get the error "k_sem_take failed with err -11". After that the system hangs. The corresponding stack trace is shown below.

    Kind regards

    Nils

  • Hi Nils, 

    Can you please provide full output from your debug/application? 

    Error -11 is according to errno.h:

    #define EAGAIN 11       /* No more contexts */

    For k_sem_take this means "Waiting period timed out"

    Have you edited anything in the code? What are you trying to connect? 

    -Øyvind

Related