LTE link monitor not accepting any AT commands after publishing to mqtt broker in data mode with nrf9160DK and SLM

Hi,

after connecting to our mqtt broker I set nrf9160DK to data mode and publish data to our mqtt broker:

AT#XMQTTCON=1,"xxx","xxx","xxx","xxx.xxx.com",1883
OK
#XMQTTEVT: 0,0
AT#XMQTTPUB="xxx/status/1_2"
OK
test+++
#XMQTTMSG: 23,9
eecfc1b1fb5b/status/1_2
#XMQTTEVT: 2,0

After this LTE link monitor is not accepting any AT commands. It keeps receiving mqtt connection ping though: #XMQTTEVT: 9,0

Here is RTT log of SLM:

00> [00:00:00.497,924] <inf> slm: Serial LTE Modem
00> [00:00:00.598,724] <inf> slm_at_host: at_host init done
00> [00:01:28.139,709] <inf> slm_at_host: Enter datamode
00> [00:01:36.501,831] <inf> slm_at_host: time limit reached
00> [00:01:36.501,892] <inf> slm_at_host: Raw send 9
00> [00:01:36.508,483] <inf> slm_mqtt: datamode send: 0

how do I get back to normal mode where I can send AT commands again?

Parents
  • Hi,

     

    When omitting the payload in the AT#XMQTTPUB call, SLM will enter datamode, as per the documentation:

    https://developer.nordicsemi.com/nRF_Connect_SDK/doc/2.1.0/nrf/applications/serial_lte_modem/doc/MQTT_AT_commands.html#mqtt-publish-xmqttpub

     

    When using datamode, I would recommend that you use another terminal, like realterm/teraterm/putty.

    LTE Link Monitor adds linebreaks to each string, which will cause problems with data mode.

     

    Kind regards,

    Håkon

  • I can't write anything on putty or teraterm, nothing showing on terminal when i write, just "ready" when nrf9160 is reset, i.e. putty:

    But this isn't really the issue, I just want to know how to exit data mode. I am also using external MCU(nrf52840) with nrf9160dk and trying to publish to our mqtt broker, it publishes ok, but never exits the data mode. So whatever I write to uart after initially entering data mode are published to our mqtt broker and not handled as At commands.

  • The default exit command out of datamode is "+++", ie only these 3 bytes. You can change this if you want, via CONFIG_SLM_DATAMODE_TERMINATOR.

    Putty probably has a different line-ending as compared to the default in SLM (which is CR+LF). You can change this by modifying either the putty settings, or the SLM firmware (CONFIG_SLM_CR_TERMINATION=y)

     

    Kind regards,

    Håkon

  • I just can't get it to work with my external MCU (nrf52840). Is this supposed to work with FIFO aswell or do I need to change my uart connection? Here is my code:

    void uart_init(void)
    {
        uint32_t err_code;
        app_uart_comm_params_t const comm_params =
            {
                .rx_pin_no = UART_RX,
                .tx_pin_no = UART_TX,
                .rts_pin_no = NRF_UART_PSEL_DISCONNECTED,
                .cts_pin_no = NRF_UART_PSEL_DISCONNECTED,
                .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
                .use_parity = false,
                .baud_rate = NRF_UART_BAUDRATE_115200
    
            };
        APP_UART_FIFO_INIT(&comm_params,
            UART_RX_BUF_SIZE,
            UART_TX_BUF_SIZE,
            uart_event_handle,
            APP_IRQ_PRIORITY_LOWEST,
            err_code);
        APP_ERROR_CHECK(err_code);
    }
    
    int8_t send_at_command(char *at_command)
    {
        while(!uart_tx_empty);
        for (int i = 0; i < strlen(at_command); i++)
        {
            uint32_t retval = app_uart_put(at_command[i]);
            if (retval != 0)
            {
                app_uart_flush();
                return -1;
            }
        }
        if(strstr(at_command, "+++") == NULL)
        {
            app_uart_put('\r');
            app_uart_put('\n');
        }
        uart_tx_empty = false;
        return 0;
    }

Reply
  • I just can't get it to work with my external MCU (nrf52840). Is this supposed to work with FIFO aswell or do I need to change my uart connection? Here is my code:

    void uart_init(void)
    {
        uint32_t err_code;
        app_uart_comm_params_t const comm_params =
            {
                .rx_pin_no = UART_RX,
                .tx_pin_no = UART_TX,
                .rts_pin_no = NRF_UART_PSEL_DISCONNECTED,
                .cts_pin_no = NRF_UART_PSEL_DISCONNECTED,
                .flow_control = APP_UART_FLOW_CONTROL_DISABLED,
                .use_parity = false,
                .baud_rate = NRF_UART_BAUDRATE_115200
    
            };
        APP_UART_FIFO_INIT(&comm_params,
            UART_RX_BUF_SIZE,
            UART_TX_BUF_SIZE,
            uart_event_handle,
            APP_IRQ_PRIORITY_LOWEST,
            err_code);
        APP_ERROR_CHECK(err_code);
    }
    
    int8_t send_at_command(char *at_command)
    {
        while(!uart_tx_empty);
        for (int i = 0; i < strlen(at_command); i++)
        {
            uint32_t retval = app_uart_put(at_command[i]);
            if (retval != 0)
            {
                app_uart_flush();
                return -1;
            }
        }
        if(strstr(at_command, "+++") == NULL)
        {
            app_uart_put('\r');
            app_uart_put('\n');
        }
        uart_tx_empty = false;
        return 0;
    }

Children
Related