Syslog backend over LTE-M for nrf9160

How to properly activate zephyr logs with network syslog backend to work over LTE-M for nrf9160 custom device?

Parents Reply Children
  • Sorry for the delay, I had many issues with setting everything up.

    For the last few days I have been trying to both integrate LTE into the syslog sample and try to integrate syslog into Asset Tracker v2 unsuccessfully.

    But I finally have good news!

    I have finally managed to SUCCESSFULLY send the logs to the papertrail server with the syslog sample on NCS 2.8.0.

    My configuration right now is quite suboptimal and chaotic, but this is how I have managed to do it, so please test it as well, just change the papertrail address to your own.

    prj.conf:

    # nRF modem library
    CONFIG_NRF_MODEM_LIB=y
    # CONFIG_NRF_MODEM_LIB_ON_FAULT_APPLICATION_SPECIFIC=y
    
    # LTE link control
    CONFIG_LTE_LINK_CONTROL=y
    CONFIG_LTE_NETWORK_MODE_LTE_M=y
    
    
    CONFIG_NETWORKING=y
    CONFIG_NET_UDP=y
    # CONFIG_ENTROPY_GENERATOR=y
    # CONFIG_TEST_RANDOM_GENERATOR=y
    CONFIG_INIT_STACKS=y
    CONFIG_NET_PKT_RX_COUNT=32
    CONFIG_NET_PKT_TX_COUNT=32
    CONFIG_NET_BUF_RX_COUNT=32
    CONFIG_NET_BUF_TX_COUNT=32
    CONFIG_NET_SOCKETS=y
    
    # CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3
    # CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=5
    
    CONFIG_NET_LOG=y
    CONFIG_LOG=y
    
    # Deferred mode is required, synchronous mode does not work with network syslog
    # as it would cause the sent packet to be malformed (contains only 1 byte data)
    CONFIG_LOG_MODE_DEFERRED=y
    
    CONFIG_NET_IPV6=n
    CONFIG_NET_IPV4=y
    CONFIG_NET_DHCPV4=n
    
    # CONFIG_NET_SHELL=y
    
    # CONFIG_NET_CONFIG_SETTINGS=y
    # CONFIG_NET_CONFIG_NEED_IPV6=y
    # CONFIG_NET_CONFIG_NEED_IPV4=y
    # CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1"
    # CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2"
    # CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1"
    # CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2"
    
    # logging net backend config
    CONFIG_LOG_BACKEND_NET=y
    #CONFIG_LOG_BACKEND_NET_SERVER="[2001:db8::2]:514"
    CONFIG_LOG_BACKEND_NET_SERVER="169.46.nn.nnn:xxxxx"
    CONFIG_LOG_BACKEND_NET_SERVER="[logsn.papertrailapp.com]:xxxxx"
    
    # Get a proper libc by default in order to get working time function support
    CONFIG_REQUIRES_FULL_LIBC=y
    
    
    # Network
    CONFIG_NETWORKING=y
    CONFIG_NET_NATIVE=n
    CONFIG_NET_SOCKETS=y
    CONFIG_NET_SOCKETS_OFFLOAD=y
    CONFIG_NET_IPV6=n
    CONFIG_NET_IPV4=y
    
    # LTE link control
    ## Power saving timers.
    ### 320 hours PSM.
    CONFIG_LTE_PSM_REQ=y
    CONFIG_LTE_PSM_REQ_RPTAU="11000001"
    ### 20 seconds active time.
    CONFIG_LTE_PSM_REQ_RAT="00001010"
    ### Enable required modules
    CONFIG_LTE_LC_EDRX_MODULE=y
    CONFIG_LTE_LC_NEIGHBOR_CELL_MEAS_MODULE=y
    CONFIG_LTE_LC_PSM_MODULE=y
    CONFIG_LTE_LC_MODEM_SLEEP_MODULE=y
    
    
    CONFIG_NCS_SAMPLES_DEFAULTS=y
    
    # to get the logs on UART as well
    CONFIG_LOG_BACKEND_UART=y

    And in main.c I just added the following at the start of the main{} function:

    int main(void)
    {
    
    	LOG_DBG("Modem config and start");
    	int err;
    	err = nrf_modem_lib_init();
    	err = lte_lc_connect();
    	if (err) {
    		LOG_DBG("Failed to connect to LTE network, error: %d\n", err);
    		return -1;
    	}

    And if it still won't work for you, then please send me the log.

    Best regards,

    Michal

Related