conn_mgr and LTE-M PSM

Hi, 

I really like the new Zephyr conn_mgr, it is really easy to use, almost UNIX like. I am wondering what is now the best way to control PSM. Will CONFIG_LTE_LINK_CONTROL and lte_lc_connect_async interfere with the conn_mgr? Should I only use one of the options or can they exist next to each other? 

will CONN_MGR_IF_NO_AUTO_CONNECT and then connection using lte_lc work reliable?

I am searching for the "right" way to do. 

Thanks!

Parents
  • Hello,

    I will have to look more into conn_mgr, but I am not sure if our LTE code is well-integrated with that feature.

    To be safe I would recommend using our LTE link control library.

    Best regards,

    Michal

  • I can't get it to work on  SDK 2.5.0, it should be really straight forward, right? I took the example from the library page

    #include <zephyr/kernel.h>
    #include <modem/lte_lc.h>
    
    /* Semaphore used to block the main thread until modem has established
     * an LTE connection.
     */
    K_SEM_DEFINE(lte_connected, 0, 1);
    
    static void lte_handler(const struct lte_lc_evt *const evt)
    {
            switch (evt->type) {
            case LTE_LC_EVT_NW_REG_STATUS:
                    if (evt->nw_reg_status != LTE_LC_NW_REG_REGISTERED_HOME &&
                        evt->nw_reg_status != LTE_LC_NW_REG_REGISTERED_ROAMING) {
                            break;
                    }
    
                    printk("Connected to: %s network\n",
                           evt->nw_reg_status == LTE_LC_NW_REG_REGISTERED_HOME ? "home" : "roaming");
    
                    k_sem_give(&lte_connected);
                    break;
    
            case LTE_LC_EVT_PSM_UPDATE:
            case LTE_LC_EVT_EDRX_UPDATE:
            case LTE_LC_EVT_RRC_UPDATE:
            case LTE_LC_EVT_CELL_UPDATE:
            case LTE_LC_EVT_LTE_MODE_UPDATE:
            case LTE_LC_EVT_TAU_PRE_WARNING:
            case LTE_LC_EVT_NEIGHBOR_CELL_MEAS:
            case LTE_LC_EVT_MODEM_SLEEP_EXIT_PRE_WARNING:
            case LTE_LC_EVT_MODEM_SLEEP_EXIT:
            case LTE_LC_EVT_MODEM_SLEEP_ENTER:
            case LTE_LC_EVT_MODEM_EVENT:
                    /* Handle LTE events */
                    break;
    
            default:
                    break;
            }
    }
    
    int main(void)
    {
            int err;
    
            printk("Connecting to LTE network. This may take a few minutes...\n");
            err = lte_lc_init_and_connect_async(lte_handler);
            if (err) {
                    printk("Failed to connect to LTE network, err %d\n", err);
                    return err;
            }
    
            k_sem_take(&lte_connected, K_FOREVER);
    
    }

    I get 

    Failed to connect to LTE network, err -14

    I am just looking for an example with SDK 2.5.0 and PSM. Most samples like the AWS IOT example switched to the conn_mgr implementation. 

Reply
  • I can't get it to work on  SDK 2.5.0, it should be really straight forward, right? I took the example from the library page

    #include <zephyr/kernel.h>
    #include <modem/lte_lc.h>
    
    /* Semaphore used to block the main thread until modem has established
     * an LTE connection.
     */
    K_SEM_DEFINE(lte_connected, 0, 1);
    
    static void lte_handler(const struct lte_lc_evt *const evt)
    {
            switch (evt->type) {
            case LTE_LC_EVT_NW_REG_STATUS:
                    if (evt->nw_reg_status != LTE_LC_NW_REG_REGISTERED_HOME &&
                        evt->nw_reg_status != LTE_LC_NW_REG_REGISTERED_ROAMING) {
                            break;
                    }
    
                    printk("Connected to: %s network\n",
                           evt->nw_reg_status == LTE_LC_NW_REG_REGISTERED_HOME ? "home" : "roaming");
    
                    k_sem_give(&lte_connected);
                    break;
    
            case LTE_LC_EVT_PSM_UPDATE:
            case LTE_LC_EVT_EDRX_UPDATE:
            case LTE_LC_EVT_RRC_UPDATE:
            case LTE_LC_EVT_CELL_UPDATE:
            case LTE_LC_EVT_LTE_MODE_UPDATE:
            case LTE_LC_EVT_TAU_PRE_WARNING:
            case LTE_LC_EVT_NEIGHBOR_CELL_MEAS:
            case LTE_LC_EVT_MODEM_SLEEP_EXIT_PRE_WARNING:
            case LTE_LC_EVT_MODEM_SLEEP_EXIT:
            case LTE_LC_EVT_MODEM_SLEEP_ENTER:
            case LTE_LC_EVT_MODEM_EVENT:
                    /* Handle LTE events */
                    break;
    
            default:
                    break;
            }
    }
    
    int main(void)
    {
            int err;
    
            printk("Connecting to LTE network. This may take a few minutes...\n");
            err = lte_lc_init_and_connect_async(lte_handler);
            if (err) {
                    printk("Failed to connect to LTE network, err %d\n", err);
                    return err;
            }
    
            k_sem_take(&lte_connected, K_FOREVER);
    
    }

    I get 

    Failed to connect to LTE network, err -14

    I am just looking for an example with SDK 2.5.0 and PSM. Most samples like the AWS IOT example switched to the conn_mgr implementation. 

Children
No Data
Related