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

nrf9160-dk : lwm2m FOTA pull support

Hi,

I'm experimenting with the lwm2m sample on the nRF9160-DK and I enabled the firmware update pull support through a COAP to HTTP proxy :

CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_SUPPORT=y
CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_SUPPORT=y
CONFIG_LWM2M_FIRMWARE_UPDATE_PULL_COAP_PROXY_ADDR="coap://MY_IPV4:5682"
CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=16
then simply added :
	if (last_block) {
		LOG_INF("Firmware update done. Rebooting");
		boot_request_upgrade(true);
		sys_reboot(SYS_REBOOT_WARM);
	}
and the end of firmware_block_received_cb and used the COAP to HTTP proxy from linarotechnologies/cf-proxy-coap-http as provided by the docker container:
version: '3'

services:
  firmware-server:
    image: opensourcefoundries/nginx:latest
    container_name: firmware-server
    volumes:
      - ./workspace-code/MCU/build/zephyr:/usr/share/nginx/html
  cf-proxy-coap-http:
    image: linarotechnologies/cf-proxy-coap-http:latest
    container_name: cf-proxy-coap-http
    ports:
      - "5682:5682/udp"
    links:
      - firmware-server:firmware-server
but the process doesn't always go smoothly especially if I trigger the update (writing http://firmware-server/app_update.bin to resource 5/0/1) right after the registration. I have a feeling that that there's a deadlock with the COAP stack and everything gets stalled. Is the push method rather recommended here? Thanks
Parents Reply Children
  • Thanks,

    Not sure what did the trick, ultimately I restarted the COAP to HTTP proxy which I assume one of the tentatives placed in an unexpected state. As used by the branch, I increased the COAP acknowledge timeout and LwM2M update interrval 

    CONFIG_COAP_INIT_ACK_TIMEOUT_MS=15000
    CONFIG_LWM2M_ENGINE_DEFAULT_LIFETIME=90

    along with the maximum length for the COAP extended options field

    CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=32

    and things now look pretty robust.
Related