<?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>Proprietary protocol selection</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/70989/proprietary-protocol-selection</link><description>I&amp;#39;m trying to decide on a protocol to use between two nRF52840s. 
 
 Both will connect to an App and each other at the same time 
 Latency is important because the communication between devices is to sync their position in a sequence of audio and LED</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 27 Jan 2021 14:52:55 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/70989/proprietary-protocol-selection" /><item><title>RE: Proprietary protocol selection</title><link>https://devzone.nordicsemi.com/thread/291557?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 14:52:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:054df440-8a4f-49fb-9670-51840d5e6e2f</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;You have a few methods of separating connections which you can use in your case.&lt;/p&gt;
&lt;p&gt;One is the rf channels, while another is the base addresses.&lt;/p&gt;
&lt;p&gt;To be honest, I haven&amp;#39;t played too much around with this, but perhaps the description of&amp;nbsp;nrf_esb_address_t&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;typedef struct
{
    uint8_t base_addr_p0[4];        /**&amp;lt; Base address for pipe 0 encoded in big endian. */
    uint8_t base_addr_p1[4];        /**&amp;lt; Base address for pipe 1-7 encoded in big endian. */
    uint8_t pipe_prefixes[8];       /**&amp;lt; Address prefix for pipe 0 to 7. */
    uint8_t num_pipes;              /**&amp;lt; Number of pipes available. */
    uint8_t addr_length;            /**&amp;lt; Length of the address including the prefix. */
    uint8_t rx_pipes_enabled;       /**&amp;lt; Bitfield for enabled pipes. */
    uint8_t rf_channel;             /**&amp;lt; Channel to use (must be between 0 and 100). */
} nrf_esb_address_t;&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So only messages that has a matching address and&amp;nbsp;rf channel&amp;nbsp;between the transmitter and receiver will be received. This is not encrypted, but perhaps there are plenty of variations, so you do not need to worry about picking up the wrong message.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What is a bit tricky here is that the softdevice (Bluetooth stack) will have control over the radio most of the time. What you need to do is to use something called timeslot API to request timeslots in between the BLE activity. Then you need to be listening on one device while the other is transmitting.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Listening and transmitting using the radio is quite equivalent power wise. It consumes roughly the same amount of current. So the clue here is to be able to time this correctly. Once you manage to pick up a message, you can e.g. know that the other device sends out a message every 5ms or so, so you can turn on the radio only when you expect a message. Of course, the transmitter may not be able to transmit every 5ms, because sometimes it may collide with BLE scheduled activity, so you need to consider how long you want to keep track of the 5ms intervals before you start to increase your scan windows again.&lt;/p&gt;
&lt;p&gt;This can easily become a bit complicated, but that is something you need to consider. Of course, you can listen on ESB at all times (when not using BLE), but that will draw a significant amount of power. You can see the &lt;a href="https://infocenter.nordicsemi.com/topic/ps_nrf52840/radio.html?cp=4_0_0_5_19_14_2#unique_324650490"&gt;radio current consumption for the nRF52840 here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proprietary protocol selection</title><link>https://devzone.nordicsemi.com/thread/291533?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 14:12:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:053b2139-d29e-436a-8058-55408fc03263</guid><dc:creator>nrbrook</dc:creator><description>&lt;p&gt;Thanks Edvin. I&amp;#39;m not sure of the exact latency, it would need to be determined experimentally. 7.5ms is probably fast enough, it just needs to be imperceptible to humans. Would it be more power efficient to just use Bluetooth if latency is &amp;quot;good enough&amp;quot;?&lt;/p&gt;
[quote userid="26071" url="~/f/nordic-q-a/70989/proprietary-protocol-selection/291516#291516"]Perhaps you can do this information flow via BLE[/quote]
&lt;p&gt;Yes unique addresses can be assigned during setup. I just wanted to check that otherwise they won&amp;#39;t interfere &amp;ndash; does each pair need a unique channel? How many channels are there?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Proprietary protocol selection</title><link>https://devzone.nordicsemi.com/thread/291516?ContentTypeID=1</link><pubDate>Wed, 27 Jan 2021 13:54:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0cadc4bc-c9b8-49c7-936b-d414388794c6</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]Latency is important because the communication between devices is to sync their position in a sequence of audio and LED outputs[/quote]
&lt;p&gt;&amp;nbsp;What sort of latency do you require? As you may know, BLE uses a connection interval of minimum 7.5ms, so it is not possible to guarantee lower than this. In addition, you have retransmissions if you loose a packet.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;If you require latency &amp;lt; 7.5ms, then I believe ESB is appropriate for your case. Your requirement:&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]They will be in the same room as other pairs of devices, so should be able to talk directly to each other without interfering with other devices in range[/quote]
&lt;p&gt;&amp;nbsp;Is doable, but the devices needs to be aware of what devices to listen to. Perhaps you can do this information flow via BLE. I suggest you test the example SDK\examples\proprietary_rf\esb_p&amp;lt;tx/rx&amp;gt; and look at how they set up what device to listen to using the base addresses.&lt;/p&gt;
&lt;p&gt;NB: It is not used in this example, so they are using channel 0, but you can set the channel using&amp;nbsp;nrf_esb_set_rf_channel().&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Since this is open, and you want two and two devices to communicate with one another, you need some way for them to only listen to each other. Perhaps you can use the BLE address, or you can make the devices decide on a base address over BLE.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>