# +KTCP\_NOTIF: 1,8 with correct data length sent

**URL:** <https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255>\
**Category:** Legacy HL Series\
**Created:** [February 4, 2020, 7:22pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255 "2020-02-04T19:22:40Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 4, 2020, 7:22pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/1 "2020-02-04T19:22:40Z")

</div>

Hi all,

> I am receiving a `+KTCP_NOTIF: 1,8` after transmitting TCP data. (_Data sending is OK but +KTCPSND was waiting for more or less characters_). Because of this, I do not know how many bytes the server is sending back to me, because I don’t get a +KTCP\_DATA response.

Using BHL7800-M.2.5.6.1.20190412.  
BHL78xx.2.5.6.1.RK\_02\_01\_01\_00\_41.20190412  
Legato RTOS: 18.09.2.ALT1250.rc5 2019/04/04 14:02:47

Sending `13866` bytes of data to a server using TCP. I have 3 data components concatenated together:

TCP Header, some pre-data, and data:

```
POST <IP-ADDRESS-ENDPOINT> HTTP/1.1<CR><LF>
Host: <IP-ADDRESS><CR><LF>
Content-Length: 13750<CR><LF> (NOTE: Total Size - TCP header size)
Content-Type: application/octet-stream<CR><LF>
<CR><LF>
[object][data]--EOF--Pattern--

```

The total size of this data ( **up to but not including** `--EOF--Pattern--`) in this example is `13866` bytes.

My general connection flow is as follows:

```
AT+K3
AT+CGDCONT=1,"IPV4V6","internet.sierrawireless.com" --> Receive OK
AT+KCNXCFG=1,"GPRS","internet.sierrawireless.com" --> Receive OK
AT+KTCPCFG=1,0,"<IP_ADDRESS>",80 --> Receive +KTCPCFG: 1
AT+KTCPCNX=1  
--> Receive +KCNX_IND: 1,1,0 (Connecting...)
--> Receive +KTCP_IND: 1,1 (Connected)

```

> Each command has 200 msec of delay after receiving a response, and before transmitting the next command. After receiving connect `KTCP_IND: 1,1`, I issue `AT+KTCPSND=1,13866` 200 msec later. I then wait for “`CONNECT`”. After receiving “`CONNECT`”, I start sending data to the UART.

`AT+KTCPSND=1,13866`  
`[200 msec delay]`  
`--> Receive CONNECT`  
[Immediately transmit `13866` bytes of data] (Have also tried with additional delays after `CONNECT`).

> 1. I verify with a logic analyzer that after “`CONNECT`”, the EXACT number of bytes (`13866`) are sent to the radio after `CONNECT` and **up to but not including** `--EOF--Pattern--`.
> 2. I verify the baud rate is correct (115200 +/- 1%)
> 3. Hardware flow control is enabled, and TX data (into the module) is being properly delayed when CTS is asserted.
> 4. I continue to run this example, and on occasion, the radio will respond with “+KTCP\_DATA: 1,\<bytes\_to\_receive\>”

Any ideas how I should approach this? Is there a way to query the module for how many bytes it received?

Appreciate any feedback anyone may have.  
Thank you

**Other threads I have read:**

> [@HL8548 How to create a TCP connection](https://forum.sierrawireless.com/t/hl8548-how-to-create-a-tcp-connection/12205/11):
>
> Team, [image] I am following the exact same steps given in the AirPrime\_HL6\_and\_HL8\_Series\_AT\_Commands\_Interface\_Guide\_Rev19\_0 page number 780 How to Use TCP Commands but i am not able to create the successful TCP connection. As soon as I Get CONNECT response from Modem, i send “GET / HTTP/1.0 but i do not get any response after that. it stays here for 1 min, after that timeout happens. It looks like i am not getting any response from HTTP/1.0 page? any help will be greatly appreciated! A…

> [@HL6528 - Kpattern problem](https://forum.sierrawireless.com/t/hl6528-kpattern-problem/9375):
>
> Hi, i’m using an HL6528 2.8V When connecting as a tcp client to a server, it happens that sometimes the kpattern is not recognized by the HL6528. the escape char is sent to the server as a data…i can see it in the log of the server I try to send it three times with a pause of 1 second between each try… but i never get the OK from the HL6528. it is sent three time as a data to the server It happens approximatively 1 times every 15 frames successfully sent to the server. it seems that the mod…

---

<div class="post-metadata">

**Author:** ![Sierra\_JordanZhao](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/sierra_jordanzhao/32/4974_2.png) [@Sierra\_JordanZhao](https://forum.sierrawireless.com/u/Sierra_JordanZhao)\
**Post date:** [February 5, 2020, 3:49am UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/2 "2020-02-05T03:49:17Z")

</div>

> [@rlemburg](#):
>
> `+KTCP_NOTIF: 1,8`

Would you please give a try on the latest version 3.7.2.3 or 3.5.0?  
[https://source.sierrawireless.com/resources/airprime/software/hl7800-firmware/hl78xx-firmware/#sthash.5xCRrlra.dpbs](https://source.sierrawireless.com/resources/airprime/software/hl7800-firmware/hl78xx-firmware/#sthash.5xCRrlra.dpbs)

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 5, 2020, 7:25pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/3 "2020-02-05T19:25:11Z")

</div>

Jordan,

Thank you for your response. I noticed also in document “_AirPrime - HL7800 - Customer Release Note - 3.5.0 - R00.15b_” that there is a known issue with this ([PROTOCOM][KTCPSND] +KTCP\_NOTIF: 1,8 is returned although module have sent fully data to server) on p. 70, (ID DIZZY1-1017). I have upgraded to firmware version BHL7800-M.3.7.0.0.20190918.

Could you please verify that when CTS is low, the radio module is in fact ready to receive more characters **right away**? My concern is that during a long data transmission, it appears the HL7800 is asserting CTS for about 5us or so after every byte sent. If the interrupt service routine in the HL7800 module is missing data if it is sent immediately, that could explain the KTCP\_IND: 1,8 situation. Are there any known issues with this, or can I continue to transmit data immediately whenever CTS is low?

The new firmware has improved this, but it still happens occasionally.

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 5, 2020, 8:10pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/4 "2020-02-05T20:10:44Z")

</div>

Update:

Still happening on BHL7800-M.3.7.0.0.20190918. Sending exactly the right number of bytes, but still receiving +KTCP\_NOTIF: 1,8. I will upgrade again to 3.7.2.3, and see if the same issue occurs there.

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 5, 2020, 8:32pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/5 "2020-02-05T20:32:52Z")

</div>

Update 2:

Upgraded to BHL7800-M.3.7.2.3.20191030. Transmitting correct number of bytes each time, but get back +KTCP\_DATA sometimes.

 ![Capture](https://us1.discourse-cdn.com/flex025/uploads/sierrawireless/original/2X/1/1302a3ba7a6deb7e1cf16e0376d5e676b0d49a2a.png)

Transmitting the same packet seems to yield different results each time. I must be missing something obvious!

---

<div class="post-metadata">

**Author:** ![cherokee](https://avatars.discourse-cdn.com/v4/letter/c/76d3ee/32.png) [@cherokee](https://forum.sierrawireless.com/u/cherokee)\
**Post date:** [February 6, 2020, 9:06am UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/6 "2020-02-06T09:06:05Z")

</div>

Hi @rlemburg,

+KTCP\_DATA is sent for each TCP packet received sequentially; notification of the following received packet is sent only when the current +KTCP\_DATA has been read with a +KTCPRCV command.

Please use command AT+KTCPRCV=\<session\_ID\>,\<n\_data\> to read the first packet. After that the next “+KTCP\_DATA” will be displayed.

Thanks,

---

<div class="post-metadata">

**Author:** ![Sierra\_JordanZhao](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/sierra_jordanzhao/32/4974_2.png) [@Sierra\_JordanZhao](https://forum.sierrawireless.com/u/Sierra_JordanZhao)\
**Post date:** [February 6, 2020, 9:17am UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/7 "2020-02-06T09:17:15Z")

</div>

What do you mean getting back +KTCP\_DATA sometimes? Do you mind to attach the OK and NG AT log for checking?

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 6, 2020, 5:21pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/8 "2020-02-06T17:21:18Z")

</div>

Thanks for your help, Jordan.

Here are two back-to-back examples of the same transmissions, but with and without the expected +KTCP\_DATA=1, from the module. Each transmission has the following sequence:

1. Full radio module power-off (including power supplies).
2. Power on module
3. Wait 30 seconds
4. Boot module, send 16 `AT` and receive 16 `OK`
5. Inquire network status with `AT+CGATT?` and verify attached.
6. Send connect and TCP transmit sequence

**Sequence 1**  
**Packet transmission sequence without KTCP\_DATA:1,ndata**

```
ATE0
OK

AT&K3
OK

AT+CCID
+CCID: <ccid>

OK

ATI3
BHL7800-M.3.7.2.3.20191030

OK
 
+CESQ: 99,99,255,255,11,34

OK

AT+CGDCONT=1,"IPV4V6","internet.sierrawireless.com"
 ERR>>ERROR
 [2,0] 80

AT+KCNXCFG=1,"GPRS","internet.sierrawireless.com"

OK
 EXP>>OK
 [2,0] 00

OK
APN connected [1236 ms]
AT&K3
 EXP>>OK
 [2,0] 00

AT+CCLK?

+CCLK: "20/02/06,10:16:00-24"

 EXP>>+CCLK: "20/02/06,10:16:00-24"
 [6,0] 00

OK
AT+KTCPCFG=1,0,"<ipaddress>,80

+KTCPCFG: 1

AT+KTCPCNX=1

OK

+KCNX_IND: 1,1,0

+KTCP_IND: 1,1
 EXP>>+KTCP_IND: 1,1
 [15,0] 00
 

AT+KTCPSND=1,13314

CONNECT
 

Connected. Sending data...
 
[DATA]--EOF--Pattern--
OK
 EXP>>OK
 [2,0] 00

```

At this point, I should get back `+KTCP_DATA,1,<ndata>` and then issue +KTCPRCV=1,. In this example, the radio never sent this notification, so I do not know how many bytes to read from the server.

**Sequence 2**  
**Same packet transmission sequence as above with same data length, but successful:**

_… (same as above until this point) …_

```
AT+KTCPSND=1,13314

CONNECT
 

Connected. Sending data...
 
[DATA]--EOF--Pattern--
OK
 EXP>>OK
 [2,0] 00
 
+KTCP_DATA: 1,467
 EXP>>+KTCP_DATA: 1,467
 [10,0] 00

RX 467
AT+KTCPRCV=1,467

CONNECT
HTTP/1.1 200 OK
Cache-Control: private
Content-Type: application/json; charset=utf-8
Server: <??>
X-AspNet-Version: <??>
X-Powered-By: <??>
Access-Control-Allow-Headers: Content-Type, Origin, X-Requested-With, Accept, Key
Access-Control-Allow-Origin: *
Access-Control-Allow-Methods: GET, POST,PUT
Date: Thu, 06 Feb 2020 16:23:51 GMT
Content-Length: 80

{"status":"Success","description":"Received 13197 bytes from you","response":""}--EOF--Pattern--
OK
AT+KTCPCLOSE=1,1

OK

 EXP>>OK
 [2,0] 00

+KCNX_IND: 1,5,30
AT+KTCPDEL=1

OK
 EXP>>OK
 [2,0] 00

+KCNX_IND: 1,3

```

Let’s say I transmit this packet 100 times in a row, spaced out by 60 seconds. I will receive a `+KTCP_DATA` notification approximately 80% of the time. With the old firmware, I was receiving this notification approximately 10% of the time, in addition to `+KTCP_NOTIF: 1,8` . With the new firmware, I am no longer receiving `+KTCP_NOTIF: 1,8` notification, but I am not receiving a `+KTCP_DATA` notification after each transmission.

Every time I **do** receive a `+KTCP_DATA` notification, I am reading all `<ndata>` bytes up to and including `--EOF--Pattern--` sent by radio.

- Confirmed with a logic analyzer that all bytes in `AT+KTCPSND=1,ndata` are being sent to radio.
- Confirmed bytes are being transmitted only when CTS is low.
- Confirmed power supply voltages are solid during TX period.
- Confirmed data without `+KTCP_DATA` response is received on server.

**A few other notes:**

- 200 msec of delay between commands
- Baud rate is 115200 +/- 1%
- VBATT + VBATT\_PA are 3.3V
- Peak current during **transmit 1** = 650mA & **transmit 2** = 643mA
- Software version is BHL7800-M.3.7.2.3.20191030
- RSRQ=11 (-14dB), RSRP=34 (-106dBm)
- Using LTE Band 12 (700 MHz)

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 6, 2020, 5:39pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/9 "2020-02-06T17:39:25Z")

</div>

Hi Cherokee,

> notification of the following received packet is sent only when the current +KTCP\_DATA has been read with a +KTCPRCV command.

My understanding is that after transmission, received data unsolicited indication should appear after dropping back to command mode. Once this message is received, you then issue AT+KTCPRSV=,. If is less than the first , then you will continue to receive +KTCP\_DATA notifications until all data is read.

However, this indication needs to be received after the transmission first, in order to know how many bytes to receive in the first place. I suppose one way to deal with this is to send a At+KTCPRCV=1,1000 and just try to receive bytes. However, if the +KTCP\_DATA notification does not show up after the packet transmission is completed, then no data is available anyway.

---

<div class="post-metadata">

**Author:** ![Sierra\_JordanZhao](https://sea1.discourse-cdn.com/flex025/user_avatar/forum.sierrawireless.com/sierra_jordanzhao/32/4974_2.png) [@Sierra\_JordanZhao](https://forum.sierrawireless.com/u/Sierra_JordanZhao)\
**Post date:** [February 7, 2020, 8:40am UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/10 "2020-02-07T08:40:13Z")

</div>

Hi @rlemburg, If the module didn’t receive the data, it won’t output the +KTCP\_DATA indication. To confirm whether the module received the data or not, please trigger below command in CLI port and capture the package received by the module.  
**How to get the IP traffic log from HL7800?**

> 1. Install wireshark application on Linux or Windows
> 2. Use CLI command “tcpdump [-i interface] [-t timeout] [-lte print direction [-p packet capture]]”  
> ​e.g. “tcpdump -lte 3 -p” ( at this point any packet between MAC and RTOS print out)
> 3. Network side send the data package to the module and you will see the output in CLI port.
> 4. Copy the output to text file
> 5. open Linux/Windodws os machine and run the command line "text2pcap -t %H:%M:%S \<wireshark.pcap\>.
> 6. open the .pcap file​ to check IP traffic.

As long as we confirm that the module indeed receives the data package without outputting +KTCP\_DATA indication, we can say it’s a firmware issue.

---

<div class="post-metadata">

**Author:** ![rlemburg](https://avatars.discourse-cdn.com/v4/letter/r/bcef8e/32.png) [@rlemburg](https://forum.sierrawireless.com/u/rlemburg)\
**Post date:** [February 26, 2020, 4:10pm UTC](https://forum.sierrawireless.com/t/ktcp-notif-1-8-with-correct-data-length-sent/19255/11 "2020-02-26T16:10:15Z")

</div>

Just wanted to update all that this has been fixed by upgrading to software version BHL7800-M.3.7.2.3.20191030. Thanks for your help.
