# Can't connect to MQTT broker

**URL:** <https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716>\
**Category:** Legacy HL Series\
**Created:** [February 1, 2021, 10:39am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716 "2021-02-01T10:39:10Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![hkiol](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/hkiol/32/5998_2.png) [@hkiol](https://forum.sierrawireless.com/u/hkiol)\
**Post date:** [February 1, 2021, 10:39am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/1 "2021-02-01T10:39:10Z")

</div>

Hi,

I’m trying to establish a TCP connection with the HiveMQ MQTT broker (18.184.63.203) using the HL7802 module.  
I have succesfully connected to a local PC but when i try to connect to an online broker (Hive MQ, Losant), i get a TCP connection error ![atco](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/f/f68d0e4d5a8b50478007d3cac89a1aef9dacee2b.png) . Any ideas as to what i’m doing wrong?  
thanks

---

<div class="post-metadata">

**Author:** ![Donald](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Donald](https://forum.sierrawireless.com/u/Donald)\
**Post date:** [February 1, 2021, 10:57am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/2 "2021-02-01T10:57:40Z")

</div>

Hi @hkiol

I can make the TCP connection successfully, according to your commands. Below is the log of my commands

> 17:51:45.036 on 01-Feb-2021\> at+kcnxcfg=1,“GPRS”,“lp.fota.swir”  
> 17:52:02.434 on 01-Feb-2021\>  
> 17:52:02.434 on 01-Feb-2021\> OK  
> 17:52:02.434 on 01-Feb-2021\> at+ktcpcfg=1,0,“18.184.63.203”,1883  
> 17:52:04.500 on 01-Feb-2021\>  
> 17:52:04.500 on 01-Feb-2021\> +KTCPCFG: 1  
> 17:52:04.500 on 01-Feb-2021\>  
> 17:52:04.500 on 01-Feb-2021\> OK  
> 17:52:04.500 on 01-Feb-2021\> at+ktcpcnx=1  
> 17:52:07.493 on 01-Feb-2021\>  
> 17:52:07.505 on 01-Feb-2021\> OK  
> 17:52:07.505 on 01-Feb-2021\>  
> 17:52:07.505 on 01-Feb-2021\> +KCNX\_IND: 1,1,0  
> 17:52:07.524 on 01-Feb-2021\>  
> 17:52:08.886 on 01-Feb-2021\> +KTCP\_IND: 1,1  
> 17:52:08.886 on 01-Feb-2021\>

Could you please help to send the below commands to get more information about the issue you faced:  
- AT+CCID  
- AT+CPIN?  
- AT+CREG?  
- AT+CGDCONT?  
- AT+CGACT?  
- AT+KCNXCFG=1,“GPRS”,“your APN here”  
- AT+KTCPCFG=1,0,“18.184.63.203”,1883  
- AT+KTCPCNX=1

---

<div class="post-metadata">

**Author:** ![hkiol](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/hkiol/32/5998_2.png) [@hkiol](https://forum.sierrawireless.com/u/hkiol)\
**Post date:** [February 1, 2021, 11:06am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/3 "2021-02-01T11:06:03Z")

</div>

Thanks for the swift reply.  
Here’s what i see:  
 ![111](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/5/5545d1071ed1449cd1f7d863220cc0dd36725945.png)  
 ![22](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/1/1af3d3c0630e8cf1835545cbf6fc4b2b12f49b0e.png)

So it connects but disconnects immediately.

---

<div class="post-metadata">

**Author:** ![Vianney](https://avatars.discourse-cdn.com/v4/letter/v/71e660/32.png) [@Vianney](https://forum.sierrawireless.com/u/Vianney)\
**Post date:** [February 2, 2021, 6:06am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/4 "2021-02-02T06:06:18Z")

</div>

Hi @hkiol,

According to your image, I observe that your device still does not connect to server “18.184.63.203” successfully, it showed KTCP\_NOTIF: 1,5 - TCP Connection error  
The successful connection should be KTCP\_IND: 1,1 as Donald’s above log.  
I suspect that your device’s registered network cannot reach to the IP address “18.184.63.203” via port 1883. Could you please help to check again?

Thanks

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [February 2, 2021, 8:28am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/5 "2021-02-02T08:28:30Z")

</div>

Hi @Donald ,

Which FW are you using for this test?

---

<div class="post-metadata">

**Author:** ![Donald](https://avatars.discourse-cdn.com/v4/letter/d/ac8455/32.png) [@Donald](https://forum.sierrawireless.com/u/Donald)\
**Post date:** [February 2, 2021, 9:31am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/6 "2021-02-02T09:31:25Z")

</div>

Hi @jyijyi,

I used the latest published FW for H7802: HL7802.4.6.6.0

Please refer to below for more detail

> ATI9  
> 16:26:49.564 on 02-Feb-2021\>  
> 16:26:49.564 on 02-Feb-2021\> HL7802.4.6.6  
> 16:26:49.564 on 02-Feb-2021\> HL78xx.4.6.6.0.RK\_02\_01\_02\_00\_122.20201221  
> 16:26:49.593 on 02-Feb-2021\> 2020/12/21 19:23:17  
> 16:26:49.593 on 02-Feb-2021\> IMEI-SV: 3594590900062613  
> 16:26:49.593 on 02-Feb-2021\> Legato RTOS: 18.09.6.ALT1250.rc4 2020/10/06 17:52:39  
> 16:26:49.593 on 02-Feb-2021\> atSwi: 42.00  
> 16:26:49.593 on 02-Feb-2021\> UBOOT: 01.03  
> 16:26:49.593 on 02-Feb-2021\> Apps: RKAPP\_02\_01\_02\_00\_115\_\_cf01697c56fbf87c1ff30fa676646f6cd010ca02  
> 16:26:49.593 on 02-Feb-2021\> MAC: ALT1250\_02\_01\_02\_00\_112\_2G  
> 16:26:49.593 on 02-Feb-2021\> PHY: 12.50.241281  
> 16:26:49.594 on 02-Feb-2021\> PMP: 248903  
> 16:26:49.594 on 02-Feb-2021\> SBUB: 1  
> 16:26:49.594 on 02-Feb-2021\> SBFW: 1  
> 16:26:49.594 on 02-Feb-2021\> RPuK: 53F7A48A  
> 16:26:49.594 on 02-Feb-2021\> FPuK: 139A8E70  
> 16:26:49.594 on 02-Feb-2021\> RBUB: 0  
> 16:26:49.594 on 02-Feb-2021\> RBFW: 0  
> 16:26:49.594 on 02-Feb-2021\>  
> 16:26:49.594 on 02-Feb-2021\> OK  
> 16:26:49.594 on 02-Feb-2021\> ATI3  
> 16:26:49.611 on 02-Feb-2021\>  
> 16:26:49.611 on 02-Feb-2021\> HL7802.4.6.6.0  
> 16:26:49.611 on 02-Feb-2021\>  
> 16:26:49.611 on 02-Feb-2021\> OK  
> 16:26:49.611 on 02-Feb-2021\> at+kcnxcfg=1,“GPRS”,“lp.fota.swir”  
> 16:27:00.413 on 02-Feb-2021\>  
> 16:27:00.413 on 02-Feb-2021\> OK  
> 16:27:00.413 on 02-Feb-2021\> at+ktcpcfg=1,0,“18.184.63.203”,1883  
> 16:27:02.991 on 02-Feb-2021\>  
> 16:27:02.991 on 02-Feb-2021\> +KTCPCFG: 1  
> 16:27:02.991 on 02-Feb-2021\>  
> 16:27:02.991 on 02-Feb-2021\> OK  
> 16:27:02.991 on 02-Feb-2021\> at+ktcpcnx=1  
> 16:27:05.496 on 02-Feb-2021\>  
> 16:27:05.519 on 02-Feb-2021\> OK  
> 16:27:05.519 on 02-Feb-2021\>  
> 16:27:05.519 on 02-Feb-2021\> +KCNX\_IND: 1,1,0  
> 16:27:05.519 on 02-Feb-2021\>  
> 16:27:06.873 on 02-Feb-2021\> +KTCP\_IND: 1,1  
> 16:27:06.873 on 02-Feb-2021\>

@hkiol: Besides the checking about network policy, Could you please also give a try on this latest FW?

Thanks

---

<div class="post-metadata">

**Author:** ![jyijyi](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/jyijyi/32/4766_2.png) [@jyijyi](https://forum.sierrawireless.com/u/jyijyi)\
**Post date:** [February 2, 2021, 9:33am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/7 "2021-02-02T09:33:56Z")

</div>

Agree, better try with same FW.

---

<div class="post-metadata">

**Author:** ![hkiol](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/hkiol/32/5998_2.png) [@hkiol](https://forum.sierrawireless.com/u/hkiol)\
**Post date:** [February 2, 2021, 9:36am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/8 "2021-02-02T09:36:32Z")

</div>

I will check about the network policy as you suggested.  
The FW i am running is 4.5.4, so i’ll get the latest one and try again.

Edit: I can’t find the version you mention.

 ![fwfw](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/a/a756bd69fe226d60fde070125b05deec4a4711a1.png)

Thanks guys/gals

---

<div class="post-metadata">

**Author:** ![Vianney](https://avatars.discourse-cdn.com/v4/letter/v/71e660/32.png) [@Vianney](https://forum.sierrawireless.com/u/Vianney)\
**Post date:** [February 2, 2021, 10:03am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/9 "2021-02-02T10:03:47Z")

</div>

Hi @hkiol,  
This latest published FW was just released yesterday. You can upgrade FW for your module with FOTA method thorugh AirVantage.

 ![image](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/9/979e079980ea3f2af13ae824379b7a1b22a8d3c5.jpeg)

If not, please wait a few days for this FW to be released on sierra source.

Thanks,

---

<div class="post-metadata">

**Author:** ![hkiol](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/hkiol/32/5998_2.png) [@hkiol](https://forum.sierrawireless.com/u/hkiol)\
**Post date:** [February 2, 2021, 1:48pm UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/10 "2021-02-02T13:48:22Z")

</div>

Alright, i updated to 4.6.6.0. The results are still the same.  
I am contacting my carrier.

Thanks

---

<div class="post-metadata">

**Author:** ![hkiol](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/hkiol/32/5998_2.png) [@hkiol](https://forum.sierrawireless.com/u/hkiol)\
**Post date:** [February 23, 2021, 7:53am UTC](https://forum.sierrawireless.com/t/cant-connect-to-mqtt-broker/22716/11 "2021-02-23T07:53:44Z")

</div>

It was a carrier issue as you guys mentioned.

Thanks
