Delays in Sending Data Over TCP on LTE Connection, Depending on Data Size with Thingy 91

Hello,

I am experiencing delays when sending data over a TCP connection on an LTE network. The issue seems to be related to the size of the data being sent – larger payloads result in noticeably higher delays before they are transmitted.

Fullscreen
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
/*
* Copyright (c) 2016 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*/
/* Controlling LEDs through UART. Press 1-3 on your keyboard to toggle LEDS 1-3
* on your development kit */
#include <dk_buttons_and_leds.h>
#include <modem/lte_lc.h>
#include <modem/nrf_modem_lib.h>
#include <ncs_version.h>
#include <stdio.h>
#include <zephyr/device.h>
#include <zephyr/devicetree.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/kernel.h>
#include <zephyr/logging/log.h>
#include <zephyr/net/socket.h>
XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

These are some logs during correct working.

I: 448855ms Sent: 0ms 143bytes
I: 448955ms Sent: 0ms 143bytes
I: 449055ms Sent: 0ms 143bytes
I: 449155ms Sent: 0ms 143bytes
I: 449255ms Sent: 0ms 143bytes
I: 449355ms Sent: 0ms 143bytes
I: 449455ms Sent: 0ms 143bytes
I: 449555ms Sent: 0ms 143bytes
I: 449655ms Sent: 1ms 143bytes
I: 449755ms Sent: 1ms 143bytes
I: 449855ms Sent: 1ms 143bytes
I: 449955ms Sent: 1ms 143bytes
I: 450055ms Sent: 1ms 143bytes
I: 450156ms Sent: 0ms 143bytes
I: 450257ms Sent: 0ms 143bytes
I: 450357ms Sent: 0ms 143bytes
I: 450457ms Sent: 0ms 143bytes
I: 450557ms Sent: 0ms 143bytes
I: 450657ms Sent: 0ms 143bytes
I: 450757ms Sent: 0ms 143bytes
I: 450857ms Sent: 1ms 143bytes

And here with a bigger buffer:

I: 4456ms Sent: 0ms 353bytes
I: 4556ms Sent: 0ms 353bytes
I: 4656ms Sent: 0ms 353bytes
I: 4756ms Sent: 0ms 353bytes
I: 4856ms Sent: 0ms 353bytes
I: 4956ms Sent: 0ms 353bytes
I: 5056ms Sent: 0ms 353bytes
I: 5156ms Sent: 0ms 353bytes
I: 5256ms Sent: 0ms 353bytes
I: 5356ms Sent: 0ms 353bytes
I: 5456ms Sent: 0ms 353bytes
I: 5556ms Sent: 0ms 353bytes
I: 5656ms Sent: 0ms 353bytes
I: 5756ms Sent: 0ms 353bytes
I: 5856ms Sent: 0ms 353bytes
I: 5956ms Sent: 0ms 353bytes
I: 6056ms Sent: 0ms 353bytes
I: 6156ms Sent: 0ms 353bytes
I: 6256ms Sent: 200ms 353bytes
I: 6459ms Sent: 0ms 353bytes
I: 6560ms Sent: 0ms 353bytes
I: 6660ms Sent: 0ms 353bytes
I: 6760ms Sent: 1604ms 353bytes
I: 8367ms Sent: 0ms 353bytes
I: 8468ms Sent: 0ms 353bytes
I: 8568ms Sent: 1ms 353bytes
I: RRC mode: Idle
I: RRC mode: Connected
I: 8669ms Sent: 4816ms 353bytes
I: 13487ms Sent: 1ms 353bytes
I: 13587ms Sent: 1ms 353bytes
I: 13687ms Sent: 1ms 353bytes
I: 13788ms Sent: 197ms 353bytes
I: 13988ms Sent: 0ms 353bytes
I: 14089ms Sent: 0ms 353bytes
I: 14189ms Sent: 717ms 353bytes

Has anyone else encountered similar issues with TCP data transmission delays over LTE, especially with varying data sizes? If so, could you share any insights or solutions on how to optimize data transmission for consistent and minimal delays?

Any advice or suggestions would be greatly appreciated!

Parents
  • Hi,

    Can you provide some details about your application?

    How long did you do the testing?

    In which country did you do testing? Which network operator do you use?

    Best regards,
    Dejan

  • Hi Dejan,

     I want to build a proxy usb to tcp, receiving samples of data every 100ms. I've just tested the communications. I am in Spain, using Movistar.

  • I use the NRF Connect vs code extension. This release: nRF Connect SDK Toolchain v2.9, which executes this command:

    *  Executing task: nRF Connect: Build: proxy-usb-udp/build

    Building proxy-usb-udp
    west build --build-dir /***/proxy-usb-udp/build /***/proxy-usb-udp

  • Hi,

    Is your issue reproducible on nrf9160-dk board?

    Best regards,
    Dejan

  • I don't have one.

  • Hi,

    Which network do you use? Have you tried to use another network?

    Is this issue reproducible on Thingy91?

    Best regards,
    Dejan

  • Yes I am using a Thingy91.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    *** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    I: Initializing modem library
    I: Disabling PSM and eDRX
    I: Connecting to LTE network
    I: RRC mode: Connected
    I: Network registration status: Connected - home network
    I: Connected to LTE network
    I: Resolving server name: x, port: x
    I: IPv4 Address found x
    I: Creating socket
    I: Connecting to server
    I: Successfully connected to server
    I: UART Proxy
    I: 3727ms Sent: 1ms 1053bytes
    I: 4027ms Sent: 0ms 1053bytes
    I: 4327ms Sent: 0ms 1053bytes
    I: 4627ms Sent: 1ms 1053bytes
    I: 4927ms Sent: 0ms 1053bytes
    I: 5227ms Sent: 0ms 1053bytes
    I: 5527ms Sent: 1ms 1053bytes
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Reply
  • Yes I am using a Thingy91.

    Fullscreen
    1
    2
    3
    4
    5
    6
    7
    8
    9
    10
    11
    12
    13
    14
    15
    16
    17
    18
    19
    20
    21
    *** Booting nRF Connect SDK v2.9.0-7787b2649840 ***
    *** Using Zephyr OS v3.7.99-1f8f3dc29142 ***
    I: Initializing modem library
    I: Disabling PSM and eDRX
    I: Connecting to LTE network
    I: RRC mode: Connected
    I: Network registration status: Connected - home network
    I: Connected to LTE network
    I: Resolving server name: x, port: x
    I: IPv4 Address found x
    I: Creating socket
    I: Connecting to server
    I: Successfully connected to server
    I: UART Proxy
    I: 3727ms Sent: 1ms 1053bytes
    I: 4027ms Sent: 0ms 1053bytes
    I: 4327ms Sent: 0ms 1053bytes
    I: 4627ms Sent: 1ms 1053bytes
    I: 4927ms Sent: 0ms 1053bytes
    I: 5227ms Sent: 0ms 1053bytes
    I: 5527ms Sent: 1ms 1053bytes
    XXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX

Children
  • I think it is depending on this configuration variable:

    CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE
    When is settled to 8192:
    I: 4480ms Sent: 1ms 3083bytes
    I: 5480ms Sent: 1ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 6480ms Sent: 6492ms 3083bytes
    I: 12975ms Sent: 981ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 13975ms Sent: 7475ms 3083bytes
    I: 21453ms Sent: 1335ms 3083bytes
    I: 22791ms Sent: 1884ms 3083bytes
    I: 24678ms Sent: 4589ms 3083bytes
    I: 29270ms Sent: 1387ms 3083bytes
    I: 30660ms Sent: 1493ms 3083bytes
    I: 32156ms Sent: 1387ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 33546ms Sent: 6309ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 39858ms Sent: 5036ms 3083bytes
    I: 44897ms Sent: 1476ms 3083bytes
    I: 46376ms Sent: 2060ms 3083bytes
    I: 48439ms Sent: 1534ms 3083bytes
    I: 49976ms Sent: 1630ms 3083bytes
    I: 51609ms Sent: 2265ms 3083bytes
    I: 53877ms Sent: 1411ms 3083bytes
    I: 55291ms Sent: 1655ms 3083bytes
    3083 * 2 good sents = 6166 -> 8192 - 6166 = 2026 < 3083
    And with 32768:
    I: 3365ms Sent: 2ms 3083bytes
    I: 4365ms Sent: 2ms 3083bytes
    I: 5365ms Sent: 1ms 3083bytes
    I: 6366ms Sent: 0ms 3083bytes
    I: 7366ms Sent: 0ms 3083bytes
    I: 8366ms Sent: 1ms 3083bytes
    I: RRC mode: Idle
    I: 9367ms Sent: 0ms 3083bytes
    I: RRC mode: Connected
    I: 10367ms Sent: 44ms 3083bytes
    I: 11367ms Sent: 1ms 3083bytes
    I: 12367ms Sent: 8ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 13367ms Sent: 5843ms 3083bytes
    I: 19213ms Sent: 1045ms 3083bytes
    I: RRC mode: Idle
    I: RRC mode: Connected
    I: 20261ms Sent: 6629ms 3083bytes
    3083 * 10 good sents = 30830 -> 32768 - 30830 = 1938 < 3083
    To be honest, I am new with nordic boards, so I cannot understand it well, surely. If you can help me, I will be thankful.
  • Hi,

    Thank you for additional information.

    CONFIG_NRF_MODEM_LIB_SHMEM_TX_SIZE is the amount of shared memory owned by the application and used for sending the data to the modem. The RX/TX must fit the data for the largest command or socket operation executed.

    This area holds all outgoing data from the application to the modem, e.g. buffers passed to `send()`, AT commands. The size must be a multiple of four to keep the memory partitions word-aligned.

    You can find more information about memory regions of the modem library in the documentation.

    Best regards,
    Dejan

  • Sorry but I can't fix it.

  • Hi, 

    In one of your previous replies, there was this command "west build --build-dir /***/proxy-usb-udp/build /***/proxy-usb-udp".
    Which specific sample did you build? Is your application based on any of the NCS samples?

    Best regards,
    Dejan 

  • It's not a specific sample, I shared my code, based on examples of TCP clients. I want to use TCP, but the project firstly is called udp, which is possibly confusing.