Sample Apps not working.

Environment

  • nRF9151DK.
  • Using nRF tools and SDK v3.1.1 & also v3.2.3.
  • Based in New Zealand and currently on Spark network. 

Issue

Trying to run the sample app -> nrf_cloud_coap_fota but failing out of the box. If I understand the code correctly, it appears to be using `CONFIG_NET_NATIVE` which doesn't make any sense to me. I was under impression that the nrf approach to networking was to use the nrf_modem library? What's going on with this? 

Also, I tried building the asset tracker sample as an alternative approach. But this doesn't seem to be supported at current versions - it's years out of date?!? I could go through and start hacking away at all the incompatibilities, but a) that's nordic's job, and b) I don't know what I'm doing. 

Nordic - what is the plan here? Can you provide me with some working sample apps for nrf9151 for recent SDK versions. If you could verify them on the nrf9151DK, that would be ideal. 

 

Parents
  • Hello,

    Could you please share more details about how the sample is failing? Are you saying that none of the samples from the nRF Connect SDK are working on your DK? If you have some logs or error message, please share it here.

    You could also try building and running the samples from Nordic Academy to see whether those are working.

    Kind regards,
    Abhijith

  • Let's take a coap example. 

    Question 1: In your nordic academy cellular course, you seem to use a completely different approach to working with coap than you do in your examples. You will appreciate that this is confusing. With all due respect, I just want to use your product, and honestly have no interest in understanding what is inside the box. So in the coap example in ch5, the modem set up is like this:

    static int modem_configure(void)
    {
    	int err;
    
    	LOG_INF("Initializing modem library");
    	err = nrf_modem_lib_init();
    	if (err) {
    		LOG_ERR("Failed to initialize the modem library, error: %d", err);
    		return err;
    	}
    
    	
    	LOG_INF("Connecting to LTE network");
    	err = lte_lc_connect_async(lte_handler);
    	if (err) {
    		LOG_ERR("Error in lte_lc_connect_async, error: %d", err);
    		return err;
    	}
    
    	k_sem_take(&lte_connected, K_FOREVER);
    	LOG_INF("Connected to LTE network");
    	dk_set_led_on(DK_LED2);
    
    	return 0;
    }

    And this all works absolutely fine.

    But then in the sample in the nrf ilb. you use the higher level zephyr networking libraries (for example `conn_mgr_all_if_up` with an L4 network event handler to synchronise things. I had working samples using the academy code, but I can't get that code to co-exist with your samples. Why can't you stick to one appraoch?

    Question 2: Following on from above. Which approach is correct? 

    Question 3: Case in point. The following incredibly simple looking peice of code 9extracted from the multiservice sample) does not work.

    My custom coap library

    #include <zephyr/kernel.h>
    #include <zephyr/net/net_mgmt.h>
    #include <zephyr/net/conn_mgr_connectivity.h>
    #include <zephyr/net/conn_mgr_monitor.h>
    #include <zephyr/net/net_if.h>
    #include <zephyr/logging/log.h>
    #include <modem/lte_lc.h>
    #include <modem/nrf_modem_lib.h>
    // monkey
    #include "monkey_cellular.h"
    #include <monkey_global.h>
    
    
    LOG_MODULE_REGISTER(monkey_cellular, CONFIG_MONKEY_CELLULAR_LOG_LEVEL);
    
    /********************************************************************************/
    /*********************************** DEFINES ************************************/
    /********************************************************************************/
    /* Pendable events for coordination */
    #define NETWORK_READY            BIT(0)
    #define COAP_READY               BIT(1)
    #define NETWORK_DISCONNECTED     BIT(2)
    
    #define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)
    
    /********************************************************************************/
    /***************************** PRIVATE VARIABLES ********************************/
    /********************************************************************************/
    static K_EVENT_DEFINE(cellular_events);
    static bool initialized = false;
    
    /********************************************************************************/
    /***************************** PRIVATE FUNCTIONS ********************************/
    /********************************************************************************/
    
    /* L4 network event handler - monitors connection state */
    static void l4_event_handler(struct net_mgmt_event_callback *cb,
                                 uint64_t event, struct net_if *iface)
    {
        if (event == NET_EVENT_L4_CONNECTED) {
            LOG_INF("Network connectivity gained (L4 connected)");
            k_event_post(&cellular_events, NETWORK_READY);
            
            /* CoAP is ready as soon as network is up */
            k_event_post(&cellular_events, COAP_READY);
            k_event_clear(&cellular_events, NETWORK_DISCONNECTED);
            
        } else if (event == NET_EVENT_L4_DISCONNECTED) {
            LOG_INF("Network connectivity lost (L4 disconnected)");
            k_event_clear(&cellular_events, NETWORK_READY | COAP_READY);
            k_event_post(&cellular_events, NETWORK_DISCONNECTED);
        }
    }
    
    static struct net_mgmt_event_callback l4_callback;
    
    /********************************************************************************/
    /***************************** PUBLIC FUNCTIONS *********************************/
    /********************************************************************************/
    
    int monkey_cellular_init(void)
    {
        if (initialized) {
            LOG_WRN("Already initialized");
            return 0;
        }
        
        LOG_INF("Initializing cellular connectivity");
        
        /* Register for L4 network events */
        net_mgmt_init_event_callback(&l4_callback, l4_event_handler, L4_EVENT_MASK);
        net_mgmt_add_event_callback(&l4_callback);
        
        /* Enable all network interfaces */
        conn_mgr_all_if_up(true);
        
        LOG_INF("Enabling network connectivity...");
        conn_mgr_all_if_connect(true);
        
        initialized = true;
        LOG_INF("Cellular initialization complete");
        
        return 0;
    }
    
    bool monkey_cellular_await_network_ready(k_timeout_t timeout)
    {
        uint32_t events = k_event_wait(&cellular_events, NETWORK_READY, false, timeout);
        return (events & NETWORK_READY) != 0;
    }
    
    bool monkey_cellular_await_coap_ready(k_timeout_t timeout)
    {
        uint32_t events = k_event_wait(&cellular_events, COAP_READY, false, timeout);
        return (events & COAP_READY) != 0;
    }
    
    bool monkey_cellular_is_connected(void)
    {
        return k_event_test(&cellular_events, NETWORK_READY) != 0;
    }
    
    
    

    My test harness:

    #if CONFIG_MONKEY_DEBUG_CELLULAR
       /* -------------------------------------------------*/
       monkey_debug_log_subtitle("6. CELLULAR -> COAP");
       /* -------------------------------------------------*/
    
          ret = monkey_cellular_init();
          if (ret) {
             LOG_ERR("Cellular init failed: %d", ret);
             return;
          }
          
          /* Wait for network (up to 3 minutes) */
          LOG_INF("Waiting for network...");
          if (!monkey_cellular_await_network_ready(K_MINUTES(3))) {
             LOG_ERR("Network not ready");
             return;
          }
          
          LOG_INF("✓ Network ready!");
          
          /* Wait for CoAP ready */
          if (!monkey_cellular_await_coap_ready(K_SECONDS(10))) {
             LOG_ERR("CoAP not ready");
             return;
          }
          
          LOG_INF("✓ CoAP ready!");
          LOG_INF("monkey_cellular is operational");
       #endif

    prj.conf

    # ----------------------------------------------------------------------------
    # Application Utilities
    # ----------------------------------------------------------------------------
    CONFIG_EVENTS=y
    CONFIG_PICOLIBC_IO_FLOAT=y
    CONFIG_RESET_ON_FATAL_ERROR=y
    
    
    # ----------------------------------------------------------------------------
    # Memory Sizing
    # ----------------------------------------------------------------------------
     # For JSON/CBOR encoding
     ## Override in softsim!
    CONFIG_HEAP_MEM_POOL_SIZE=19000              
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    ## Override in softsim! 
    CONFIG_MAIN_STACK_SIZE=2048                 
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024
    
    
    
    
    ## Added to check file is included in output
    CONFIG_MONKEY_CONFIG_FILE_CONSOLE=y
    
    ## UART Hardware Support
    CONFIG_SERIAL=y
    
    ## Console Configuration - WHERE printk() GOES
    CONFIG_CONSOLE=y
    # printk() output goes to UART
    CONFIG_UART_CONSOLE=y
    
    ## Explicitly DISABLE RTT Console
    # printk() does NOT go to RTT
    CONFIG_RTT_CONSOLE=n
    
    ## Logging Subsystem - Core Settings
    ## Without this - LOG_XXX calls go nowhere! 
    CONFIG_LOG=y
    
    ## Redirect printk() INTO Logging System
    # This makes printk() behave like LOG_INF()
    # Without this: printk() bypasses logging, goes direct to console
    # With this: printk() enters logging system, follows backend rules
    CONFIG_LOG_PRINTK=y
    
    ## Logging Backend - WHERE LOG_*() GOES
    # Explicitly enable UART as logging backend
    CONFIG_LOG_BACKEND_UART=y
    
    ## Explicitly DISABLE Other Logging Backends
    # Logs do NOT go to RTT
    CONFIG_LOG_BACKEND_RTT=n
    # Logs do NOT go to filesystem (if FS enabled)
    # CONFIG_LOG_BACKEND_FS=n
    # Logs do NOT go to cloud (if nRF Cloud enabled)
    # CONFIG_NRF_CLOUD_LOG_BACKEND=n
    
    ## Logging Mode
    # IMMEDIATE = process logs synchronously (blocking, real-time)
    # DEFERRED = buffer logs, process in thread (non-blocking, higher throughput)
    CONFIG_LOG_MODE_IMMEDIATE=y
    
    
    
    
    
    ## Added to check file is included in output
    CONFIG_MONKEY_CONFIG_FILE_UART=y
    
    ## UART Hardware Driver
    # Enable UART peripheral
    CONFIG_SERIAL=y
    
    # Ensure driver is available
    # CONFIG_SERIAL_HAS_DRIVER=y ## Pretty sure this breaks the build - not a settable config.
    
    ## Interrupt-Driven Mode
    # Required for efficient send/receive in application code
    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    
    
    
    # General requirements - not ALLOWED with softSIM.
    CONFIG_FPU=n
    
    
    # Date/time library  
    CONFIG_DATE_TIME=y
    
    # ---- Networking Stack (REQUIRED first) ----
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024
    
    CONFIG_NET_IPV4=y
    CONFIG_NET_IPV6=y
    CONFIG_NET_IPV6_NBR_CACHE=n
    CONFIG_NET_IPV6_MLD=n
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    
    # Network connection manager
    CONFIG_NET_CONNECTION_MANAGER=y
    CONFIG_NRF_MODEM_LIB_NET_IF=y
    CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=y
    CONFIG_NRF_MODEM_LIB_NET_IF_DOWN_DEFAULT_LTE_DISCONNECT=y
    
    # LTE/Modem infrastructure
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_MODEM_KEY_MGMT=y
    CONFIG_MODEM_JWT=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_DEVICE=y
    CONFIG_MODEM_INFO_ADD_DATE_TIME=n
    CONFIG_MODEM_INFO_ADD_SIM=n
    CONFIG_MODEM_INFO_ADD_SIM_ICCID=n
    CONFIG_MODEM_INFO_ADD_SIM_IMSI=n
    CONFIG_MODEM_INFO_ADD_NETWORK=y
    
    # Network stack
    CONFIG_POSIX_API=y
    CONFIG_NET_SOCKETS_TLS_SET_MAX_FRAGMENT_LENGTH=y
    CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY=40
    
    # CoAP Client - CORE settings
    CONFIG_COAP=y
    CONFIG_COAP_CLIENT=y
    CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
    CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=192
    CONFIG_COAP_CLIENT_BLOCK_SIZE=1024
    CONFIG_COAP_CLIENT_STACK_SIZE=2048
    CONFIG_COAP_CLIENT_THREAD_PRIORITY=0
    CONFIG_COAP_CLIENT_MAX_INSTANCES=3
    
    # CBOR encoding (used by CoAP)
    CONFIG_ZCBOR=y
    CONFIG_ZCBOR_CANONICAL=n
    
    
    # Modem shared memory
    CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096
    
    # ----------------------------------------------------------------------------
    # AT Command Monitor (REQUIRED for modem operation)
    # ----------------------------------------------------------------------------
    CONFIG_AT_MONITOR_HEAP_SIZE=2048
    # CONFIG_AT_HOST_STACK_SIZE=2048
    
    
    
    # Network interface IPv4 addressing
    # Allow 2 IPv4 addresses per interface
    CONFIG_NET_IF_MAX_IPV4_COUNT=2           
    CONFIG_NET_IF_MAX_IPV6_COUNT=2           
    # 2 unicast address slots
    CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2  
    CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=2  
    
    
    
    CONFIG_NET_IF_LOG_LEVEL_DBG=y
    CONFIG_NET_CORE_LOG_LEVEL_DBG=y
    CONFIG_NET_CONN_LOG_LEVEL_DBG=y
    CONFIG_NET_ROUTE_LOG_LEVEL_DBG=y

    Now if I run this, it builds and runs. And even seems to connect. But it immediately disconnects each time, and throws these lg warnings at me:

    [00:00:00.784,729] <inf> monkey_cellular: Initializing cellular connectivity
    [00:00:01.073,577] <inf> monkey_cellular: Enabling network connectivity...
    [00:00:01.138,427] <inf> monkey_cellular: Cellular initialization complete
    [00:00:01.145,721] <inf> Airsmart: Waiting for network...
    [00:00:14.570,465] <wrn> lte_lc: Registration rejected, EMM cause: 14, Cell ID: 674159, Tracking area: 38161, LTE mode: 7
    [00:00:51.661,773] <wrn> lte_lc: Registration rejected, EMM cause: 15, Cell ID: 1696258, Tracking area: 43296, LTE mode: 7
    [00:01:27.983,245] <wrn> lte_lc: Registration rejected, EMM cause: 15, Cell ID: 1696358, Tracking area: 51488, LTE mode: 9
    [00:03:01.151,672] <err> Airsmart: Network not ready

    I can see the logs in Onomondo, when I use this code with softsim:

    I've gone through the conf with a fine tooth comb, and tried a dozen different things. Why is such a dead simple peice of code failing. If I run up the multi-service example in its original form, that will work. And it uses identical code, so it must be some sutble dependency or other config issue... This ecosystem seems to be MUCH too brittle.

Reply
  • Let's take a coap example. 

    Question 1: In your nordic academy cellular course, you seem to use a completely different approach to working with coap than you do in your examples. You will appreciate that this is confusing. With all due respect, I just want to use your product, and honestly have no interest in understanding what is inside the box. So in the coap example in ch5, the modem set up is like this:

    static int modem_configure(void)
    {
    	int err;
    
    	LOG_INF("Initializing modem library");
    	err = nrf_modem_lib_init();
    	if (err) {
    		LOG_ERR("Failed to initialize the modem library, error: %d", err);
    		return err;
    	}
    
    	
    	LOG_INF("Connecting to LTE network");
    	err = lte_lc_connect_async(lte_handler);
    	if (err) {
    		LOG_ERR("Error in lte_lc_connect_async, error: %d", err);
    		return err;
    	}
    
    	k_sem_take(&lte_connected, K_FOREVER);
    	LOG_INF("Connected to LTE network");
    	dk_set_led_on(DK_LED2);
    
    	return 0;
    }

    And this all works absolutely fine.

    But then in the sample in the nrf ilb. you use the higher level zephyr networking libraries (for example `conn_mgr_all_if_up` with an L4 network event handler to synchronise things. I had working samples using the academy code, but I can't get that code to co-exist with your samples. Why can't you stick to one appraoch?

    Question 2: Following on from above. Which approach is correct? 

    Question 3: Case in point. The following incredibly simple looking peice of code 9extracted from the multiservice sample) does not work.

    My custom coap library

    #include <zephyr/kernel.h>
    #include <zephyr/net/net_mgmt.h>
    #include <zephyr/net/conn_mgr_connectivity.h>
    #include <zephyr/net/conn_mgr_monitor.h>
    #include <zephyr/net/net_if.h>
    #include <zephyr/logging/log.h>
    #include <modem/lte_lc.h>
    #include <modem/nrf_modem_lib.h>
    // monkey
    #include "monkey_cellular.h"
    #include <monkey_global.h>
    
    
    LOG_MODULE_REGISTER(monkey_cellular, CONFIG_MONKEY_CELLULAR_LOG_LEVEL);
    
    /********************************************************************************/
    /*********************************** DEFINES ************************************/
    /********************************************************************************/
    /* Pendable events for coordination */
    #define NETWORK_READY            BIT(0)
    #define COAP_READY               BIT(1)
    #define NETWORK_DISCONNECTED     BIT(2)
    
    #define L4_EVENT_MASK (NET_EVENT_L4_CONNECTED | NET_EVENT_L4_DISCONNECTED)
    
    /********************************************************************************/
    /***************************** PRIVATE VARIABLES ********************************/
    /********************************************************************************/
    static K_EVENT_DEFINE(cellular_events);
    static bool initialized = false;
    
    /********************************************************************************/
    /***************************** PRIVATE FUNCTIONS ********************************/
    /********************************************************************************/
    
    /* L4 network event handler - monitors connection state */
    static void l4_event_handler(struct net_mgmt_event_callback *cb,
                                 uint64_t event, struct net_if *iface)
    {
        if (event == NET_EVENT_L4_CONNECTED) {
            LOG_INF("Network connectivity gained (L4 connected)");
            k_event_post(&cellular_events, NETWORK_READY);
            
            /* CoAP is ready as soon as network is up */
            k_event_post(&cellular_events, COAP_READY);
            k_event_clear(&cellular_events, NETWORK_DISCONNECTED);
            
        } else if (event == NET_EVENT_L4_DISCONNECTED) {
            LOG_INF("Network connectivity lost (L4 disconnected)");
            k_event_clear(&cellular_events, NETWORK_READY | COAP_READY);
            k_event_post(&cellular_events, NETWORK_DISCONNECTED);
        }
    }
    
    static struct net_mgmt_event_callback l4_callback;
    
    /********************************************************************************/
    /***************************** PUBLIC FUNCTIONS *********************************/
    /********************************************************************************/
    
    int monkey_cellular_init(void)
    {
        if (initialized) {
            LOG_WRN("Already initialized");
            return 0;
        }
        
        LOG_INF("Initializing cellular connectivity");
        
        /* Register for L4 network events */
        net_mgmt_init_event_callback(&l4_callback, l4_event_handler, L4_EVENT_MASK);
        net_mgmt_add_event_callback(&l4_callback);
        
        /* Enable all network interfaces */
        conn_mgr_all_if_up(true);
        
        LOG_INF("Enabling network connectivity...");
        conn_mgr_all_if_connect(true);
        
        initialized = true;
        LOG_INF("Cellular initialization complete");
        
        return 0;
    }
    
    bool monkey_cellular_await_network_ready(k_timeout_t timeout)
    {
        uint32_t events = k_event_wait(&cellular_events, NETWORK_READY, false, timeout);
        return (events & NETWORK_READY) != 0;
    }
    
    bool monkey_cellular_await_coap_ready(k_timeout_t timeout)
    {
        uint32_t events = k_event_wait(&cellular_events, COAP_READY, false, timeout);
        return (events & COAP_READY) != 0;
    }
    
    bool monkey_cellular_is_connected(void)
    {
        return k_event_test(&cellular_events, NETWORK_READY) != 0;
    }
    
    
    

    My test harness:

    #if CONFIG_MONKEY_DEBUG_CELLULAR
       /* -------------------------------------------------*/
       monkey_debug_log_subtitle("6. CELLULAR -> COAP");
       /* -------------------------------------------------*/
    
          ret = monkey_cellular_init();
          if (ret) {
             LOG_ERR("Cellular init failed: %d", ret);
             return;
          }
          
          /* Wait for network (up to 3 minutes) */
          LOG_INF("Waiting for network...");
          if (!monkey_cellular_await_network_ready(K_MINUTES(3))) {
             LOG_ERR("Network not ready");
             return;
          }
          
          LOG_INF("✓ Network ready!");
          
          /* Wait for CoAP ready */
          if (!monkey_cellular_await_coap_ready(K_SECONDS(10))) {
             LOG_ERR("CoAP not ready");
             return;
          }
          
          LOG_INF("✓ CoAP ready!");
          LOG_INF("monkey_cellular is operational");
       #endif

    prj.conf

    # ----------------------------------------------------------------------------
    # Application Utilities
    # ----------------------------------------------------------------------------
    CONFIG_EVENTS=y
    CONFIG_PICOLIBC_IO_FLOAT=y
    CONFIG_RESET_ON_FATAL_ERROR=y
    
    
    # ----------------------------------------------------------------------------
    # Memory Sizing
    # ----------------------------------------------------------------------------
     # For JSON/CBOR encoding
     ## Override in softsim!
    CONFIG_HEAP_MEM_POOL_SIZE=19000              
    CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=4096
    ## Override in softsim! 
    CONFIG_MAIN_STACK_SIZE=2048                 
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024
    
    
    
    
    ## Added to check file is included in output
    CONFIG_MONKEY_CONFIG_FILE_CONSOLE=y
    
    ## UART Hardware Support
    CONFIG_SERIAL=y
    
    ## Console Configuration - WHERE printk() GOES
    CONFIG_CONSOLE=y
    # printk() output goes to UART
    CONFIG_UART_CONSOLE=y
    
    ## Explicitly DISABLE RTT Console
    # printk() does NOT go to RTT
    CONFIG_RTT_CONSOLE=n
    
    ## Logging Subsystem - Core Settings
    ## Without this - LOG_XXX calls go nowhere! 
    CONFIG_LOG=y
    
    ## Redirect printk() INTO Logging System
    # This makes printk() behave like LOG_INF()
    # Without this: printk() bypasses logging, goes direct to console
    # With this: printk() enters logging system, follows backend rules
    CONFIG_LOG_PRINTK=y
    
    ## Logging Backend - WHERE LOG_*() GOES
    # Explicitly enable UART as logging backend
    CONFIG_LOG_BACKEND_UART=y
    
    ## Explicitly DISABLE Other Logging Backends
    # Logs do NOT go to RTT
    CONFIG_LOG_BACKEND_RTT=n
    # Logs do NOT go to filesystem (if FS enabled)
    # CONFIG_LOG_BACKEND_FS=n
    # Logs do NOT go to cloud (if nRF Cloud enabled)
    # CONFIG_NRF_CLOUD_LOG_BACKEND=n
    
    ## Logging Mode
    # IMMEDIATE = process logs synchronously (blocking, real-time)
    # DEFERRED = buffer logs, process in thread (non-blocking, higher throughput)
    CONFIG_LOG_MODE_IMMEDIATE=y
    
    
    
    
    
    ## Added to check file is included in output
    CONFIG_MONKEY_CONFIG_FILE_UART=y
    
    ## UART Hardware Driver
    # Enable UART peripheral
    CONFIG_SERIAL=y
    
    # Ensure driver is available
    # CONFIG_SERIAL_HAS_DRIVER=y ## Pretty sure this breaks the build - not a settable config.
    
    ## Interrupt-Driven Mode
    # Required for efficient send/receive in application code
    CONFIG_UART_INTERRUPT_DRIVEN=y
    
    
    
    
    # General requirements - not ALLOWED with softSIM.
    CONFIG_FPU=n
    
    
    # Date/time library  
    CONFIG_DATE_TIME=y
    
    # ---- Networking Stack (REQUIRED first) ----
    CONFIG_NETWORKING=y
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_MGMT_EVENT_STACK_SIZE=2048
    CONFIG_NET_CONNECTION_MANAGER_MONITOR_STACK_SIZE=1024
    
    CONFIG_NET_IPV4=y
    CONFIG_NET_IPV6=y
    CONFIG_NET_IPV6_NBR_CACHE=n
    CONFIG_NET_IPV6_MLD=n
    
    # Modem library
    CONFIG_NRF_MODEM_LIB=y
    
    # Network connection manager
    CONFIG_NET_CONNECTION_MANAGER=y
    CONFIG_NRF_MODEM_LIB_NET_IF=y
    CONFIG_NRF_MODEM_LIB_NET_IF_AUTO_DOWN=y
    CONFIG_NRF_MODEM_LIB_NET_IF_DOWN_DEFAULT_LTE_DISCONNECT=y
    
    # LTE/Modem infrastructure
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_MODEM_KEY_MGMT=y
    CONFIG_MODEM_JWT=y
    CONFIG_MODEM_INFO=y
    CONFIG_MODEM_INFO_ADD_DEVICE=y
    CONFIG_MODEM_INFO_ADD_DATE_TIME=n
    CONFIG_MODEM_INFO_ADD_SIM=n
    CONFIG_MODEM_INFO_ADD_SIM_ICCID=n
    CONFIG_MODEM_INFO_ADD_SIM_IMSI=n
    CONFIG_MODEM_INFO_ADD_NETWORK=y
    
    # Network stack
    CONFIG_POSIX_API=y
    CONFIG_NET_SOCKETS_TLS_SET_MAX_FRAGMENT_LENGTH=y
    CONFIG_NET_SOCKETS_OFFLOAD_PRIORITY=40
    
    # CoAP Client - CORE settings
    CONFIG_COAP=y
    CONFIG_COAP_CLIENT=y
    CONFIG_COAP_EXTENDED_OPTIONS_LEN=y
    CONFIG_COAP_EXTENDED_OPTIONS_LEN_VALUE=192
    CONFIG_COAP_CLIENT_BLOCK_SIZE=1024
    CONFIG_COAP_CLIENT_STACK_SIZE=2048
    CONFIG_COAP_CLIENT_THREAD_PRIORITY=0
    CONFIG_COAP_CLIENT_MAX_INSTANCES=3
    
    # CBOR encoding (used by CoAP)
    CONFIG_ZCBOR=y
    CONFIG_ZCBOR_CANONICAL=n
    
    
    # Modem shared memory
    CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE=4096
    
    # ----------------------------------------------------------------------------
    # AT Command Monitor (REQUIRED for modem operation)
    # ----------------------------------------------------------------------------
    CONFIG_AT_MONITOR_HEAP_SIZE=2048
    # CONFIG_AT_HOST_STACK_SIZE=2048
    
    
    
    # Network interface IPv4 addressing
    # Allow 2 IPv4 addresses per interface
    CONFIG_NET_IF_MAX_IPV4_COUNT=2           
    CONFIG_NET_IF_MAX_IPV6_COUNT=2           
    # 2 unicast address slots
    CONFIG_NET_IF_UNICAST_IPV4_ADDR_COUNT=2  
    CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=2  
    
    
    
    CONFIG_NET_IF_LOG_LEVEL_DBG=y
    CONFIG_NET_CORE_LOG_LEVEL_DBG=y
    CONFIG_NET_CONN_LOG_LEVEL_DBG=y
    CONFIG_NET_ROUTE_LOG_LEVEL_DBG=y

    Now if I run this, it builds and runs. And even seems to connect. But it immediately disconnects each time, and throws these lg warnings at me:

    [00:00:00.784,729] <inf> monkey_cellular: Initializing cellular connectivity
    [00:00:01.073,577] <inf> monkey_cellular: Enabling network connectivity...
    [00:00:01.138,427] <inf> monkey_cellular: Cellular initialization complete
    [00:00:01.145,721] <inf> Airsmart: Waiting for network...
    [00:00:14.570,465] <wrn> lte_lc: Registration rejected, EMM cause: 14, Cell ID: 674159, Tracking area: 38161, LTE mode: 7
    [00:00:51.661,773] <wrn> lte_lc: Registration rejected, EMM cause: 15, Cell ID: 1696258, Tracking area: 43296, LTE mode: 7
    [00:01:27.983,245] <wrn> lte_lc: Registration rejected, EMM cause: 15, Cell ID: 1696358, Tracking area: 51488, LTE mode: 9
    [00:03:01.151,672] <err> Airsmart: Network not ready

    I can see the logs in Onomondo, when I use this code with softsim:

    I've gone through the conf with a fine tooth comb, and tried a dozen different things. Why is such a dead simple peice of code failing. If I run up the multi-service example in its original form, that will work. And it uses identical code, so it must be some sutble dependency or other config issue... This ecosystem seems to be MUCH too brittle.

Children
No Data
Related