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

  • 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

  • Hello Hakon,

    Sorry for the delay in response. 

    Below is the Tera Term log when I run lwm2m_carrier sample project on nRF9160 DK board and there is no LWM2M_CARRIER_EVENT_REGISTERED occurred for me. So, now in what scenario I can see the LWM2M_CARRIER_EVENT_REGISTERED event or what steps I should perform for the same. 

    Also, till date in my application I could not see any other event occurred which is mentioned in below logs. Its like same events we will encounter with our application. 

    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    LWM2M Carrier library sample.
    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    Flash regions           Domain          Permissions
    00 01 0x00000 0x10000   Secure          rwxl
    02 31 0x10000 0x100000  Non-Secure      rwxl
    
    Non-secure callable region 0 placed in flash region 1 with size 32.
    
    SRAM region             Domain          Permissions
    00 07 0x00000 0x10000   Secure          rwxl
    08 31 0x10000 0x40000   Non-Secure      rwxl
    
    Peripheral              Domain          Status
    00 NRF_P0               Non-Secure      OK
    01 NRF_CLOCK            Non-Secure      OK
    02 NRF_RTC0             Non-Secure      OK
    03 NRF_RTC1             Non-Secure      OK
    04 NRF_NVMC             Non-Secure      OK
    05 NRF_UARTE1           Non-Secure      OK
    06 NRF_UARTE2           Secure          SKIP
    07 NRF_TWIM2            Non-Secure      OK
    08 NRF_SPIM3            Non-Secure      OK
    09 NRF_TIMER0           Non-Secure      OK
    10 NRF_TIMER1           Non-Secure      OK
    11 NRF_TIMER2           Non-Secure      OK
    12 NRF_SAADC            Non-Secure      OK
    13 NRF_PWM0             Non-Secure      OK
    14 NRF_PWM1             Non-Secure      OK
    15 NRF_PWM2             Non-Secure      OK
    16 NRF_PWM3             Non-Secure      OK
    17 NRF_WDT              Non-Secure      OK
    18 NRF_IPC              Non-Secure      OK
    19 NRF_VMC              Non-Secure      OK
    20 NRF_FPU              Non-Secure      OK
    21 NRF_EGU1             Non-Secure      OK
    22 NRF_EGU2             Non-Secure      OK
    23 NRF_DPPIC            Non-Secure      OK
    24 NRF_REGULATORS       Non-Secure      OK
    25 NRF_PDM              Non-Secure      OK
    26 NRF_I2S              Non-Secure      OK
    27 NRF_GPIOTE1          Non-Secure      OK
    
    SPM: NS image at 0x10000
    SPM: NS MSP at 0x2001f250
    SPM: NS reset vector at 0x1d4ed
    SPM: prepare to jump to Non-Secure image.
    *** Booting Zephyr OS build v2.6.0-rc1-ncs1  ***
    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

    Regards,

    Chetan

  • One more doubt / question - Can we use lte_lc_register_handler with LwM2M carrier lib? As we want to use the LTE events in our application. If yes, please let me know the steps I need to follow. Because I searched about it, but could not find any solution for the same.  

    Thank You !

    Regards,

    Chetan

  • Hello ,

    I request you to please clarify my doubts on LwM2M queries.

    Thank you! 

    Regards,

    Chetan

  • Chetan Kale said:
    Can we use lte_lc_register_handler with LwM2M carrier lib?

    Yes, this should be possible.

    Chetan Kale said:
    If yes, please let me know the steps I need to follow.

    There are several applications in NCS that support the carrier library and make use of the LTE LC-handler. Have you tried a similar approach?

Related