<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://devzone.nordicsemi.com/cfs-file/__key/system/syndication/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/" xmlns:atom="http://www.w3.org/2005/Atom"><channel><title>Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73242/surprisingly-high-packet-loss-over-wired-network-using-the-nrf5340-dk-and-j1-swf-connector</link><description>Hi, 
 We&amp;#39;re doing some testing of mesh protocols and their latencies using the nRF5340 DK. We want to isolate the wireless communication from interference as much as possible, and have set up a wired coaxial network which we connect the DK to using the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 09 Apr 2021 10:05:03 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73242/surprisingly-high-packet-loss-over-wired-network-using-the-nrf5340-dk-and-j1-swf-connector" /><item><title>RE: Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/thread/303947?ContentTypeID=1</link><pubDate>Fri, 09 Apr 2021 10:05:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f61f61b4-29e9-42fe-970d-550594ed0ea7</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jal,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I have discussed with the mesh team internally and found that the statistics you found matched with our measurement in house.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;br /&gt;We are trying to optimize the softdevice controller on the nRF53 to improve mesh performance. We are expecting to have better performance in the next release of the NCS SDK v1.6&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Our suggestion is to continue development on v1.5 and update to v1.6 when we have it ready.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/thread/303783?ContentTypeID=1</link><pubDate>Thu, 08 Apr 2021 13:04:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5ed575cf-3384-4187-bcea-0c43d8e810b2</guid><dc:creator>jalgroy</dc:creator><description>&lt;p&gt;Some numbers from the test with 10 000 packets:&lt;/p&gt;
&lt;p&gt;- 97.1% of packets are below 5 ms&lt;/p&gt;
&lt;p&gt;- 2.9% of packets above 20ms&lt;/p&gt;
&lt;p&gt;- 0.1% of packets above 40ms&lt;/p&gt;
&lt;p&gt;- No packets above 60ms.&lt;/p&gt;
&lt;p&gt;The main.c was for the receiver, but the transmitter is the same except that NODE_ADDR and DEST_ADDR is switched around. So I&amp;#39;m sending to 0x0002, which is the unicast address of the receiver.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I ran a new test (1000 packets) with CONFIG_BT_MESH_RELAY=n and had similar results:&lt;/p&gt;
&lt;p&gt;- 96.7% below 5ms&lt;/p&gt;
&lt;p&gt;- 3.3% above 20ms&lt;/p&gt;
&lt;p&gt;- 0.1% above 40ms&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/thread/303767?ContentTypeID=1</link><pubDate>Thu, 08 Apr 2021 12:28:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:338f47f0-485b-4489-a5a2-60227ea45ecf</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jal,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I was looking for some statistic numbers for example the number of packets with latency longer than 20ms, 40ms and so on. Just so it&amp;#39;s easier to get the % of retransmission packet.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In the main.c file you sent, was it for the receiver ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Was the packet you send from the transmitter has the unicast address of the receive or it&amp;#39;s the address that the receive subscribed to (0x0001 ? )&lt;/p&gt;
&lt;p&gt;If it&amp;#39;s not the unicast address of the receive, the receiver would relay the message (you have&amp;nbsp;CONFIG_BT_MESH_RELAY = y). This will reduce the time the receive can listen. Could you try testing with&amp;nbsp;CONFIG_BT_MESH_RELAY = n ?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/thread/303744?ContentTypeID=1</link><pubDate>Thu, 08 Apr 2021 11:34:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:93f03eb3-ca6d-4f68-94f8-8c288e0c6e44</guid><dc:creator>jalgroy</dc:creator><description>&lt;p&gt;Hi and thanks for the reply.&lt;br /&gt;&lt;br /&gt;The receiver not being in receive mode has crossed my mind, but I don&amp;#39;t see why the receiver would be transmitting. I have the following bluetooth options in my prj.conf:&lt;br /&gt;&lt;br /&gt;&lt;pre class="ui-code" data-mode="text"&gt;CONFIG_BT=y
CONFIG_BT_DEBUG_LOG=n
CONFIG_BT_OBSERVER=y
CONFIG_BT_BROADCASTER=y
CONFIG_BT_CTLR_TX_PWR_MINUS_20=y

CONFIG_BT_MESH=y
CONFIG_BT_MESH_RELAY=y
CONFIG_BT_MESH_BEACON_ENABLED=n
CONFIG_BT_MESH_GATT_PROXY=n
CONFIG_BT_MESH_FRIEND=n
CONFIG_BT_MESH_LOW_POWER=n
CONFIG_BT_MESH_DEFAULT_TTL=4
CONFIG_BT_MESH_NETWORK_TRANSMIT_COUNT=2
CONFIG_BT_MESH_NETWORK_TRANSMIT_INTERVAL=20
CONFIG_BT_MESH_RELAY_RETRANSMIT_COUNT=3
CONFIG_BT_MESH_RELAY_RETRANSMIT_INTERVAL=20
CONFIG_BT_MESH_SUBNET_COUNT=1
CONFIG_BT_MESH_APP_KEY_COUNT=1
CONFIG_BT_MESH_PB_ADV=n
CONFIG_BT_MESH_CFG_CLI=y
CONFIG_BT_MESH_TX_SEG_MAX=16
CONFIG_BT_MESH_RX_SEG_MAX=16
CONFIG_BT_MESH_TX_SEG_MSG_COUNT=8
CONFIG_BT_MESH_ADV_BUF_COUNT=64
CONFIG_BT_MESH_LOOPBACK_BUFS=20
CONFIG_BT_MESH_MSG_CACHE_SIZE=32&lt;/pre&gt;&lt;br /&gt;&lt;br /&gt;As you can see, beacon and gatt proxy is disabled. I have not explicitly configured BLE advertising so I&amp;#39;m assuming that&amp;#39;s not happening either. The receiver has relay enabled, however all the packets are unicast and addressed to the receiver, so they should not be relayed. Are there any other reasons the receiver might be transmitting? I&amp;#39;ll add the main.c code below in case there is an obvious mistake. &lt;/p&gt;
&lt;blockquote&gt;&lt;em&gt;Please correct me if I&amp;#39;m wrong, from the graph the rate of packets that need to be retransmitted (&amp;gt;20ms) is a few percent ? Could you provide a chart or something with more detailed info other than the graph ? &lt;/em&gt;&lt;/blockquote&gt;
&lt;p&gt;Yes, about 3% of the packets need to be retransmitted. Not sure exactly what you&amp;#39;re looking for, I can provide the raw list of latencies measured if that is helpful.&lt;/p&gt;
&lt;p&gt;main.c:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;stdlib.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;

#include &amp;lt;sys/printk.h&amp;gt;
#include &amp;lt;random/rand32.h&amp;gt;

#include &amp;lt;settings/settings.h&amp;gt;

#include &amp;lt;bluetooth/bluetooth.h&amp;gt;
#include &amp;lt;bluetooth/mesh.h&amp;gt;

#include &amp;lt;shell/shell.h&amp;gt;

#include &amp;lt;logging/log.h&amp;gt;

#include &amp;quot;gpio.h&amp;quot;

#ifndef NODE_ADDR
#define NODE_ADDR 0x0002
#endif

#define MOD_LF 0x0000

#define DEST_ADDR 0x0001

#define LATENCY_OPCODE BT_MESH_MODEL_OP_3(0x00, BT_COMP_ID_LF)

LOG_MODULE_REGISTER(main, LOG_LEVEL_INF);

/* Define nrfx timer */
static uint32_t tx_time = 0;

static const uint8_t net_key[16] = {
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
};
static const uint8_t dev_key[16] = {
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
};
static const uint8_t app_key[16] = {
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
    0x01, 0x23, 0x45, 0x67, 0x89, 0xab, 0xcd, 0xef,
};
static const uint16_t net_idx;
static const uint16_t app_idx;
static const uint32_t iv_index;
static uint8_t flags;
static uint16_t addr = NODE_ADDR;

static struct bt_mesh_model root_models[] = {
    BT_MESH_MODEL_CFG_SRV,
};

static void vnd_latency_callback(struct bt_mesh_model *model,
                     struct bt_mesh_msg_ctx *ctx,
                     struct net_buf_simple *buf)
{
    /* Record time immediately */ 
    uint32_t recv_time = k_cycle_get_32();

    if (ctx-&amp;gt;addr == NODE_ADDR)
    {
        /* Our own message, ignore */
        return;
    }

    LOG_INF(&amp;quot;Received %d byte message.&amp;quot;, buf-&amp;gt;len);

    uint32_t diff = recv_time - tx_time;
    if (recv_time &amp;lt; tx_time)
    {
        /* Correct overflow */
        diff = (UINT32_MAX - tx_time) + recv_time;
    }
    /* Convert to microseconds */
    uint32_t latency = k_cyc_to_us_floor32(diff);
    printk(&amp;quot;latency: %d\n&amp;quot;, latency);

    LOG_INF(&amp;quot;src 0x%04x\n&amp;quot;, ctx-&amp;gt;addr);
}

static const struct bt_mesh_model_op vnd_ops[] = {
    { LATENCY_OPCODE, 0, vnd_latency_callback },
    BT_MESH_MODEL_OP_END,
};

static struct bt_mesh_model vnd_models[] = {
    BT_MESH_MODEL_VND(BT_COMP_ID_LF, MOD_LF, vnd_ops, NULL, NULL),
};

static struct bt_mesh_elem elements[] = {
    BT_MESH_ELEM(0, root_models, vnd_models),
};

static const struct bt_mesh_comp comp = {
    .cid = BT_COMP_ID_LF,
    .elem = elements,
    .elem_count = ARRAY_SIZE(elements),
};

static void configure(void)
{
    LOG_INF(&amp;quot;Configuring...\n&amp;quot;);

    /* Add Application Key */
    bt_mesh_cfg_app_key_add(net_idx, addr, net_idx, app_idx, app_key, NULL);

    /* Bind to vendor model */
    bt_mesh_cfg_mod_app_bind_vnd(net_idx, addr, addr, app_idx,
                     MOD_LF, BT_COMP_ID_LF, NULL);

    /* Add model subscription */
    bt_mesh_cfg_mod_sub_add_vnd(net_idx, addr, addr, DEST_ADDR,
                    MOD_LF, BT_COMP_ID_LF, NULL);

    LOG_INF(&amp;quot;Configuration complete\n&amp;quot;);

}

static const uint8_t dev_uuid[16] = { 0xdd, 0xdd };

static const struct bt_mesh_prov prov = {
    .uuid = dev_uuid,
};

static void bt_ready(int err)
{
    if (err) {
        LOG_INF(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
        return;
    }

    LOG_INF(&amp;quot;Bluetooth initialized\n&amp;quot;);

    err = bt_mesh_init(&amp;amp;prov, &amp;amp;comp);
    if (err) {
        LOG_INF(&amp;quot;Initializing mesh failed (err %d)\n&amp;quot;, err);
        return;
    }

    LOG_INF(&amp;quot;Mesh initialized\n&amp;quot;);

    if (IS_ENABLED(CONFIG_BT_SETTINGS)) {
        LOG_INF(&amp;quot;Loading stored settings\n&amp;quot;);
        settings_load();
    }

    err = bt_mesh_provision(net_key, net_idx, flags, iv_index, addr,
                dev_key);
    if (err == -EALREADY) {
        LOG_INF(&amp;quot;Using stored settings\n&amp;quot;);
    } else if (err) {
        LOG_INF(&amp;quot;Provisioning failed (err %d)\n&amp;quot;, err);
        return;
    } else {
        LOG_INF(&amp;quot;Provisioning completed\n&amp;quot;);
        configure();
    }
}

static int cmd_send(const struct shell *shell, size_t argc, char **argv)
{
    int length = 1;
    if (argc &amp;gt; 1)
    {
        length = atoi(argv[1]);
        if (length == 0)
        {
            length = 1;
        }
    }

    NET_BUF_SIMPLE_DEFINE(msg, 3 + length + 4);
    struct bt_mesh_msg_ctx ctx = {
        .net_idx = net_idx,
        .app_idx = app_idx,
        .addr = DEST_ADDR,
        .send_ttl = BT_MESH_TTL_DEFAULT,
    };
    
    bt_mesh_model_msg_init(&amp;amp;msg, LATENCY_OPCODE);
    net_buf_simple_add(&amp;amp;msg, length);

    LOG_INF(&amp;quot;Sending %d byte message with OpCode 0x%06x\n&amp;quot;, msg.len, LATENCY_OPCODE);
    
    GPIO_set_tx(true);
    if (bt_mesh_model_send(&amp;amp;vnd_models[0], &amp;amp;ctx, &amp;amp;msg, NULL, NULL)) {
        LOG_INF(&amp;quot;Unable to send latency test message\n&amp;quot;);
    }

    k_msleep(10);
    GPIO_set_tx(false);
    
    return 0;
}

void gpio_callback(void)
{
    tx_time = k_cycle_get_32();
}

SHELL_CMD_REGISTER(send, NULL, &amp;quot;Send test packet&amp;quot;, cmd_send);

void main(void)
{
    int err;

    LOG_INF(&amp;quot;Initializing...\n&amp;quot;);

    GPIO_init(gpio_callback);
    
    LOG_INF(&amp;quot;Unicast address: 0x%04x\n&amp;quot;, addr);
    
    /* Initialize the Bluetooth Subsystem */
    err = bt_enable(bt_ready);
    if (err) {
        LOG_ERR(&amp;quot;Bluetooth init failed (err %d)\n&amp;quot;, err);
    }
    k_msleep(2000);
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Surprisingly high packet loss over wired network using the nRF5340 DK and J1 SWF connector</title><link>https://devzone.nordicsemi.com/thread/302133?ContentTypeID=1</link><pubDate>Fri, 26 Mar 2021 12:46:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f22fbce1-fc06-4570-8235-c7b8b626e9ff</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi Jal,&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Could you give more information about the firmware you run on the transmitter and the receiver ?&amp;nbsp;&lt;br /&gt;Would the receive does any BLE advertising ? any proxy feature ? or transmitting/relaying any mesh data ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Please correct me if I&amp;#39;m wrong, from the graph the rate of packets that need to be retransmitted (&amp;gt;20ms) is a few percent ? Could you provide a chart or something with more detailed info other than the graph ?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I suspect that the packet drop rate was related to the period when the receive was not in receiving mode and that would explain why you see the same rate between open air and isolated testing as it&amp;#39;s not related to the actual radio communication.&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>