NRF9160 SIP uart communication with STM32 MCU

Hi, 

I'm trying to control nrf9160 SIP from stm32 MCU via AT Commands. Should I program on the nrf9160 the AT_CLIENT sample for this purpose or is not neccesary?

I'm trying to do that but I'm not been able and i can't find a tuotorial or guide about how to do it... 

Thanks in advance, 

Best Regards! 

  • thanks a lot for your response!

    I'm trying to use this sample too but i'm not been able to communicate my STM32 MCU with the nrf9160 SIP via uart. 

    I modified the "nrf9160dk_nrf9160_ns.overlay" and the "nrf9160dk_nrf9160_ns.conf" to fit with my custom board requirements (uart connected to different pins)

    /*
     * Copyright (c) 2021 Nordic Semiconductor ASA
     *
     * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
     */

    / {
        chosen {
            ncs,slm-uart = &uart2;
        };
    };

    &uart0 {
        status = "disabled";
    };

    &uart2 {
        compatible = "nordic,nrf-uarte";
        current-speed = <115200>;
        status = "okay";
        hw-flow-control;

        pinctrl-0 = <&uart2_default_alt>;
        pinctrl-1 = <&uart2_sleep_alt>;
        pinctrl-names = "default", "sleep";
    };

    &i2c2 {
        status = "disabled";
    };

    &pinctrl {
        uart2_default_alt: uart2_default_alt {
            group1 {
                psels = <NRF_PSEL(UART_RX, 0, 5)>;
                bias-pull-up;
            };
            group2 {
                psels = <NRF_PSEL(UART_TX, 0, 6)>,
                    <NRF_PSEL(UART_RTS, 0, 24)>,
                    <NRF_PSEL(UART_CTS, 0, 25)>;
            };
        };

        uart2_sleep_alt: uart2_sleep_alt {
            group1 {
                psels = <NRF_PSEL(UART_TX, 0, 5)>,
                    <NRF_PSEL(UART_RX, 0, 6)>,
                    <NRF_PSEL(UART_RTS, 0, 24)>,
                    <NRF_PSEL(UART_CTS, 0, 25)>;
                low-power-enable;
            };
        };
    };
    I don't know if I should change anything more or what i'm doing wrong.. I'm a bit loss at this point.
    Best regards
  • Do you get any activity on the uart pins at all? Have you checked this with logic trace? What kconfigs have you set in the application?

  • no, not activity on the uarts...

    this is my kconfig:

    source "Kconfig.zephyr"

    menu "Nordic Serial LTE Modem"

    config SLM_CUSTOMER_VERSION
        string "Customer version string"
        help
           This version is reported together with baseline versions by AT command "#XSLMVER".

    config SLM_AT_MAX_PARAM
        int "Maximum number of parameters in AT command"
        default 42

    #
    # external XTAL for UART
    #
    config SLM_EXTERNAL_XTAL
        bool "Use external XTAL for UARTE"
        default y

    #
    # AT command terminator
    #
    choice
        prompt "Termination mode"
        default SLM_CR_LF_TERMINATION
        help
            Sets the command terminator used by the serial terminal.
            Available options are:
            -  CR termination
            -  LF termination
            -  CR+LF termination
        config SLM_CR_TERMINATION
            bool "CR termination"
        config SLM_LF_TERMINATION
            bool "LF termination"
        config SLM_CR_LF_TERMINATION
            bool "CR+LF termination"
    endchoice

    #
    # UART buffers (when CMUX is not in use)
    #
    config SLM_UART_RX_BUF_COUNT
        int "Receive buffers for UART"
        range 2 4
        default 3
        help
          Amount of buffers for receiving (RX) UART traffic. If the buffers are full, UART RX will be disabled until the buffers are processed.

    config SLM_UART_RX_BUF_SIZE
        int "Receive buffer size for UART"
        range 128 4096
        default 256
        help
          Amount of received (RX), unprocessed, UART traffic that can be held by single buffer.

    config SLM_UART_TX_BUF_SIZE
        int "Send buffer size for UART"
        range 128 4096
        default 256
        help
          Amount of UART traffic waiting to be sent (TX), that can be held. If the buffers are full, will send synchronously.

    #
    # GPIO functionality
    #
    config SLM_START_SLEEP
        bool "Enter sleep on startup"
        help
          If enabled, the SiP is put into deep sleep when powered on.
          It can then be started using SLM_POWER_PIN.

    config SLM_POWER_PIN
        int "Power pin"
        default -1
        help
          Interface GPIO pin used to put the SiP into deep sleep and wake up from it or exit idle.
          The pin is configured with a pull up and must be pulled down shortly to perform one power off or wake up operation.

    config SLM_INDICATE_PIN
        int "Indicate pin"
        default -1
        help
          Interface GPIO pin used to indicate that data is available when SLM is idle (after #XSLEEP=2 AT command).

    config SLM_INDICATE_TIME
        int "Indication period"
        default 100
        help
          GPIO active indication time in milliseconds. This setting specify the period length for the pin to be active

    #
    # LTE network automatic attach
    #
    config SLM_AUTO_CONNECT
        bool "Automatically connect to the LTE network on start-up or after a reset"
        help
          Enables automatic connection to the LTE network using the PDN configuration defined in 'slm_auto_connect.h'.

    #
    # TCP/TLS proxy
    #
    config SLM_TCP_POLL_TIME
        int "Poll time-out in seconds for TCP connection"
        default 10

    config SLM_UDP_POLL_TIME
        int "Poll time-out in seconds for UDP connection"
        default 10

    #
    # Data mode
    #
    config SLM_DATAMODE_TERMINATOR
        string "Pattern string to terminate data mode"
        default "+++"
        help
          Use a pattern to terminate data mode

    config SLM_DATAMODE_URC
        bool "Send URC in data mode"
        help
          Report result of data mode sending

    config SLM_DATAMODE_BUF_SIZE
        int "Buffer size for data mode"
        range 1024 8192
        default 4096
        help
          Size of the buffer for data received in data mode.

    #
    # Configurable services
    #
    config SLM_SMS
        bool "SMS support in SLM"
        default y
        select SMS
        help
          Support SMS send/receive in plain text

    config SLM_GNSS
        bool "GNSS support in SLM"
        default y

    config SLM_NRF_CLOUD
        bool "nRF Cloud support in SLM"
        default y

    config SLM_FULL_FOTA
        bool "Full modem FOTA support in SLM"
        default n
        depends on !BOARD_THINGY91_NRF9160_NS

    config SLM_PPP
        bool "PPP support in SLM"
        help
          When enabled, SLM automatically brings up/down the PPP link
          when the LTE link (default PDN) is connected/disconnected,
          regardless of what is done with AT#XPPP.

    config SLM_CMUX
        bool "CMUX support in SLM"

    if SLM_CMUX && SLM_PPP

    config SLM_CMUX_AUTOMATIC_FALLBACK_ON_PPP_STOPPAGE
        bool "AT channel automatic fallback to DLCI 1 when PPP stops."
        help
          This is mainly intended for compatibility with Zephyr's cellular modem driver.
          If enabled, when PPP stops (which happens automatically when the LTE link goes down)
          CMUX will make the AT channel be on DLCI 1. This only has an effect if it had been
          configured to be elsewhere, e.g. with AT#XCMUX=2.

    endif

    module = SLM
    module-str = serial modem
    source "${ZEPHYR_BASE}/subsys/logging/Kconfig.template.log_config"

    rsource "src/ftp_c/Kconfig"
    rsource "src/mqtt_c/Kconfig"
    rsource "src/http_c/Kconfig"
    rsource "src/twi/Kconfig"
    rsource "src/gpio/Kconfig"
    rsource "src/lwm2m_carrier/Kconfig"
    rsource "src/gnss/Kconfig"
    rsource "src/nativetls/Kconfig"

    endmenu
    thanks a lot!
  • You can show what the compiled zephyr.dts and .config file looks like. Then we can know for sure what is enabled and not, and know if the error is in the hardware or software.

Related