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.

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

    Yes, this should be possible.

    I checked this point in asset tracker application and I think we can not use lte_lc_register_handler() with LwM2M carrier lib as it is used under LTE_LINK_CONTOL configuration. 

    #if defined(CONFIG_LTE_LINK_CONTROL)
    	lte_lc_register_handler(lte_handler);
    #endif /* defined(CONFIG_LTE_LINK_CONTROL) */

    Please correct me if I am wrong that if we are using LWM2M_CARRIER config then we need to disable or no need to use LTE_LINK_CONTOL config right ? Because LwM2M carrier will take care of LTE link connect, disconnect and etc events of LTE Modem in lwm2m_os.c file.

    Thank you !

    Regards,

    Chetan

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

    Yes, this should be possible.

    I checked this point in asset tracker application and I think we can not use lte_lc_register_handler() with LwM2M carrier lib as it is used under LTE_LINK_CONTOL configuration. 

    #if defined(CONFIG_LTE_LINK_CONTROL)
    	lte_lc_register_handler(lte_handler);
    #endif /* defined(CONFIG_LTE_LINK_CONTROL) */

    Please correct me if I am wrong that if we are using LWM2M_CARRIER config then we need to disable or no need to use LTE_LINK_CONTOL config right ? Because LwM2M carrier will take care of LTE link connect, disconnect and etc events of LTE Modem in lwm2m_os.c file.

    Thank you !

    Regards,

    Chetan

Children
Related