Samples hci_lpuart + lte_ble_gateway not working on thingy91 SDKs v2.4.2, v2.3.0, v2.2.0

Hi, I am programming on a thingy91 (and a nrf9160DK).
I have an app that uses hci_lpuart sample and used to be running with 1.9.1 sdk, the app is very similar to the lte_ble_gateway sample
I am migrating to a newer version (2.4.2) and I managed to make it work on my DK.
However, when I try to flash it on the thingy91, it will not be able to enable bluetooth (using bt_enable) because of what's going on with the 52 chip.
I can make both my app and the lte_ble_gw sample work on my DK (using hci_lpuart sample) but when trying to do the exact same thing on my Thingy91, nothing works and the bluetooth cannot be enable, no matter what I try.
I would like to know if I need to have any specific configuration (maybe a specific .overlay file or smth) as it's most likely that the problem comes from compatibility issues with the configuration build provided when getting the sample since I cannot even make a nordic sample work on my thingy.

Thanks for your answers.

Regards,

0x35c

Parents
  • We opened a PR.

    boards: arm: thingy91: Do not enable uart1 by default by nordic-krch · Pull Request #13407 · nrfconnect/sdk-nrf

    Disabling uart1 in thingy91 dts (for nrf52 and nrf91) helped. Since it is enabled by default it was also enabled in bootloader so it was initialized and probably uninitialized which was leading to misbehavior in application.

  • Hi, thanks for your update ! Did you test it on the sample and does it work ?

    I don't really understand where and how am I supposed to change this uart1 configuration ?

    Here is my overlay for the 52 (hci_lpuart sample)
    8358.thingy91_nrf52840.overlay

    Here is my configuration for the 91 (running my app which has been developed starting from the lte_ble_gateway and has the same stucture as the sample)

    6215.thingy91_nrf9160_ns.overlay

    If you can guide me through what needs to be change it would be very much appreciated !

    Best regards,

    0x35c

  • Yes, I tested this and it works now for me aswell.

    in both the overlay files you need to change 

    &uart1 {
    	current-speed = <1000000>;
    	status = "okay";

    to 

    &uart1 {
    	current-speed = <1000000>;
    	status = "disabled";

    and in 

    you need to add these lines
    &uart1 {
    	status = "okay";
    };
    
    The changes are mentioned clearly in these PR view
  • Yes, I tested this and it works now for me aswell.

    Did you build the lte_ble_gateway sample with this configuration board: thingy91_nrf9160_ns ? If I try to build the sample with status = "disabled"; in my overlay file I will get this compilation error:

    -- Found Python3: /home/esc/ncs/toolchains/7795df4459/usr/local/bin/python3.8 (found suitable version "3.8.2", minimum required is "3.8") found components: Interpreter 
    -- Cache files will be written to: /home/esc/.cache/zephyr
    -- Configuring done
    -- Generating done
    -- Build files have been written to: /home/esc/versions/lte_ble_gateway/build/tfm
    [153/157] Linking C executable bin/tfm_s.axf
    Memory region         Used Size  Region Size  %age Used
               FLASH:       47928 B      48640 B     98.54%
                 RAM:       14736 B        32 KB     44.97%
    [24/381] Performing install step for 'tfm'
    -- Install configuration: "MinSizeRel"
    [271/381] Building C object zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj
    FAILED: zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj 
    ccache /home/esc/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/bin/arm-zephyr-eabi-gcc -DAPP_VERSION=v2.5.0 -DEXT_API_MAGIC=0x281ee6de,0xb845acea,23298 -DFIRMWARE_INFO_MAGIC=0x281ee6de,0x8fcebb4c,23298 -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_USER_CONFIG_FILE=\"nrf-config-user.h\" -DNRF9160_XXAA -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DNRF_TRUSTZONE_NONSECURE -DPICOLIBC_INTEGER_PRINTF_SCANF -DUSE_PARTITION_MANAGER=1 -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR_SUPERVISOR__ -D__ZEPHYR__=1 -I/home/esc/ncs/v2.5.0/zephyr/include -Izephyr/include/generated -I/home/esc/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/nrf91 -I/home/esc/ncs/v2.5.0/zephyr/soc/arm/nordic_nrf/common/. -I/home/esc/ncs/v2.5.0/zephyr/subsys/bluetooth -I/home/esc/ncs/v2.5.0/zephyr/subsys/net/lib/sockets/. -I/home/esc/ncs/v2.5.0/zephyr/subsys/settings/include -I/home/esc/ncs/v2.5.0/nrf/include -I/home/esc/ncs/v2.5.0/nrf/lib/at_cmd_parser/include -Itfm/install/interface/include -I/home/esc/ncs/v2.5.0/nrf/subsys/net/lib/nrf_cloud/./include -I/home/esc/ncs/v2.5.0/nrf/subsys/net/lib/fota_download/./include -I/home/esc/ncs/v2.5.0/nrf/include/tfm -I/home/esc/ncs/v2.5.0/nrf/tests/include -Itfm/generated/interface/include -I/home/esc/ncs/v2.5.0/modules/lib/cjson -I/home/esc/ncs/v2.5.0/nrf/modules/cjson/include -I/home/esc/ncs/v2.5.0/modules/hal/cmsis/CMSIS/Core/Include -I/home/esc/ncs/v2.5.0/zephyr/modules/cmsis/. -I/home/esc/ncs/v2.5.0/modules/hal/nordic/nrfx -I/home/esc/ncs/v2.5.0/modules/hal/nordic/nrfx/drivers/include -I/home/esc/ncs/v2.5.0/modules/hal/nordic/nrfx/mdk -I/home/esc/ncs/v2.5.0/zephyr/modules/hal_nordic/nrfx/. -I/home/esc/ncs/v2.5.0/modules/debug/segger/SEGGER -I/home/esc/ncs/v2.5.0/modules/debug/segger/Config -I/home/esc/ncs/v2.5.0/modules/crypto/tinycrypt/lib/include -I/home/esc/ncs/v2.5.0/nrfxlib/nrf_modem/include -I/home/esc/versions/lte_ble_gateway/src -Imodules/nrf/subsys/nrf_security/src/include/generated -I/home/esc/ncs/v2.5.0/nrf/subsys/nrf_security/include -I/home/esc/ncs/v2.5.0/nrf/ext/oberon/psa/core/include -I/home/esc/ncs/v2.5.0/nrf/ext/oberon/psa/core/library -I/home/esc/ncs/v2.5.0/modules/crypto/mbedtls/include -I/home/esc/ncs/v2.5.0/modules/crypto/mbedtls/library -I/home/esc/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include/mbedtls -I/home/esc/ncs/v2.5.0/nrfxlib/crypto/nrf_oberon/include -I/home/esc/ncs/v2.5.0/nrfxlib/softdevice_controller/include -Wshadow -fno-strict-aliasing -Os -imacros /home/esc/versions/lte_ble_gateway/build/zephyr/include/generated/autoconf.h -fno-printf-return-value -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee --sysroot=/home/esc/ncs/toolchains/7795df4459/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros /home/esc/ncs/v2.5.0/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-pic -fno-pie -fno-asynchronous-unwind-tables -ftls-model=local-exec -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=/home/esc/versions/lte_ble_gateway=CMAKE_SOURCE_DIR -fmacro-prefix-map=/home/esc/ncs/v2.5.0/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/esc/ncs/v2.5.0=WEST_TOPDIR -ffunction-sections -fdata-sections --specs=picolibc.specs -std=c99 -MD -MT zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj -MF zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj.d -o zephyr/drivers/serial/CMakeFiles/drivers__serial.dir/home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c.obj -c /home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c
    In file included from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/toolchain/gcc.h:92,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/toolchain.h:50,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/sys/time_units.h:10,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/sys/util.h:615,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/devicetree.h:25,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:12,
                     from /home/esc/ncs/v2.5.0/zephyr/include/zephyr/drivers/uart.h:26,
                     from /home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c:7:
    /home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c: In function 'lpuart_init':
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:85:41: error: '__device_dts_ord_124' undeclared (first use in this function); did you mean '__device_dts_ord_12'?
       85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
       85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                 ^~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
      211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
          |                                     ^~~~~~~~~~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
      228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
          |                                  ^~~~~~~~~~~~~~~~~~
    /home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c:970:22: note: in expansion of macro 'DEVICE_DT_GET'
      970 |         data->uart = DEVICE_DT_GET(DT_INST_BUS(0));
          |                      ^~~~~~~~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:85:41: note: each undeclared identifier is reported only once for each function it appears in
       85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                         ^~~~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
      132 | #define _DO_CONCAT(x, y) x ## y
          |                          ^
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:85:33: note: in expansion of macro '_CONCAT'
       85 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
          |                                 ^~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:211:37: note: in expansion of macro 'DEVICE_NAME_GET'
      211 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
          |                                     ^~~~~~~~~~~~~~~
    /home/esc/ncs/v2.5.0/zephyr/include/zephyr/device.h:228:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
      228 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
          |                                  ^~~~~~~~~~~~~~~~~~
    /home/esc/ncs/v2.5.0/nrf/drivers/serial/uart_nrf_sw_lpuart.c:970:22: note: in expansion of macro 'DEVICE_DT_GET'
      970 |         data->uart = DEVICE_DT_GET(DT_INST_BUS(0));
          |                      ^~~~~~~~~~~~~
    [284/381] Building C object modules/nrf/subsys/net/lib/nrf_cloud/CMakeFiles/..__nrf__subsys__net__lib__nrf_cloud.dir/src/nrf_cloud_codec_internal.c.obj
    ninja: build stopped: subcommand failed.
    FATAL ERROR: command exited with status 1: /home/esc/ncs/toolchains/7795df4459/usr/local/bin/cmake --build /home/esc/versions/lte_ble_gateway/build
    
     *  The terminal process terminated with exit code: 1. 
     *  Terminal will be reused by tasks, press any key to close it. 
    

    I think it tells that the uart1 pin cannot be accessed (which is what we changed in the .overlay file) and I don't know how can you compile with status = "disabled"; in your thingy91_nrf9160_ns.overlay overlay file.

    I am also wondering why are you talking about the Connectivity Bridge sample ? The only 2 samples I use are hci_lpuart for the 52 chip and lte_ble_gateway for the 91 chip.

    And the builds of these 3 are independent so I don't get how changing something in applications/connectivity_bridge/app.overlay (which I never used) could affect the compilation of any other sample.

  • 0x35c said:
    Did you build the lte_ble_gateway sample with this configuration board: thingy91_nrf9160_ns ?

    Yes,

    Please see below

    0x35c said:
    I think it tells that the uart1 pin cannot be accessed (which is what we changed in the .overlay file) and I don't know how can you compile with status = "disabled"; in your thingy91_nrf9160_ns.overlay overlay file.

    I did not create any overlay file I changed the exact same way as in the PR I linked in the files

    applications/connectivity_bridge/app.overlay
    boards/arm/thingy91_nrf52840/thingy91_nrf52840.dts
    boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts

    As mentioned here 

Reply
  • 0x35c said:
    Did you build the lte_ble_gateway sample with this configuration board: thingy91_nrf9160_ns ?

    Yes,

    Please see below

    0x35c said:
    I think it tells that the uart1 pin cannot be accessed (which is what we changed in the .overlay file) and I don't know how can you compile with status = "disabled"; in your thingy91_nrf9160_ns.overlay overlay file.

    I did not create any overlay file I changed the exact same way as in the PR I linked in the files

    applications/connectivity_bridge/app.overlay
    boards/arm/thingy91_nrf52840/thingy91_nrf52840.dts
    boards/arm/thingy91_nrf9160/thingy91_nrf9160_common.dts

    As mentioned here 

Children
  • Oh okay I did not understand I had to change it directly in the source sdk .dts files. So I did that, it compiles well on both hci_lpuart sample and lte_ble_gateway.
    However, the problem persists:

    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.256,896] <inf> lte_ble_gw: LTE Sensor Gateway sample started
    [00:00:00.257,049] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.505,706] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    [00:00:04.321,807] <wrn> lpuart: req pin low when expected high
    [00:00:04.321,960] <err> lpuart: Empty receiver state:4
    ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:338
      command opcode 0x0c03 timeout with err -11
    [00:00:10.267,547] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000000  r2/a3:  0x00000002
    [00:00:10.267,547] <err> os: r3/a4:  0x2000d298 r12/ip:  0x00000010 r14/lr:  0x0002049d
    [00:00:10.267,578] <err> os:  xpsr:  0x41000000
    [00:00:10.267,578] <err> os: Faulting instruction address (r15/pc): 0x000204a8
    [00:00:10.267,639] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:10.267,669] <err> os: Current thread: 0x2000f7b8 (unknown)
    [00:00:10.489,440] <err> fatal_error: Resetting system
    [00:00:00.252,288] <wrn> lpuart: req pin low when expected high
    [00:00:00.252,380] <err> lpuart: Empty receiver state:4
    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.256,317] <inf> lte_ble_gw: LTE Sensor Gateway sample started
    [00:00:00.256,469] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.502,990] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    [00:00:06.873,809] <wrn> lpuart: req pin low when expected high
    [00:00:06.873,931] <err> lpuart: Empty receiver state:4
    ASSERTION FAIL [err == 0] @ WEST_TOPDIR/zephyr/subsys/bluetooth/host/hci_core.c:338
      command opcode 0x0c03 timeout with err -11
    [00:00:10.266,998] <err> os: r0/a1:  0x00000003  r1/a2:  0x00000000  r2/a3:  0x00000002
    [00:00:10.266,998] <err> os: r3/a4:  0x2000d298 r12/ip:  0x00000010 r14/lr:  0x0002049d
    [00:00:10.267,028] <err> os:  xpsr:  0x41000000
    [00:00:10.267,028] <err> os: Faulting instruction address (r15/pc): 0x000204a8
    [00:00:10.267,089] <err> os: >>> ZEPHYR FATAL ERROR 3: Kernel oops on CPU 0
    [00:00:10.267,120] <err> os: Current thread: 0x2000f7b8 (unknown)
    [00:00:10.488,800] <err> fatal_error: Resetting system
    [00:00:00.252,319] <wrn> lpuart: req pin low when expected high
    [00:00:00.252,410] <err> lpuart: Empty receiver state:4
    *** Booting nRF Connect SDK v2.5.0 ***
    [00:00:00.256,347] <inf> lte_ble_gw: LTE Sensor Gateway sample started
    [00:00:00.256,500] <inf> lte_ble_gw: Initializing Bluetooth..
    [00:00:00.502,990] <inf> lte_ble_gw: Establishing LTE link (this may take some time) ...
    [00:00:06.866,638] <wrn> lpuart: req pin low when expected high
    [00:00:06.866,760] <err> lpuart: Empty receiver state:4

    This is the log of what I have when I run my thingy91, which is the same as before the fix.
    I don't know if I did something wrong but for me it doesn't work...

    Again, thanks for your time !

  • Please install fresh SDK (or do a git reset --hard on your current one)

    I strongly suggest you to try NCSv2.5.0 as this is the one I am testing.

    Please try these hex files for nRF91 try below lte_ble_gateway
    merged_91.hex

    nRF52 try below (this is hci_lpuart)

    merged_52.hex

    I do not see the fault. 

    I have no other changes in my SDK

  • Thanks for the help !

    Somehow the 2 hex files you sent don't work (I still get a zephyr fatal error on bt)...

    But it made me realize that I was flashing the zephyr.hex file of hci_lpuart and not the merged.hex, which was probably causing the issue. It was working with this file on the previous sdk versions (at least 1.9.1) but I guess it does not anymore, in the end everything was fixed and my app now works perfectly !


    Again, thanks for your time and have a good day :)

    Best regards,

    0x35c

Related