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

Configuration MQTT Simple

Hello,

I'm trying to establish a connection with my own MQTT brocker on MQTT Box. I change the config on the prj.conf  and on Kconfig file, like this :

But when i rebuild the solution and run the sample, it seems like it was always the previous configuration as if the changes had not been assimilated as you can see on the picture below

Parents Reply
  • Please provide full LTE Link Monitor output to verify the connection. 

    Have you verified the MQTT connection on your computer? As there is no errors, I can't see that there is an issue. Try adding CONFIG_MQTT_LOG_LEVEL_DBG=y to our project as well. This should give more information on regarding.

    Have you verified that your setup is configured for TSL? From MQTT.org: TCP/IP port 8883 is also registered, for using MQTT over SSL. Have you tried with port 1883?

Children
  • LTE link monitor gives this  :

    2021-06-22T12:33:44.562Z INFO Application data folder: C:\Users\leo\AppData\Roaming\nrfconnect\pc-nrfconnect-linkmonitor
    2021-06-22T12:33:44.635Z DEBUG App pc-nrfconnect-linkmonitor v1.1.10 official
    2021-06-22T12:33:44.636Z DEBUG App path: C:\Users\leo\.nrfconnect-apps\node_modules\pc-nrfconnect-linkmonitor
    2021-06-22T12:33:44.636Z DEBUG nRFConnect 3.6.1 is supported by the app (^3.6.0)
    2021-06-22T12:33:44.636Z DEBUG nRFConnect path: C:\Users\leo\AppData\Local\Programs\nrfconnect\resources\app.asar
    2021-06-22T12:33:44.636Z DEBUG HomeDir: C:\Users\leo
    2021-06-22T12:33:44.636Z DEBUG TmpDir: C:\Users\leo\AppData\Local\Temp
    2021-06-22T12:33:44.650Z VERBOSE Could not fetch serial number for serial port at COM3
    2021-06-22T12:33:44.650Z VERBOSE Could not fetch serial number for serial port at COM4
    2021-06-22T12:33:44.650Z VERBOSE Could not fetch serial number for serial port at COM5
    2021-06-22T12:33:44.651Z VERBOSE Could not fetch serial number for serial port at COM6
    2021-06-22T12:33:49.273Z INFO Modem port is opened
    2021-06-22T12:33:49.280Z DEBUG modem >> AT+CFUN?
    2021-06-22T12:33:49.320Z DEBUG modem << +CFUN: 1
    2021-06-22T12:33:49.322Z DEBUG modem << OK
    2021-06-22T12:33:49.343Z DEBUG modem >> AT+CGSN=1
    2021-06-22T12:33:49.359Z DEBUG modem << +CGSN: "352656106125548"
    2021-06-22T12:33:49.362Z DEBUG modem << OK
    2021-06-22T12:33:49.367Z DEBUG modem >> AT+CGMI
    2021-06-22T12:33:49.384Z DEBUG modem << Nordic Semiconductor ASA
    2021-06-22T12:33:49.387Z DEBUG modem << OK
    2021-06-22T12:33:49.396Z DEBUG modem >> AT+CGMM
    2021-06-22T12:33:49.411Z DEBUG modem << nRF9160-SICA
    2021-06-22T12:33:49.414Z DEBUG modem << OK
    2021-06-22T12:33:49.418Z DEBUG modem >> AT+CGMR
    2021-06-22T12:33:49.433Z DEBUG modem << mfw_nrf9160_1.2.3
    2021-06-22T12:33:49.435Z DEBUG modem << OK
    2021-06-22T12:33:49.436Z INFO Nordic Semiconductor ASA nRF9160-SICA [mfw_nrf9160_1.2.3] SerNr: 352656106125548
    2021-06-22T12:33:49.444Z DEBUG modem >> AT+CEMODE?
    2021-06-22T12:33:49.461Z DEBUG modem << +CEMODE: 2
    2021-06-22T12:33:49.464Z DEBUG modem << OK
    2021-06-22T12:33:49.478Z DEBUG modem >> AT%XCBAND=?
    2021-06-22T12:33:49.496Z DEBUG modem << %XCBAND: (1,2,3,4,5,8,12,13,18,19,20,25,26,28,66)
    2021-06-22T12:33:49.502Z DEBUG modem << 
    2021-06-22T12:33:49.504Z DEBUG modem << OK
    2021-06-22T12:33:49.519Z DEBUG modem >> AT+CMEE?
    2021-06-22T12:33:49.535Z DEBUG modem << +CMEE: 0
    2021-06-22T12:33:49.537Z DEBUG modem << OK
    2021-06-22T12:33:49.543Z DEBUG modem >> AT+CMEE=1
    2021-06-22T12:33:49.560Z DEBUG modem << OK
    2021-06-22T12:33:49.564Z DEBUG modem >> AT+CNEC?
    2021-06-22T12:33:49.579Z DEBUG modem << +CNEC: 0
    2021-06-22T12:33:49.582Z DEBUG modem << OK
    2021-06-22T12:33:49.586Z DEBUG modem >> AT+CNEC=24
    2021-06-22T12:33:49.600Z DEBUG modem << OK
    2021-06-22T12:33:49.603Z DEBUG modem >> AT+CGEREP?
    2021-06-22T12:33:49.616Z DEBUG modem << +CGEREP: 0,0
    2021-06-22T12:33:49.618Z DEBUG modem << OK
    2021-06-22T12:33:49.621Z DEBUG modem >> AT+CGDCONT?
    2021-06-22T12:33:49.631Z DEBUG modem << +CGDCONT: 0,"IP","orange.m2m.spec","10.160.64.147",0,0
    2021-06-22T12:33:49.633Z DEBUG modem << OK
    2021-06-22T12:33:49.647Z DEBUG modem >> AT+CGACT?
    2021-06-22T12:33:49.653Z DEBUG modem << +CGACT: 0,1
    2021-06-22T12:33:49.655Z DEBUG modem << OK
    2021-06-22T12:33:49.665Z DEBUG modem >> AT+CGEREP=1
    2021-06-22T12:33:49.677Z DEBUG modem << OK
    2021-06-22T12:33:49.682Z DEBUG modem >> AT+CIND=1,1,1
    2021-06-22T12:33:49.687Z DEBUG modem << OK
    2021-06-22T12:33:49.694Z DEBUG modem >> AT+CEREG=5
    2021-06-22T12:33:49.710Z DEBUG modem << OK
    2021-06-22T12:33:49.712Z DEBUG modem >> AT+CEREG?
    2021-06-22T12:33:49.730Z DEBUG modem << +CEREG: 5,1,"08C1","00997605",7,,,"11100000","11100000"
    2021-06-22T12:33:49.735Z DEBUG modem << OK
    2021-06-22T12:33:49.750Z DEBUG modem >> AT+COPS=3,2
    2021-06-22T12:33:49.763Z DEBUG modem << OK
    2021-06-22T12:33:49.766Z DEBUG modem >> AT+COPS?
    2021-06-22T12:33:49.778Z DEBUG modem << +COPS: 0,2,"20801",7
    2021-06-22T12:33:49.781Z DEBUG modem << OK
    2021-06-22T12:33:49.798Z DEBUG modem >> AT%XCBAND
    2021-06-22T12:33:49.813Z DEBUG modem << %XCBAND: 20
    2021-06-22T12:33:49.815Z DEBUG modem << OK
    2021-06-22T12:33:49.821Z DEBUG modem >> AT+CGDCONT?
    2021-06-22T12:33:49.840Z DEBUG modem << +CGDCONT: 0,"IP","orange.m2m.spec","10.160.64.147",0,0
    2021-06-22T12:33:49.846Z DEBUG modem << 
    2021-06-22T12:33:49.847Z DEBUG modem << OK
    2021-06-22T12:33:49.862Z DEBUG modem >> AT+CGACT?
    2021-06-22T12:33:49.877Z DEBUG modem << +CGACT: 0,1
    2021-06-22T12:33:49.879Z DEBUG modem << OK
    2021-06-22T12:33:49.883Z DEBUG modem >> AT%CESQ=1
    2021-06-22T12:33:49.896Z DEBUG modem << OK
    2021-06-22T12:33:49.899Z DEBUG modem >> AT+CESQ
    2021-06-22T12:33:49.913Z DEBUG modem << +CESQ: 99,99,255,255,15,49
    2021-06-22T12:33:49.917Z DEBUG modem << OK
    2021-06-22T12:33:49.942Z DEBUG modem >> AT%XSIM=1
    2021-06-22T12:33:49.960Z DEBUG modem << OK
    2021-06-22T12:33:49.965Z DEBUG modem >> AT%XSIM?
    2021-06-22T12:33:49.994Z DEBUG modem << %XSIM: 1
    2021-06-22T12:33:49.998Z DEBUG modem << OK
    2021-06-22T12:33:50.019Z DEBUG modem >> AT+CPIN?
    2021-06-22T12:33:50.037Z DEBUG modem << +CPIN: READY
    2021-06-22T12:33:50.047Z DEBUG modem << OK
    2021-06-22T12:33:50.062Z DEBUG modem >> AT+CPINR="SIM PIN"
    2021-06-22T12:33:50.085Z DEBUG modem << +CPINR: "SIM PIN",3
    2021-06-22T12:33:50.089Z DEBUG modem << OK
    2021-06-22T12:33:50.101Z DEBUG modem >> AT+CIMI
    2021-06-22T12:33:50.115Z DEBUG modem << 208012400427049
    2021-06-22T12:33:50.118Z DEBUG modem << OK
    2021-06-22T12:33:50.119Z INFO IMSIdentity: 208012400427049
    2021-06-22T12:33:50.979Z DEBUG modem << %CESQ: 49,2,14,2
    2021-06-22T12:33:56.098Z DEBUG modem << %CESQ: 46,2,9,1
    2021-06-22T12:33:58.097Z DEBUG modem << +CSCON: 1
    2021-06-22T12:33:58.296Z DEBUG modem << %CESQ: 41,2,6,0
    2021-06-22T12:33:59.007Z DEBUG modem << [00:00:33.627,288] [0m<inf> mqtt_simple: Publishing: Hello from nRF91 MQTT Simple Sample[0m
    2021-06-22T12:33:59.036Z DEBUG modem << [00:00:33.627,288] [0m<inf> mqtt_simple: to topic: my/publish/topic len: 16[0m
    2021-06-22T12:33:59.039Z DEBUG modem << [00:00:34.002,227] [0m<inf> mqtt_simple: PUBACK packet id: 12081[0m
    2021-06-22T12:34:00.497Z DEBUG modem << %CESQ: 46,2,9,1
    2021-06-22T12:34:02.297Z DEBUG modem << %CESQ: 47,2,14,2
    2021-06-22T12:34:04.818Z DEBUG modem << +CSCON: 0
    2021-06-22T12:34:34.833Z DEBUG modem << +CSCON: 1
    2021-06-22T12:34:34.843Z DEBUG modem << %CESQ: 39,1,5,0
    2021-06-22T12:34:35.589Z DEBUG modem << [00:01:10.209,167] [0m<inf> mqtt_simple: Publishing: Hello from nRF91 MQTT Simple Sample[0m
    2021-06-22T12:34:35.596Z DEBUG modem << [00:01:10.209,167] [0m<inf> mqtt_simple: to topic: my/publish/topic len: 16[0m
    2021-06-22T12:34:35.612Z DEBUG modem << [00:01:10.723,785] [0m<inf> mqtt_simple: PUBACK packet id: 12412[0m
    2021-06-22T12:34:35.833Z DEBUG modem << %CESQ: 44,2,9,1
    2021-06-22T12:34:41.856Z DEBUG modem << +CSCON: 0
    2021-06-22T12:34:48.580Z DEBUG modem << %CESQ: 48,2,14,2
    2021-06-22T12:35:24.421Z DEBUG modem << %CESQ: 49,2,9,1
    2021-06-22T12:35:34.744Z DEBUG modem << +CSCON: 1
    2021-06-22T12:35:41.378Z DEBUG modem << +CSCON: 0
    2021-06-22T12:35:42.340Z DEBUG modem << %CESQ: 47,2,14,2
    2021-06-22T12:36:34.745Z DEBUG modem << +CSCON: 1
    2021-06-22T12:36:36.345Z DEBUG modem << %CESQ: 44,2,9,1
    2021-06-22T12:36:41.458Z DEBUG modem << +CSCON: 0
    2021-06-22T12:36:52.710Z DEBUG modem << %CESQ: 48,2,14,2
    2021-06-22T12:36:54.515Z DEBUG modem << *** Booting Zephyr OS build v2.4.99-ncs2  ***
    2021-06-22T12:36:54.521Z DEBUG modem << Flash regionsDomainPermissions
    2021-06-22T12:36:54.523Z DEBUG modem << 00 00 0x00000 0x08000 Securerwxl
    2021-06-22T12:36:54.526Z DEBUG modem << 01 31 0x08000 0x100000 Non-Securerwxl
    2021-06-22T12:36:54.531Z DEBUG modem << Non-secure callable region 0 placed in flash region 0 with size 32.
    2021-06-22T12:36:54.703Z DEBUG modem << SRAM regionDomainPermissions
    2021-06-22T12:36:54.711Z DEBUG modem << 00 07 0x00000 0x10000 Securerwxl
    2021-06-22T12:36:54.712Z DEBUG modem << 08 31 0x10000 0x40000 Non-Securerwxl
    2021-06-22T12:36:54.715Z DEBUG modem << PeripheralDomainStatus
    2021-06-22T12:36:54.717Z DEBUG modem << 00 NRF_P0               Non-SecureOK
    2021-06-22T12:36:54.726Z DEBUG modem << 01 NRF_CLOCK            Non-SecureOK
    2021-06-22T12:36:54.728Z DEBUG modem << 02 NRF_RTC0             Non-SecureOK
    2021-06-22T12:36:54.729Z DEBUG modem << 03 NRF_RTC1             Non-SecureOK
    2021-06-22T12:36:54.731Z DEBUG modem << 04 NRF_NVMC             Non-SecureOK
    2021-06-22T12:36:54.736Z DEBUG modem << 05 NRF_UARTE1           Non-SecureOK
    2021-06-22T12:36:54.742Z DEBUG modem << 06 NRF_UARTE2           SecureSKIP
    2021-06-22T12:36:54.752Z DEBUG modem << 07 NRF_TWIM2            Non-SecureOK
    2021-06-22T12:36:54.754Z DEBUG modem << 08 NRF_SPIM3            Non-SecureOK
    2021-06-22T12:36:54.755Z DEBUG modem << 09 NRF_TIMER0           Non-SecureOK
    2021-06-22T12:36:54.756Z DEBUG modem << 10 NRF_TIMER1           Non-SecureOK
    2021-06-22T12:36:54.763Z DEBUG modem << 11 NRF_TIMER2           Non-SecureOK
    2021-06-22T12:36:54.764Z DEBUG modem << 12 NRF_SAADC            Non-SecureOK
    2021-06-22T12:36:54.766Z DEBUG modem << 13 NRF_PWM0             Non-SecureOK
    2021-06-22T12:36:54.769Z DEBUG modem << 14 NRF_PWM1             Non-SecureOK
    2021-06-22T12:36:54.772Z DEBUG modem << 15 NRF_PWM2             Non-SecureOK
    2021-06-22T12:36:54.779Z DEBUG modem << 16 NRF_PWM3             Non-SecureOK
    2021-06-22T12:36:54.781Z DEBUG modem << 17 NRF_WDT              Non-SecureOK
    2021-06-22T12:36:54.782Z DEBUG modem << 18 NRF_IPC              Non-SecureOK
    2021-06-22T12:36:54.785Z DEBUG modem << 19 NRF_VMC              Non-SecureOK
    2021-06-22T12:36:54.787Z DEBUG modem << 20 NRF_FPU              Non-SecureOK
    2021-06-22T12:36:54.795Z DEBUG modem << 21 NRF_EGU1             Non-SecureOK
    2021-06-22T12:36:54.796Z DEBUG modem << 22 NRF_EGU2             Non-SecureOK
    2021-06-22T12:36:54.797Z DEBUG modem << 23 NRF_DPPIC            Non-SecureOK
    2021-06-22T12:36:54.800Z DEBUG modem << 24 NRF_REGULATORS       Non-SecureOK
    2021-06-22T12:36:54.802Z DEBUG modem << 25 NRF_GPIOTE1          Non-SecureOK
    2021-06-22T12:36:54.804Z DEBUG modem << SPM: NS image at 0xc000
    2021-06-22T12:36:54.811Z DEBUG modem << SPM: NS MSP at 0x20019720
    2021-06-22T12:36:54.812Z DEBUG modem << SPM: NS reset vector at 0x10009
    2021-06-22T12:36:54.814Z DEBUG modem << SPM: prepare to jump to Non-Secure image.
    2021-06-22T12:36:55.018Z DEBUG modem << *** Booting Zephyr OS build v2.4.99-ncs2  ***
    2021-06-22T12:36:56.024Z DEBUG modem << [00:00:00.205,505] [0m<inf> mqtt_simple: The MQTT simple sample started[0m
    2021-06-22T12:36:56.065Z DEBUG modem << [00:00:00.205,505] [0m<inf> mqtt_simple: Disabling PSM and eDRX[0m
    2021-06-22T12:36:56.068Z DEBUG modem << [00:00:00.213,287] [0m<inf> mqtt_simple: LTE Link Connecting...[0m
    2021-06-22T12:37:07.589Z DEBUG modem << +CEREG: 2,"08C1","00997605",7,0,0,"11100000","11100000"
    2021-06-22T12:37:07.701Z DEBUG modem << +CSCON: 1
    2021-06-22T12:37:08.407Z DEBUG modem << +CEREG: 1,"08C1","00997605",7,,,"11100000","11100000"
    2021-06-22T12:37:08.412Z DEBUG modem >> AT+COPS=3,2
    2021-06-22T12:37:08.420Z DEBUG modem << OK
    2021-06-22T12:37:08.422Z DEBUG modem >> AT+COPS?
    2021-06-22T12:37:08.428Z DEBUG modem << +COPS: 0,2,"20801",7
    2021-06-22T12:37:08.429Z DEBUG modem << OK
    2021-06-22T12:37:08.440Z DEBUG modem >> AT%XCBAND
    2021-06-22T12:37:08.456Z DEBUG modem << %XCBAND: 20
    2021-06-22T12:37:08.457Z DEBUG modem << OK
    2021-06-22T12:37:08.463Z DEBUG modem >> AT+CGDCONT?
    2021-06-22T12:37:08.478Z DEBUG modem << +CGDCONT: 0,"IP","orange.m2m.spec","10.166.188.84",0,0
    2021-06-22T12:37:08.479Z DEBUG modem << OK
    2021-06-22T12:37:08.490Z DEBUG modem >> AT+CGACT?
    2021-06-22T12:37:08.495Z DEBUG modem << +CGACT: 0,1
    2021-06-22T12:37:08.498Z DEBUG modem << OK
    2021-06-22T12:37:09.412Z DEBUG modem << [00:00:13.594,543] [0m<inf> mqtt_simple: LTE Link Connected![0m
    2021-06-22T12:37:09.420Z DEBUG modem << [00:00:13.833,770] [0m<inf> mqtt_simple: IPv4 Address found 137.135.83.217[0m
    2021-06-22T12:37:09.425Z DEBUG modem << [00:00:14.178,771] [0m<inf> mqtt_simple: MQTT client connected[0m
    2021-06-22T12:37:09.433Z DEBUG modem << [00:00:14.178,771] [0m<inf> mqtt_simple: Subscribing to: my/subscribe/topic len 18[0m
    2021-06-22T12:37:09.439Z DEBUG modem << [00:00:14.327,819] [0m<inf> mqtt_simple: SUBACK packet id: 1234[0m
    2021-06-22T12:37:09.446Z DEBUG modem << [00:00:14.477,783] [0m<inf> mqtt_simple: MQTT PUBLISH result=0 len=2[0m
    2021-06-22T12:37:09.458Z DEBUG modem << [00:00:14.477,874] [0m<inf> mqtt_simple: Received: Yo[0m
    2021-06-22T12:37:09.459Z DEBUG modem << [00:00:14.524,078] [0m<inf> mqtt_simple: Publishing: Yo[0m
    2021-06-22T12:37:09.472Z DEBUG modem << [00:00:14.524,078] [0m<inf> mqtt_simple: to topic: my/publish/topic len: 16[0m
    2021-06-22T12:37:09.474Z DEBUG modem << [00:00:14.647,796] [0m<inf> mqtt_simple: PUBACK packet id: 50269[0m
    2021-06-22T12:37:16.200Z DEBUG modem << +CSCON: 0
    2021-06-22T12:37:30.185Z DEBUG modem << +CSCON: 1
    2021-06-22T12:37:31.065Z DEBUG modem << [00:00:35.245,635] [0m<inf> mqtt_simple: Publishing: Hello from nRF91 MQTT Simple Sample[0m
    2021-06-22T12:37:31.078Z DEBUG modem << [00:00:35.245,666] [0m<inf> mqtt_simple: to topic: my/publish/topic len: 16[0m
    2021-06-22T12:37:32.125Z DEBUG modem << [00:00:36.307,769] [0m<inf> mqtt_simple: PUBACK packet id: 8221[0m
    2021-06-22T12:37:37.629Z DEBUG modem << +CSCON: 0
    

    Yes i tried the MQTT connection on my computer :

    No I didn't configure the TLS function, should we just modify the concerned line in the <prj.conf> file :

    To save the changes made in the prj.conf file, should we just rebuild and run the solution?

  • From the monitor output it looks like your are not subscribing or publishing to the correct topics. Your application is subscribing and publishing to:

    2021-06-22T12:37:09.433Z DEBUG modem << [00:00:14.178,771] [0m<inf> mqtt_simple: Subscribing to: my/subscribe/topic len 18[0m
    2021-06-22T12:37:09.439Z DEBUG modem << [00:00:14.327,819] [0m<inf> mqtt_simple: SUBACK packet id: 1234[0m
    2021-06-22T12:37:09.446Z DEBUG modem << [00:00:14.477,783] [0m<inf> mqtt_simple: MQTT PUBLISH result=0 len=2[0m
    2021-06-22T12:37:09.458Z DEBUG modem << [00:00:14.477,874] [0m<inf> mqtt_simple: Received: Yo[0m
    2021-06-22T12:37:09.459Z DEBUG modem << [00:00:14.524,078] [0m<inf> mqtt_simple: Publishing: Yo[0m
    2021-06-22T12:37:09.472Z DEBUG modem << [00:00:14.524,078] [0m<inf> mqtt_simple: to topic: my/publish/topic len: 16[0m
    

    Please verify topics. 


Related