This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

nRF9160 MQTT + TLS + PSM

Hi,

I have build a application based on the mqtt-simple-sample and successfully integrated TLS.

Now I wanted to measure the floor current in PSM. I did wait some minutes after my application aborted the

mqtt-session and measured a floor current of 980 uAs, what seems way to high in my opinion. In comparison, I measured

a current of 50 uAs with an empty application in PSM and a floor current of 100 uAs in my application without the use of TLS.

Is it normal, that the current consumption is so much higher through the use of TLS or did I missed something in the configs

or the application flow?

My prj.conf files:

#SPM config

CONFIG_IS_SPM=y
CONFIG_GPIO=n

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n




#MQTT config

# General config
CONFIG_TEST_RANDOM_GENERATOR=y

# Networking
CONFIG_NETWORKING=y
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_AUTO_INIT_AND_CONNECT=n

# BSD library
CONFIG_BSD_LIBRARY=y

# AT Host
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_AT_HOST_LIBRARY=n

# MQTT
CONFIG_BSD_LIBRARY_TRACE_ENABLED=n
CONFIG_POWER_OPTIMIZATION=y
CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n
CONFIG_PROVISION_CERTIFICATES=y
CONFIG_GPIO=n
CONFIG_LOG=n
CONFIG_TRUSTED_EXECUTION_NONSECURE=y
CONFIG_NEWLIB_LIBC=n
CONFIG_MQTT_LIB=y
CONFIG_MQTT_LIB_TLS=y
CONFIG_MQTT_KEEPALIVE=300
CONFIG_LTE_LEGACY_PCO_MODE=y
CONFIG_LTE_NETWORK_MODE_NBIOT=y
CONFIG_LTE_PSM_REQ=y
CONFIG_LTE_PSM_REQ_RPTAU="10101010"
CONFIG_LTE_PSM_REQ_RAT="00100001"

# Application
#CONFIG_MQTT_PUB_TOPIC="/my/publish/topic"
#CONFIG_MQTT_SUB_TOPIC="/my/subscribe/topic"
#CONFIG_MQTT_CLIENT_ID="my-client-id"
#CONFIG_MQTT_BROKER_HOSTNAME="test.mosquitto.org"
#CONFIG_MQTT_BROKER_PORT=8883

# Main thread
CONFIG_MAIN_THREAD_PRIORITY=7
CONFIG_MAIN_STACK_SIZE=4096

CONFIG_HEAP_MEM_POOL_SIZE=1024

# Disable native network stack to save some memory
CONFIG_NET_IPV4=n
CONFIG_NET_IPV6=n
CONFIG_NET_UDP=n
CONFIG_NET_TCP=n

And the main:

void main(void) {

	volatile int err;
    u32_t turner = 0;
    volatile static int init_cnt = 0;

    provision_certificate();
    k_timer_init(&my_timer, my_expiry_function, NULL);
    buttons_leds_init();
	modem_configure();
	err = lte_lc_psm_req(true);
    if(err != 0) {
        dk_set_leds_state(0x00, DK_LED1_MSK);
    } else {
        dk_set_leds_state(DK_LED1_MSK, 0x00);
    }
	client_init(&client);

	while (1) {
	
        if(btn_flag > 0) {
            k_timer_start(&my_timer, K_SECONDS(TIMER_INTERVAL_SEC), K_SECONDS(TIMER_INTERVAL_SEC));
            timer_flag = 0;
            err = mqtt_connect(&client);
            if (err != 0) {
                dk_set_leds_state(0x00, DK_LED2_MSK);
            } else {
                dk_set_leds_state(DK_LED2_MSK, 0x00);
            }
            fds_init(&client);
			btn_flag = 0;
        }
            
        if(timer_flag == 0) {
            if(msg_flag == 1) {
				timer_cnt = 0;
            }
            err = poll(&fds, 1, K_SECONDS(CONFIG_MQTT_KEEPALIVE));
            err = mqtt_live(&client);
            if ((fds.revents & POLLIN) == POLLIN) {
                if(init_cnt < 2) {
					err = mqtt_input(&client);
					if (err != 0) {
						break;
					}
					init_cnt++;
                } 
                if(init_cnt == 2) {
                    button_handler(turner, 0x1);
                    init_cnt++;
                }
                if(msg_flag == 1) {
                    err = mqtt_input(&client);
					if (err != 0) {
						break;
					}
                }
            }
            if ((fds.revents & POLLERR) == POLLERR) {
				printk("POLLERR\n");
            }
            if ((fds.revents & POLLNVAL) == POLLNVAL) {
                printk("POLLNVAL\n");
            }
        } else if(timer_flag == 1) {
            err = mqtt_abort(&client);
            if(err != 0) {
                //
            } else {
                k_timer_stop(&my_timer);
                dk_set_leds_state(0x00, DK_LED1_MSK);
                k_sleep(1000);
                init_cnt = 0;
                timer_cnt = 0;
                timer_flag = 2;
                dk_set_leds_state(DK_ALL_LEDS_MSK, 0x00);
            }
        }
            
        k_sleep(1000);

	}
}

Thanks in advance and best regards.

Parents Reply Children
  • Hi Håkon,

    I tested the default mqtt_simple_sample and asset_tracker again (just modified LTE configs to use NB-IoT and the legacy PCO mode) and noticed, that the code doesn't stuck on the at_cmd_write(normal, NULL, 0, NULL) != 0) line. The modem gets a response and stucks in the next line: k_sem_take(&link, K_FOREVER).

    In at_client there is a communication via AT-commands possible, like the following log shows:

    2019-07-18T07:44:13.551Z INFO Modem port is opened
    2019-07-18T07:44:13.583Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:44:42.084Z DEBUG modem << ***** Booting Zephyr OS v1.14.99-ncs2 *****\x0D\x0A
    2019-07-18T07:44:42.130Z DEBUG modem << Flash region\x09\x09Domain\x09\x09Permissions\x0D\x0A
    2019-07-18T07:44:42.139Z DEBUG modem << 00 0x00000 0x08000 \x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.149Z DEBUG modem << 01 0x08000 0x10000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.158Z DEBUG modem << 02 0x10000 0x18000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.164Z DEBUG modem << 03 0x18000 0x20000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.170Z DEBUG modem << 04 0x20000 0x28000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.180Z DEBUG modem << 05 0x28000 0x30000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.227Z DEBUG modem << 06 0x30000 0x38000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.235Z DEBUG modem << 07 0x38000 0x40000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.241Z DEBUG modem << 08 0x40000 0x48000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.248Z DEBUG modem << 09 0x48000 0x50000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.258Z DEBUG modem << 10 0x50000 0x58000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.268Z DEBUG modem << 11 0x58000 0x60000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.278Z DEBUG modem << 12 0x60000 0x68000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.285Z DEBUG modem << 13 0x68000 0x70000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.291Z DEBUG modem << 14 0x70000 0x78000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.296Z DEBUG modem << 15 0x78000 0x80000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.311Z DEBUG modem << 16 0x80000 0x88000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.317Z DEBUG modem << 17 0x88000 0x90000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.321Z DEBUG modem << 18 0x90000 0x98000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.326Z DEBUG modem << 19 0x98000 0xa0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.331Z DEBUG modem << 20 0xa0000 0xa8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.337Z DEBUG modem << 21 0xa8000 0xb0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.342Z DEBUG modem << 22 0xb0000 0xb8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.349Z DEBUG modem << 23 0xb8000 0xc0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.356Z DEBUG modem << 24 0xc0000 0xc8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.363Z DEBUG modem << 25 0xc8000 0xd0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.369Z DEBUG modem << 26 0xd0000 0xd8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.373Z DEBUG modem << 27 0xd8000 0xe0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.378Z DEBUG modem << 28 0xe0000 0xe8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.386Z DEBUG modem << 29 0xe8000 0xf0000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.391Z DEBUG modem << 30 0xf0000 0xf8000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.395Z DEBUG modem << 31 0xf8000 0x100000 \x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.437Z DEBUG modem << Non-secure callable region 0 placed in flash region 0 with size 32.\x0D\x0A\x0D\x0A\x0D\x0A
    2019-07-18T07:44:42.442Z DEBUG modem << SRAM region\x09\x09Domain\x09\x09Permissions\x0D\x0A
    2019-07-18T07:44:42.446Z DEBUG modem << 00 0x00000 0x02000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.450Z DEBUG modem << 01 0x02000 0x04000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.454Z DEBUG modem << 02 0x04000 0x06000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.458Z DEBUG modem << 03 0x06000 0x08000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.463Z DEBUG modem << 04 0x08000 0x0a000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.467Z DEBUG modem << 05 0x0a000 0x0c000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.476Z DEBUG modem << 06 0x0c000 0x0e000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.482Z DEBUG modem << 07 0x0e000 0x10000\x09Secure\x09\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.491Z DEBUG modem << 08 0x10000 0x12000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.499Z DEBUG modem << 09 0x12000 0x14000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.505Z DEBUG modem << 10 0x14000 0x16000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.514Z DEBUG modem << 11 0x16000 0x18000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.523Z DEBUG modem << 12 0x18000 0x1a000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.527Z DEBUG modem << 13 0x1a000 0x1c000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.537Z DEBUG modem << 14 0x1c000 0x1e000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.545Z DEBUG modem << 15 0x1e000 0x20000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.552Z DEBUG modem << 16 0x20000 0x22000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.561Z DEBUG modem << 17 0x22000 0x24000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.572Z DEBUG modem << 18 0x24000 0x26000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.576Z DEBUG modem << 19 0x26000 0x28000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.580Z DEBUG modem << 20 0x28000 0x2a000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.589Z DEBUG modem << 21 0x2a000 0x2c000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.595Z DEBUG modem << 22 0x2c000 0x2e000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.604Z DEBUG modem << 23 0x2e000 0x30000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.610Z DEBUG modem << 24 0x30000 0x32000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.614Z DEBUG modem << 25 0x32000 0x34000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.618Z DEBUG modem << 26 0x34000 0x36000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.631Z DEBUG modem << 27 0x36000 0x38000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.636Z DEBUG modem << 28 0x38000 0x3a000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.639Z DEBUG modem << 29 0x3a000 0x3c000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.643Z DEBUG modem << 30 0x3c000 0x3e000\x09Non-Secure\x09rwxl\x0D\x0A
    2019-07-18T07:44:42.647Z DEBUG modem << 31 0x3e000 0x40000\x09Non-Secure\x09rwxl\x0D\x0A\x0D\x0A
    2019-07-18T07:44:42.651Z DEBUG modem << Peripheral\x09\x09Domain\x09\x09Status\x0D\x0A
    2019-07-18T07:44:42.656Z DEBUG modem << 00 NRF_P0\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.660Z DEBUG modem << 01 NRF_CLOCK\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.663Z DEBUG modem << 02 NRF_RTC1\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.668Z DEBUG modem << 03 NRF_NVMC\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.673Z DEBUG modem << 04 NRF_UARTE1\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.677Z DEBUG modem << 05 NRF_UARTE2\x09\x09Secure\x09\x09SKIP\x0D\x0A
    2019-07-18T07:44:42.684Z DEBUG modem << 06 NRF_TWIM2\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.694Z DEBUG modem << 07 NRF_SPIM3\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.699Z DEBUG modem << 08 NRF_TIMER0\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.704Z DEBUG modem << 09 NRF_TIMER1\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.710Z DEBUG modem << 10 NRF_TIMER2\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.721Z DEBUG modem << 11 NRF_SAADC\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.727Z DEBUG modem << 12 NRF_PWM0\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.731Z DEBUG modem << 13 NRF_PWM1\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.735Z DEBUG modem << 14 NRF_PWM2\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.739Z DEBUG modem << 15 NRF_PWM3\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.743Z DEBUG modem << 16 NRF_IPC\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.746Z DEBUG modem << 17 NRF_VMC\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.749Z DEBUG modem << 18 NRF_FPU\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.753Z DEBUG modem << 19 NRF_EGU1\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.757Z DEBUG modem << 20 NRF_EGU2\x09\x09Non-Secure\x09OK\x0D\x0A
    2019-07-18T07:44:42.761Z DEBUG modem << 21 NRF_GPIOTE1\x09\x09Non-Secure\x09OK\x0D\x0A\x0D\x0A
    2019-07-18T07:44:42.766Z DEBUG modem << SPM: NS image at 0xc000\x0D\x0A
    2019-07-18T07:44:42.770Z DEBUG modem << SPM: NS MSP at 0x20023b68\x0D\x0A
    2019-07-18T07:44:42.776Z DEBUG modem << SPM: NS reset vector at 0xe325\x0D\x0A
    2019-07-18T07:44:42.780Z DEBUG modem << SPM: prepare to jump to Non-Secure image.\x0D\x0A
    2019-07-18T07:44:43.919Z DEBUG modem << ***** Booting Zephyr OS v1.14.99-ncs2 *****\x0D\x0A
    2019-07-18T07:44:43.953Z DEBUG modem << The AT host sample started\x0D\x0A
    2019-07-18T07:44:48.947Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:44:49.006Z DEBUG modem << +CFUN: 4\x0D\x0A
    2019-07-18T07:44:49.066Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:49.104Z DEBUG modem >> AT+CFUN=1\x0D\x0A
    2019-07-18T07:44:49.155Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:51.736Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:44:51.745Z DEBUG modem << +CFUN: 1\x0D\x0A
    2019-07-18T07:44:51.812Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:51.851Z DEBUG modem >> AT+CGSN=1\x0D\x0A
    2019-07-18T07:44:51.902Z DEBUG modem << +CGSN: "352656100049900"\x0D\x0A
    2019-07-18T07:44:51.908Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:51.948Z DEBUG modem >> AT+CGMI\x0D\x0A
    2019-07-18T07:44:51.999Z DEBUG modem << Nordic Semiconductor ASA\x0D\x0A
    2019-07-18T07:44:52.003Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.049Z DEBUG modem >> AT+CGMM\x0D\x0A
    2019-07-18T07:44:52.103Z DEBUG modem << nRF9160-SICA\x0D\x0A
    2019-07-18T07:44:52.111Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.154Z DEBUG modem >> AT+CGMR\x0D\x0A
    2019-07-18T07:44:52.197Z DEBUG modem << mfw_nrf9160_1.0.0\x0D\x0A
    2019-07-18T07:44:52.201Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.207Z INFO Nordic Semiconductor ASA nRF9160-SICA [mfw_nrf9160_1.0.0] SerNr: 352656100049900
    2019-07-18T07:44:52.239Z DEBUG modem >> AT+CEMODE?\x0D\x0A
    2019-07-18T07:44:52.279Z DEBUG modem << +CEMODE: 2\x0D\x0A
    2019-07-18T07:44:52.283Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.337Z DEBUG modem >> AT%XCBAND=?\x0D\x0A
    2019-07-18T07:44:52.393Z DEBUG modem << %XCBAND: (1,2,3,4,5,8,12,13,14,17,18,19,20,25,26,28,66)\x0D\x0A
    2019-07-18T07:44:52.399Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.468Z DEBUG modem >> AT+CMEE?\x0D\x0A
    2019-07-18T07:44:52.528Z DEBUG modem << +CMEE: 0\x0D\x0A
    2019-07-18T07:44:52.532Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.569Z DEBUG modem >> AT+CMEE=1\x0D\x0A
    2019-07-18T07:44:52.632Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.692Z DEBUG modem >> AT+CNEC?\x0D\x0A
    2019-07-18T07:44:52.739Z DEBUG modem << +CNEC: 0\x0D\x0A
    2019-07-18T07:44:52.744Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.750Z DEBUG modem >> AT+CNEC=24\x0D\x0A
    2019-07-18T07:44:52.807Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.849Z DEBUG modem >> AT+CGEREP?\x0D\x0A
    2019-07-18T07:44:52.890Z DEBUG modem << +CGEREP: 0,0\x0D\x0A
    2019-07-18T07:44:52.896Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:52.907Z DEBUG modem >> AT+CGDCONT?\x0D\x0A
    2019-07-18T07:44:52.993Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.004Z DEBUG modem >> AT+CGACT?\x0D\x0A
    2019-07-18T07:44:53.091Z DEBUG modem << OK\x0D
    2019-07-18T07:44:53.164Z DEBUG modem >> AT+CGEREP=1\x0D\x0A
    2019-07-18T07:44:53.244Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.294Z DEBUG modem >> AT+CIND=1,1,1\x0D\x0A
    2019-07-18T07:44:53.337Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.382Z DEBUG modem >> AT+CEREG=2\x0D\x0A
    2019-07-18T07:44:53.435Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.444Z DEBUG modem >> AT+CEREG?\x0D\x0A
    2019-07-18T07:44:53.456Z DEBUG modem << +CEREG: 2,4,"FFFE","FFFFFFFF",7\x0D\x0A
    2019-07-18T07:44:53.462Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.549Z DEBUG modem >> AT%CESQ=1\x0D\x0A
    2019-07-18T07:44:53.601Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.662Z DEBUG modem >> AT+CESQ\x0D\x0A
    2019-07-18T07:44:53.722Z DEBUG modem << +CESQ: 99,99,255,255,255,255\x0D\x0A
    2019-07-18T07:44:53.733Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.819Z DEBUG modem >> AT%XSIM=1\x0D\x0A
    2019-07-18T07:44:53.871Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:53.917Z DEBUG modem >> AT%XSIM?\x0D\x0A
    2019-07-18T07:44:53.969Z DEBUG modem << %XSIM: 1\x0D
    2019-07-18T07:44:53.980Z DEBUG modem << \x0A
    2019-07-18T07:44:53.984Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:54.039Z DEBUG modem >> AT+CPIN?\x0D\x0A
    2019-07-18T07:44:54.089Z DEBUG modem << +CPIN: READY\x0D\x0A
    2019-07-18T07:44:54.098Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:54.160Z DEBUG modem >> AT+CPINR="SIM PIN"\x0D\x0A
    2019-07-18T07:44:54.222Z DEBUG modem << +CPINR: "SIM PIN",3\x0D\x0A
    2019-07-18T07:44:54.227Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:54.299Z DEBUG modem >> AT+CIMI\x0D\x0A
    2019-07-18T07:44:54.353Z DEBUG modem << 901405100488795\x0D\x0A
    2019-07-18T07:44:54.359Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:44:54.363Z INFO IMSIdentity: 901405100488795
    2019-07-18T07:45:16.821Z DEBUG modem >> AT%XSYSTEMMODE?\x0D\x0A
    2019-07-18T07:45:16.878Z DEBUG modem << %XSYSTEMMODE: 1,0,0,0\x0D\x0A
    2019-07-18T07:45:16.884Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:24.283Z DEBUG modem >> AT+CFUN=4\x0D\x0A
    2019-07-18T07:45:24.333Z DEBUG modem << ERROR\x0D\x0A\x00
    2019-07-18T07:45:24.338Z ERROR Error: AT+CFUN=4
     failed
    2019-07-18T07:45:24.364Z DEBUG modem << %CESQ: 255,0\x0D\x0A\x00
    2019-07-18T07:45:24.385Z DEBUG modem << %XSIM: 1\x0D\x0A\x00
    2019-07-18T07:45:24.401Z DEBUG modem << %XSIM: 0\x0D\x0A\x00
    2019-07-18T07:45:24.457Z DEBUG modem >> AT+CPIN?\x0D\x0A
    2019-07-18T07:45:24.508Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:24.561Z DEBUG modem >> AT+CIMI\x0D\x0A
    2019-07-18T07:45:24.615Z DEBUG modem << +CPIN: READY\x0D\x0A
    2019-07-18T07:45:24.621Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:24.626Z INFO IMSIdentity: +CPIN: READY
    2019-07-18T07:45:27.933Z DEBUG modem >> AT+CFUN=4\x0D\x0A
    2019-07-18T07:45:27.984Z DEBUG modem << 901405100488795\x0D\x0A
    2019-07-18T07:45:27.989Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:40.179Z DEBUG modem >> AT%XSYSTEMMODE=0,1,0,0\x0D\x0A
    2019-07-18T07:45:40.228Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:47.567Z DEBUG modem >> AT+CFUN=1\x0D\x0A
    2019-07-18T07:45:47.626Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-18T07:45:47.630Z DEBUG modem << %XSIM: 0\x0D
    2019-07-18T07:45:50.139Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:45:51.140Z ERROR Error: 'AT+CFUN?
    ' timed out
    2019-07-18T07:45:53.924Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:45:54.924Z ERROR Error: 'AT+CFUN?
    ' timed out
    2019-07-18T07:45:56.254Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-18T07:45:57.256Z ERROR Error: 'AT+CFUN?
    ' timed out
    

    As you can see, it seems to be impossible to set the LTE-M to NB-IoT mode because the modem wont response after doing this. I tried to set it in the prj.conf file, but it will be ignored (AT%XSYSTEMMODE? still delivers 1,0,0,0). A change in the config menu of SES leads to a non-responding application in regards to AT-commands.

    I tried to use the v0.4.0 ncs tag in combination with the v1.0.0 mfw (read it in a similar thread), but the problems are still the same.

    Kind regards.

  • That is strange. Have you tried setting XSYSTEMMODE just after boot, and before issuing CFUN=1?

    Could you try programming this .hex file? "nrfjprog --program uicr_tcxo.hex --sectorerase -f nrf91 --reset"

    uicr_tcxo.hex

  • Yes, I tried it. Same result:

    2019-07-19T06:47:59.993Z DEBUG modem << ***** Booting Zephyr OS v1.14.99-ncs2 *****\x0D\x0A
    2019-07-19T06:47:59.997Z DEBUG modem << The AT host sample started\x0D\x0A
    2019-07-19T06:48:15.031Z DEBUG modem >> AT%XSYSTEMMODE=0,1,0,0\x0D\x0A
    2019-07-19T06:48:15.068Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-19T06:48:18.412Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-19T06:48:18.456Z DEBUG modem << +CFUN: 4\x0D\x0A
    2019-07-19T06:48:18.522Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-19T06:48:18.556Z DEBUG modem >> AT+CFUN=1\x0D\x0A
    2019-07-19T06:48:18.606Z DEBUG modem << OK\x0D\x0A\x00
    2019-07-19T06:48:22.618Z DEBUG modem >> AT+CFUN?\x0D\x0A
    2019-07-19T06:48:23.619Z ERROR Error: 'AT+CFUN?
    ' timed out

    I programmed your .hex file and retried the at_client. No changes, same problems.

    Kind regards.

  • Could you provide a trace of this issue?

    Here's a blog that explains how: https://devzone.nordicsemi.com/nordic/nordic-blog/b/blog/posts/how-to-get-modem-trace-using-trace-collector-in-nrf-connect

    It is essentially this config that is needed in prj.conf:

    CONFIG_BSD_LIBRARY_TRACE_ENABLED=y

     

    Note that you need to input "AT%XMODEMTRACE=1,2" first, before turning on the modem.

     

    This should produce a .bin file in the nRF Connect app "Trace Collector" which you could upload to this thread.

     

    Kind regards,

    Håkon

  • Okay, I get the at_client work by setting AT%XSYSTEMMODE=0,1,0,0 and then shutting the modem down with AT+CFUN=0 plus a reset (inspired by your linked blog ^^). After that, I tested the mqtt_simple_sample and it works just fine. The same does my application. So thanks a lot.

    Could you please explain a bit, what the uicr_tcxo.hex has effected?

    Thanks and kind regards.

Related