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

Thingy91: LTE BLE Gateway with FOTA

Hello,

I am attempting to integrate FOTA (HTTP Application Update) into a Thingy91 project on top of the LTE BLE Gateway example project.

I am on nRF Connect SDK v1.1 (tagged) with the patch provided in the following thread https://devzone.nordicsemi.com/f/nordic-q-a/52689/nrf9160-lte-sensor-gateway-on-thingy-91/217018.

The modem firmware on the Thingy91 is up to date at version 1.0.1.

 

If I add the following to the bottom of prj.conf:

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# FOTA library
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096
CONFIG_DFU_TARGET=y
CONFIG_FOTA_DOWNLOAD=y

# Application Upgrade support
CONFIG_BOOTLOADER_MCUBOOT=y

# Sample configuration
CONFIG_DOWNLOAD_HOST="s3.amazonaws.com"
CONFIG_DOWNLOAD_FILE="nordic-firmware-files/c1838e44-9d6f-4f41-990e-70b4e60770ce"
CONFIG_APPLICATION_VERSION=1

and update Kconfig with the following:

menu "Application Update (FOTA)"

config DOWNLOAD_HOST
string "Download host name"

config DOWNLOAD_FILE
string "The file to download"

config APPLICATION_VERSION
int "Application version"
default 1

endmenu

the bluetooth will fail to initialize properly.

00> Application started
00> 
00> Modem info successfully established
00> 
00> Initializing Bluetooth..
00> 
00> [00:00:00.337,677] <err> bt_driver: Unknown H:4 type 0x01
00> [00:00:00.337,707] <err> bt_driver: Unknown H:4 type 0x00
00> [00:00:00.337,707] <err> bt_driver: Unknown H:4 type 0x00
00> Establishing LTE link (this may take some time) ...
00> 
00> ASSERTION FAIL [err == 0] @ ZEPHYR_BASE/subsys/bluetooth/host/hci_core.c:340
00> 
00> k_sem_take failed with err -11
00> 
00> [00:00:10.338,012] <err> os: r0/a1: 0x00000004 r1/a2: 0x00000154 r2/a3: 0x00000000
00> [00:00:10.338,043] <err> os: r3/a4: 0x00000002 r12/ip: 0x00000000 r14/lr: 0x00021f5b
00> [00:00:10.338,043] <err> os: xpsr: 0x41000000
00> [00:00:10.338,043] <err> os: s[0]: 0x00000000 s[1]: 0x00000000 s[2]: 0x00000000 s[3]: 0x00000000
00> 
00> [00:00:10.338,073] <err> os: s[4]: 0x00000000 s[5]: 0x00000000 s[6]: 0x00000000 s[7]: 0x00000000
00> 
00> [00:00:10.338,073] <err> os: s[8]: 0x00000000 s[9]: 0x00000000 s[10]: 0x00000000 s[11]: 0x00000000
00> 
00> [00:00:10.338,104] <err> os: s[12]: 0x00000000 s[13]: 0x00000000 s[14]: 0x00000000 s[15]: 0x00000000
00> 
00> [00:00:10.338,104] <err> os: fpscr: 0x200285cc
00> 
00> [00:00:10.338,134] <err> os: Faulting instruction address (r15/pc): 0x0004292e
00> [00:00:10.338,134] <err> os: >>> ZEPHYR FATAL ERROR 4: Kernel panic
00> [00:00:10.338,165] <err> os: Current thread: 0x200285e0 (unknown)
00> [00:00:10.736,145] <err> os: Halting

Thank you for your assistance. Attaching LTE BLE Gateway project with FOTA changes.
lte-ble-gateway-with-fota.zip

Parents
  • Hello,

    have you updated NCS lately? If not, run west update to get the latest changes. Make sure line 58 in

    zephyr/boards/arm/nrf9160_pca10090/nrf52840_reset.c has the following;

    k_sleep(K_MSEC(10));

  • Hello Hakon,

    Yes, I run west west u frequently and I also ensured that the nrf52840_reset.c has the following line:

    k_sleep(K_MSEC(10));

  • For MCUboot, add file nrf9160_pca20035.overlay file to the folder ncs\mcuboot\boot\zephyr

    nrf9160_pca20035.overlay

    / {
    	chosen {
    		zephyr,bt-uart=&uart1;
    	};
    };
    
    &uart1 {
    	current-speed = <1000000>;
    	status = "okay";
    };
    
    &uart0 {
        rts-pin = <0xFFFFFFFF>;
    	cts-pin = <0xFFFFFFFF>;
    };

    when mcuboot is being compiled, you should see this in the compile log:

    -- Using application from 'C:/ncs/mcuboot/boot/zephyr'
    Zephyr version: 2.0.99
    Changed board to secure nrf9160_pca20035 (NOT NS)
    USING OUT OF TREE BOARD
    USING OUT OF TREE BOARD
    -- Loading C:/ncs/nrf/boards/arm/nrf9160_pca20035/nrf9160_pca20035.dts as base
    -- Overlaying C:/ncs/zephyr/dts/common/common.dts
    -- Overlaying C:/ncs/mcuboot/boot/zephyr/nrf9160_pca20035.overlay

    PS: I added updated "thingy91 support for lte_ble_gateway" patches here.

Reply
  • For MCUboot, add file nrf9160_pca20035.overlay file to the folder ncs\mcuboot\boot\zephyr

    nrf9160_pca20035.overlay

    / {
    	chosen {
    		zephyr,bt-uart=&uart1;
    	};
    };
    
    &uart1 {
    	current-speed = <1000000>;
    	status = "okay";
    };
    
    &uart0 {
        rts-pin = <0xFFFFFFFF>;
    	cts-pin = <0xFFFFFFFF>;
    };

    when mcuboot is being compiled, you should see this in the compile log:

    -- Using application from 'C:/ncs/mcuboot/boot/zephyr'
    Zephyr version: 2.0.99
    Changed board to secure nrf9160_pca20035 (NOT NS)
    USING OUT OF TREE BOARD
    USING OUT OF TREE BOARD
    -- Loading C:/ncs/nrf/boards/arm/nrf9160_pca20035/nrf9160_pca20035.dts as base
    -- Overlaying C:/ncs/zephyr/dts/common/common.dts
    -- Overlaying C:/ncs/mcuboot/boot/zephyr/nrf9160_pca20035.overlay

    PS: I added updated "thingy91 support for lte_ble_gateway" patches here.

Children
Related