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

Parents
  • 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.

Reply
  • 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.

Children
  • 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 !

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

    You need to follow the requirements in the Mobile network operator certifications. This means that the combination of NCS 1.6.0 and mfw 1.2.3 will not be certified with Verizon. You also need to let the carrier lib handle the initial communication with Verizon, before running anything else in the application.

    Some words from the carrier lib team;

    In the Tera Term log you have shared, I do not see the LWM2M_CARRIER_EVENT_REGISTERED (LwM2M carrier — nRF Connect SDK 1.5.1 documentation (nordicsemi.com)). Are you receiving it? If you are operating in the verizon network, this event is expected once your device has registered to the carriers device management servers.

    To run a simpler test, you can build and run the lwm2m_carrier sample (nRF9160: LwM2M carrier — nRF Connect SDK 1.5.1 documentation (nordicsemi.com)), and see it that one print the REGISTERED event.

    If the device is erased before programming (so that previous bootstrap is cleared) the sequence should look like the "The following message sequence chart shows the bootstrap process:" under MCSs. Message sequence charts — nRF Connect SDK 1.5.1 documentation (nordicsemi.com).

    Disconnecting will happen when during bootstrap because the nRF9160 can not write keys to modem while the LTE link is up.

    Once the LTE_READY event has been received, the LwM2M carrier library is done with the LTE link. It should now be ok for the app to disconnect and connect at will.

    Do you have any more info regarding PSM not working? What does the "AT+CPSMS?" respond?

    Requirements on the device (that is followed in the Asset Tracker application, and LwM2M Carrier sample) are listed here Requirements and application limitations — nRF Connect SDK 1.5.1 documentation (nordicsemi.com). Common mistakes that we see is that the app calls nrf_modem_lib_init(), when it should instead be called from the LwM2M carrier library. Another one is that your application must wait for LWM2M_CARRIER_EVENT_LTE_READY before using the LTE link.

    Edit; links

Related