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

simple mqtt and mqtt publisher not working.

Hi i was trying to use simple mqtt sample provided as example with location "ncs/nrf/samples/nrf9160/mqtt_simple" the code was build and run but during lte connection it takes aroung 5-10 minutes and after that it was failed to connect with mqtt client i tried by default defined "mqtt.eclipse.org" and some other brokers but everytime gives me error 

*** Booting Zephyr OS build v2.4.0-ncs1  ***The MQTT simple sample startedLTE Link Connecting ...+CEREG: 2,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"+CEREG: 0,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"+CEREG: 2,"00D8","003AC006",9,0,0,"11100000","11100000"+CSCON: 1+CEREG: 5,"00D8","003AC006",9,,,"11100000","11100000"LTE Link Connected!IPv4 Address found 198.41.30.194ERROR: mqtt_connect -60
i search for the error it was showing timeout error but doen't help me as i didn't find to resolve it.

after this i was also trying the other sample code mqtt publisher at location "zephyr/samples/net/mqtt_publisher". the code build and programmed but after that device rebooting again and again with following error 

Non-secure callable region 0 placed in flash region 0 with size 32.
.

can you please guide me for the mqtt code. as my requirent is to publish some messages on server after regular time intervals and how to make it faster connect with lte. please reply asap.

Parents
  • Hello,

    you can print out more detailed debug information with these to lines in prj.conf,

    CONFIG_NET_LOG=y
    CONFIG_MQTT_LOG_LEVEL_DBG=y

  • already done ang logs were shared before and i am sharing again as below

    ** Booting Zephyr OS build v2.4.0-ncs1  
    ***Flash regionsDomainPermissions00 00 0x00000 0x08000 
    Securerwxl01 31 0x08000 0x100000 Non-SecurerwxlNon-secure callable region 0 placed in flash region 0 with size 32.SRAM region
    DomainPermissions00 07 0x00000 0x10000 Securerwxl08 31 0x10000 0x40000 Non-SecurerwxlPeripheralDomainStatus
    00 NRF_P0               Non-SecureOK01 NRF_CLOCK            Non-SecureOK02 NRF_RTC0             
    Non-SecureOK03 NRF_RTC1             Non-SecureOK04 NRF_NVMC             
    Non-SecureOK05 NRF_UARTE1           Non-SecureOK06 NRF_UARTE2           
    SecureSKIP07 NRF_TWIM2            Non-SecureOK08 NRF_SPIM3            
    Non-SecureOK09 NRF_TIMER0           Non-SecureOK10 NRF_TIMER1          
    Non-SecureOK11 NRF_TIMER2           Non-SecureOK12 NRF_SAADC            
    Non-SecureOK13 NRF_PWM0             Non-SecureOK14 NRF_PWM1             
    Non-SecureOK15 NRF_PWM2             Non-SecureOK16 NRF_PWM3             
    Non-SecureOK17 NRF_WDT              Non-SecureOK18 NRF_IPC              
    Non-SecureOK19 NRF_VMC              Non-SecureOK20 NRF_FPU              
    Non-SecureOK21 NRF_EGU1             Non-SecureOK22 NRF_EGU2             
    Non-SecureOK23 NRF_DPPIC            Non-SecureOK24 NRF_GPIOTE1          
    Non-SecureOK25 NRF_REGULATORS       Non-SecureOK
    SPM: NS image at 0xc000SPM: NS MSP at 0x20025cf0
    SPM: NS reset vector at 0x102fd
    SPM: prepare to jump to Non-Secure image.
    *** Booting Zephyr OS build v2.4.0-ncs1  
    ***The MQTT simple sample startedLTE Link Connecting ...
    +CEREG: 2,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"
    +CEREG: 0,"FFFE","FFFFFFFF",7,0,0,"11100000","11100000"
    [00:10:00.264,862] [0m<inf> lte_lc: Network connection attempt timed out[0m[00:10:00.277,221] 
    [0m<inf> lte_lc: Using fallback network mode
    [0m+CEREG: 2,"C0D8","003AC006",9,0,0,"11100000","11100000"+CSCON: 1
    +CEREG: 5,"C0D8","003AC006",9,,,"11100000","11100000"
    LTE Link Connected!
    attempting to connect: IPv4 Address found 64.111.109.81
    [00:10:28.337,097] [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1
    [0mmqtt_connect -60IPv4 Address found 64.111.109.81
    [00:10:52.344,268] [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1
    [0mmqtt_connect -60IPv4 Address found 64.111.109.81
    [00:11:16.852,569] 
    [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1
    [0mmqtt_connect -60IPv4 Address found 64.111.109.81
    [00:11:41.359,893] [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1
    [0mmqtt_connect -60IPv4 Address found 64.111.109.81
    [00:12:05.866,271] [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1
    [0mmqtt_connect -60IPv4 Address found 64.111.109.81
    [00:12:30.374,389] [0m<dbg> net_mqtt_sock_tcp.mqtt_client_tcp_connect: (0x20023010): Created socket 1

  • The log says "lte_lc: Using fallback network mode". What is the fallback network mode set to?

  • There is a kconfig option for it. Can you post prj.conf?

  • Here is my pr.conf settings

    # 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
    CONFIG_LTE_LEGACY_PCO_MODE=y
    CONFIG_NRF_CLOUD_IPV6=y
    
    # BSD library
    CONFIG_BSD_LIBRARY=y
    
    # AT Host
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_AT_HOST_LIBRARY=y
    
    # MQTT
    CONFIG_MQTT_LIB=y
    CONFIG_MQTT_LIB_TLS=n
    
    # Appliaction
    #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="iot.eclipse.org"
    #CONFIG_MQTT_BROKER_PORT=1883
    
    # 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
    
    CONFIG_DEBUG_OPTIMIZATIONS=y 
    CONFIG_LEGACY_TIMEOUT_API=y
    #CONFIG_NET_LOG=y
    #CONFIG_MQTT_LOG_LEVEL_DBG=y
    

    please give some more suggestion n help me to solve the issue it taking too long.

Reply
  • Here is my pr.conf settings

    # 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
    CONFIG_LTE_LEGACY_PCO_MODE=y
    CONFIG_NRF_CLOUD_IPV6=y
    
    # BSD library
    CONFIG_BSD_LIBRARY=y
    
    # AT Host
    CONFIG_UART_INTERRUPT_DRIVEN=y
    CONFIG_AT_HOST_LIBRARY=y
    
    # MQTT
    CONFIG_MQTT_LIB=y
    CONFIG_MQTT_LIB_TLS=n
    
    # Appliaction
    #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="iot.eclipse.org"
    #CONFIG_MQTT_BROKER_PORT=1883
    
    # 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
    
    CONFIG_DEBUG_OPTIMIZATIONS=y 
    CONFIG_LEGACY_TIMEOUT_API=y
    #CONFIG_NET_LOG=y
    #CONFIG_MQTT_LOG_LEVEL_DBG=y
    

    please give some more suggestion n help me to solve the issue it taking too long.

Children
Related