<?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>nRF52 Rx/Tx packet loss</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/44144/nrf52-rx-tx-packet-loss</link><description>Hi, I need to be able to count the number of packet Tx and Rx from one board to another in order to compute a packet loss ratio for certification purpose. To achieve this, I started by slightly modify the DTM example of the nRF52 14.2.0 SDK. I use Keil</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 17 Feb 2020 13:12:49 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/44144/nrf52-rx-tx-packet-loss" /><item><title>RE: nRF52 Rx/Tx packet loss</title><link>https://devzone.nordicsemi.com/thread/234655?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2020 13:12:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:da98f12b-0e5c-4ad4-a9e0-f805032b8f10</guid><dc:creator>Mehdi MIGAULT</dc:creator><description>&lt;p&gt;Hi usman,&lt;br /&gt;&lt;br /&gt;I&amp;#39;m good thanks, and I hope you too.&lt;br /&gt;I think I copied the code to send/read packets from another example (maybe the DTM) and added them to the radio_test example (in an ugly blocking way...). Be careful to reconfigure the radio according to the mode you want to use.&lt;br /&gt;You&amp;#39;ll find enclosed the extract from a patch that should let you know what to do. Be aware that this was done with SDK 14.2.0 and should be modified further for it to fully work with nRF52810 and nRF52840 (that have more/different features and use different preprocessor symbol for example...).&lt;br /&gt;&lt;br /&gt;Let me know if anything is unclear,&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Mehdi&lt;br /&gt;&lt;pre class="ui-code" data-mode="diff"&gt;/examples/peripheral/radio_test/main.c
@@ -58,6 +58,7 @@
 #include &amp;quot;app_uart.h&amp;quot;
 #include &amp;quot;app_error.h&amp;quot;
 #include &amp;quot;nordic_common.h&amp;quot;
+#include &amp;quot;radio_config.h&amp;quot;

 
+static void send_packet(uint32_t pckt)
+{
+    static uint32_t _packet = 0;
+
+    _packet = pckt;
+    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)&amp;amp;_packet;
+
+    // send the packet:
+    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
+    NRF_RADIO-&amp;gt;TASKS_TXEN   = 1;
+
+    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
+    {
+        // wait
+    }
+    NRF_RADIO-&amp;gt;EVENTS_END  = 0U;
+    NRF_RADIO-&amp;gt;TASKS_START = 1U;
+
+    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
+    {
+        // wait
+    }
+
+    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
+    // Disable radio
+    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;
+
+    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
+    {
+        // wait
+    }
+}
+
+static uint32_t read_packet(bool *abort)
+{
+    static uint32_t _packet = 0;
+
+    (*abort) = false;
+    uint32_t result = 0;
+
+    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)&amp;amp;_packet;
+
+    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
+    // Enable radio and wait for ready
+    NRF_RADIO-&amp;gt;TASKS_RXEN = 1U;
+
+    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
+    {
+        // wait
+    }
+    NRF_RADIO-&amp;gt;EVENTS_END = 0U;
+    // Start listening and wait for address received event
+    NRF_RADIO-&amp;gt;TASKS_START = 1U;
+
+    // Wait for end of packet or buttons state changed
+    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
+    {
+        // wait
+        uint8_t tmp;
+        if(app_uart_get(&amp;amp;tmp) == NRF_SUCCESS)
+        {
+            (*abort) = true;
+            break;
+        }
+    }
+
+    if (NRF_RADIO-&amp;gt;CRCSTATUS == 1U)
+    {
+        result = _packet;
+    }
+    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
+    // Disable radio
+    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;
+
+    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
+    {
+        // wait
+    }
+    return result;
+}
 
 /** @brief Function for main application entry.
  */
@@ -323,7 +406,11 @@ int main(void)
 
             case &amp;#39;h&amp;#39;:
                 help();
                 break;
 
+            case &amp;#39;n&amp;#39;:
+                radio_disable();
+                radio_configure();
+                NRF_RADIO-&amp;gt;TXPOWER   = (txpower_ &amp;lt;&amp;lt; RADIO_TXPOWER_TXPOWER_Pos);
+                NRF_RADIO-&amp;gt;FREQUENCY = channel_start_;
+                NRF_RADIO-&amp;gt;MODE      = (mode_ &amp;lt;&amp;lt; RADIO_MODE_MODE_Pos);
+                printf(&amp;quot;Packet count TX started\r\n&amp;quot;);
+                {
+                    uint16_t i;
+                    for(i = 0; i &amp;lt; 100; i++)
+                    {
+                        send_packet(i);
+                    }
+                    printf(&amp;quot;Sent %d packets\r\n&amp;quot;, i);
+                }
+                break;
+
+            case &amp;#39;j&amp;#39;:
+                radio_disable();
+                radio_configure();
+                NRF_RADIO-&amp;gt;TXPOWER   = (txpower_ &amp;lt;&amp;lt; RADIO_TXPOWER_TXPOWER_Pos);
+                NRF_RADIO-&amp;gt;FREQUENCY = channel_start_;
+                NRF_RADIO-&amp;gt;MODE      = (mode_ &amp;lt;&amp;lt; RADIO_MODE_MODE_Pos);
+                printf(&amp;quot;Packet count RX started\r\n&amp;quot;);
+                {
+                    uint32_t tmp = 0;
+                    bool abort = false;
+                    while(!abort)
+                    {
+                        read_packet(&amp;amp;abort);
+                        if(!abort)
+                        {
+                            tmp++;
+                        }
+                    }
+                    printf(&amp;quot;Received %d packets\r\n&amp;quot;, tmp);
+                }
+                break;
+
             default:
                 // No implementation needed
                 break;
@@ -145,7 +145,7 @@ static void generate_modulated_rf_packet(void)
 }
 
 
-static void radio_disable(void)
+void radio_disable(void)
 {
     NRF_RADIO-&amp;gt;SHORTS          = 0;
     NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0;
diff --git a/examples/peripheral/radio_test/radio_test.h b/examples/peripheral/radio_test/radio_test.h
index 9f3150d..e29b44f 100644
--- a/examples/peripheral/radio_test/radio_test.h
+++ b/examples/peripheral/radio_test/radio_test.h
@@ -47,6 +47,7 @@ extern &amp;quot;C&amp;quot; {
 #endif
 
 
+void radio_disable(void);
 void radio_tx_carrier(uint8_t txpower, uint8_t mode, uint8_t channel);
 void radio_modulated_tx_carrier(uint8_t txpower, uint8_t mode, uint8_t channel);
 void radio_rx_carrier(uint8_t mode, uint8_t channel);
&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 Rx/Tx packet loss</title><link>https://devzone.nordicsemi.com/thread/234623?ContentTypeID=1</link><pubDate>Mon, 17 Feb 2020 12:00:42 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f487dda4-ec9e-4815-b7d9-4039c56b797c</guid><dc:creator>usman</dc:creator><description>&lt;p&gt;Hi Mehdi&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I hope you are good. I have a question that in &amp;uml;&lt;span style="background-color:#ffffff;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:1.5em;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;peripheral/radio example&amp;uml; how you manage to get numbers of packet loss.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:1.5em;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;I want to know that what are the modifications you did in the codes.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:1.5em;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;thanks&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span style="background-color:#ffffff;color:#11171a;float:none;font-family:&amp;#39;GT Eesti&amp;#39;,&amp;#39;Helvetica&amp;#39;,Arial,sans-serif;font-size:14px;font-style:normal;font-weight:400;letter-spacing:normal;line-height:1.5em;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 Rx/Tx packet loss</title><link>https://devzone.nordicsemi.com/thread/173283?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 14:37:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e6ce75a0-29ae-4e8d-a71f-8e0d9646f218</guid><dc:creator>Mehdi MIGAULT</dc:creator><description>&lt;p&gt;Hi Kenneth,&lt;br /&gt;&lt;br /&gt;Thanks for your answer.&lt;br /&gt;I knew that this could be a reason for such loss, but I thought that there was no notable noise source in my test environment (some WIFI, some BT, but nothing to close&amp;nbsp;or intensive).&lt;br /&gt;I was probably wrong since the same tests today give wonderful results. There was probably some unsuspected active noise source&amp;nbsp;yesterday. I&amp;#39;ll investigate further if the problem occurs again.&lt;br /&gt;Thanks again for your help and sorry for the trouble.&lt;br /&gt;&lt;br /&gt;Best regards,&lt;br /&gt;Mehdi&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF52 Rx/Tx packet loss</title><link>https://devzone.nordicsemi.com/thread/173216?ContentTypeID=1</link><pubDate>Wed, 27 Feb 2019 11:54:07 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fd89105-5b34-45ef-8d87-07cc712131aa</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;It depends on the environment, if you have nearby WiFI, BT, og other 2.4GHz noise (e.g. USB3.0, microwave oven), then yes, you can experience packet loss due to interference.&lt;/p&gt;
&lt;p&gt;Best regards,&lt;br /&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>