This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Correct way to integrate LwM2M Carrier library with nRF9160 SDK.

Hello,

I want to integrate the LwM2M Carrier library for our firmware as we will be certifying our product from Verizon operator.

So, I am able to run the sample code of LwM2M carrier library on my nRF9160 DK module. After integrating the LwM2M carrier code with our own application, once build and run it shows: 

LWM2M Carrier library sample.
LWM2M_CARRIER_EVENT_MODEM_INIT
Certificate found, tag 411: match
Certificate found, tag 412: match
LWM2M_CARRIER_EVENT_CONNECTING
LWM2M_CARRIER_EVENT_LTE_READY
LWM2M_CARRIER_EVENT_CONNECTED

So after after if I trigger modem_configure(); to connect to LTE then error was thrown which is given below: 

LTE Link Connecting....
Failed to establish LTE connection: -120

Also, in menuconfig there is no option to make CONFIG_LWM2M_CARRIER to y/n. Even after adding CONFIG_LWM2M_CARRIER=y in prj.conf file, nothing was enabled related to LwM2M carrier code. Can you please tell me what exactly is the issue here. 

Somehow I managed to add CONFIG_LWM2M_CARRIER=y to kconfig file and it worked.

prj.conf File:

 

CONFIG_FPU=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y
CONFIG_STDOUT_CONSOLE=y
CONFIG_AT_CMD=y

CONFIG_LWM2M_CARRIER=y

# PDN library
CONFIG_PDN=y
CONFIG_PDN_CONTEXTS_MAX=3

# SMS library
CONFIG_SMS=y

# LwM2M carrier is only compiled for hard-float
CONFIG_FPU=y
CONFIG_FP_HARDABI=y

# Networking
CONFIG_NETWORKING=y
CONFIG_NET_NATIVE=n
CONFIG_NET_SOCKETS_OFFLOAD=y
CONFIG_NET_SOCKETS=y
CONFIG_NET_SOCKETS_POSIX_NAMES=y

# LTE link control
CONFIG_LTE_LINK_CONTROL=y
CONFIG_LTE_NETWORK_MODE_LTE_M_GPS=y
CONFIG_LTE_AUTO_INIT_AND_CONNECT=n
CONFIG_LTE_PSM_REQ_RPTAU="00011111"
CONFIG_LTE_PSM_REQ_RAT="00000010"

# Modem library
CONFIG_NRF_MODEM_LIB=y

# FOTA library
CONFIG_FOTA_DOWNLOAD=y
CONFIG_REBOOT=y

# Download client
CONFIG_DOWNLOAD_CLIENT=y
CONFIG_DOWNLOAD_CLIENT_STACK_SIZE=4096

# DFU Target
CONFIG_DFU_TARGET=y

# Application Upgrade support
CONFIG_BOOTLOADER_MCUBOOT=y

# Image manager
CONFIG_IMG_MANAGER=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y

# Day-Time library
CONFIG_DATE_TIME=y
CONFIG_DATE_TIME_UPDATE_INTERVAL_SECONDS=3600

# AT Host
CONFIG_AT_CMD_PARSER=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_AT_HOST_LIBRARY=y
CONFIG_AT_CMD_THREAD_STACK_SIZE=1536

# Serial port
CONFIG_SERIAL=y
CONFIG_UART_NRFX=y
CONFIG_UART_INTERRUPT_DRIVEN=y

# Have kernel output
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_UART_CONSOLE_ON_DEV_NAME="UART_0"

# MQTT
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=y
CONFIG_MQTT_CLEAN_SESSION=y
CONFIG_MODEM_KEY_MGMT=y

# Memory
CONFIG_MAIN_STACK_SIZE=4096
CONFIG_HEAP_MEM_POOL_SIZE=4096
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096


#GPIO required for GPS Amplifier enable/disable
CONFIG_GPIO=y

#Threads
CONFIG_MULTITHREADING=y
CONFIG_MAIN_THREAD_PRIORITY=7

# Storage
CONFIG_FLASH=y
CONFIG_FLASH_PAGE_LAYOUT=y
CONFIG_NVS=y
CONFIG_LOG=y
CONFIG_NVS_LOG_LEVEL_DBG=y
CONFIG_REBOOT=y
CONFIG_MPU_ALLOW_FLASH_WRITE=y


# Compiler
CONFIG_NEWLIB_LIBC=y

Modem Firmware Version: mfw_nrf9160_1.2.3

nRF Connect SDK: v1.6.0

So please tell what is the correct way to integrate the LwM2M Carrier library with nRF9160 DK, and how to establish a connection with LTE after LWM2M_CARRIER_EVENT_LTE_READY. Kindly support me how to solve this problem asap.

Thank You !

Regards,

Chetan

  • Hello,

    So after after if I trigger modem_configure(); to connect to LTE then error was thrown which is given below: 

    The modem is already connected, so there is no need to run modem_configure(). Just let the carrier_lib take care of the connection till it's done, no need to handle it separately.

  • Hello,

    I have commented modem_configure() in code, but still I am facing Hard Fault. Also, I am not sure why there is fs_nvs debug info repeated two times on console. 

    Regards,

    Chetan

  • It would be nice if you could share the code, or a sample that I can use the reproduce the issue.

  • Hello,

    I have fixed the issue of Bus Fault and I hope LwM2M carrier library is integrated properly because I could see below EVENTS are running once device is flashed. 

    Can you please confirm is it working or let me know is there any way to check the LwM2M carrier library integrated with the code successfully ?

    Thank you !

  • Hello Hakon,

    I have below questions which I encountered after integrating LwM2M Carrier library with our application code. 

    Que: 1:- In what scenario event " LWM2M_CARRIER_EVENT_DISCONNECTING " will occur ?

    Que: 2:- Can we make it possible to execute event " LWM2M_CARRIER_EVENT_DISCONNECTING " from our application side ?

    - Because we will be performing connection and disconnection of LTE modem multiple times and will be using a battery as a power supply. So, we want to keep everything disconnected at some point of time and want to wake up the device fully functional. 

    Que: 3:-  Why PSM mode is not working after integrating LwM2M carrier library with our application code ?

    Thank you !

Related