<?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>PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/32844/ptx-with-dyn-ack-sleep-problem</link><description>Hi, There&amp;#39;s a problem when using dynamic ack with return payload plus timer/sleep. Sending a single packet doesn&amp;#39;t work. sending two packets works. not sleeping/using timer works. I&amp;#39;ve attached details (and code) files. Thanks in advance for your help</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 01 Mar 2017 09:37:41 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/32844/ptx-with-dyn-ack-sleep-problem" /><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126261?ContentTypeID=1</link><pubDate>Wed, 01 Mar 2017 09:37:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2689ddfe-04d5-4f44-a4d9-ffdf73987f5e</guid><dc:creator>Jon Gunnar</dc:creator><description>.&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126260?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2017 15:25:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7bdfc972-c7a1-411c-b48c-a5a18d84fd22</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Håkon, Thank you! Best, Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126259?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2017 13:25:19 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:71d42f06-acbb-4661-a903-5445194b5b10</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q1: Do you mean that if the PTX asks for ACK+payload, the PRX radio will AUTOMATICALLY send an ACK + the payload ALREADY in its buffer? The PRX CPU has NO control over this, correct?&lt;/p&gt;
&lt;p&gt;Does this mean that calling&amp;nbsp;hal_nrf_write_ack_payload(pipe, payload_data, length) on the PRX ONLY &amp;quot;uploads&amp;quot; the packet to the radio and DOES NOT actually send the ACK packet out? So it&amp;#39;s best to have the PRX radio &amp;quot;primed&amp;quot; with the ACK packet as far as possible. Correct?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;That is correct. The function call uploads the ack-payload to the chosen rf-pipe in the radio FIFO.&lt;/p&gt;
&lt;p&gt;If you upload an ACK-payload to pipe 0 and pipe 1, they will only be transmitted (read: appended to the ACK going from PRX-&amp;gt;PTX) when you receive a payload on each of these pipes. This means that if you never receive a TX-payload on pipe1, the ack-payload will remain there.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q2: Thus, if no new ACK packet is uploaded to the PRX radio by its CPU, it will send the SAME ACK packet to the PTX over and over and over again. Correct?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;No, that is not correct. If you upload one ACK-payload, this will be sent back to the PTX on the next received &amp;quot;payload #1&amp;quot;. This will then be removed from the FIFO if the &amp;quot;PID&amp;quot; field in the &amp;quot;payload #2&amp;quot; has incremented, which indicates that this was not a re-transmitted payload.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Chapter 7.8 in the datasheet for protocol examples.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q3:&amp;nbsp;What do you mean by &amp;quot;this has to be updated to a specific RF pipe?&amp;quot; Shouldn&amp;#39;t the PRX use the same pipe on which the RX packet was received to transmit the ACK packet?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;See answer for Q1 for details on this. The command &amp;quot;W_ACK_PAYLOAD&amp;quot; command (which is the command used for ack payload) requires that you also set the RF pipe this should be addressed to.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Q4:&amp;nbsp;Assuming that my understanding is correct, at 250Kbps, what delay would you recommend between the &amp;quot;ack packet prepare&amp;quot; and the &amp;quot;fetch ack payload&amp;quot; packets sent by the PTX?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;You can send them back-to-back if you&amp;#39;d like. In gazell, we use a delay of a couple of ms between &amp;quot;ack prepare&amp;quot; and &amp;quot;fetch ack&amp;quot;, in case the PRX is busy doing other processing.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126258?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2017 08:13:48 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a56a2289-e63e-4599-a755-86083fa4137a</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Assuming that my understanding is correct, at 250Kbps, what delay would you recommend between the &amp;quot;ack packet prepare&amp;quot; and the &amp;quot;fetch ack payload&amp;quot; packets sent by the PTX? Thanks, Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126257?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2017 08:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e3b739ee-6732-496f-9a5e-76ccdc4ea96c</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi Håkon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Do you mean that if the PTX asks for ACK+payload, the PRX radio will AUTOMATICALLY send an ACK + the payload ALREADY in its buffer? The PRX CPU has NO control over this, correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Does this mean that calling&amp;nbsp;hal_nrf_write_ack_payload(pipe, payload_data, length) on the PRX ONLY &amp;quot;uploads&amp;quot; the packet to the radio and DOES NOT actually send the ACK packet out? So it&amp;#39;s best to have the PRX radio &amp;quot;primed&amp;quot; with the ACK packet as far as possible. Correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thus, if no new ACK packet is uploaded to the PRX radio by its CPU, it will send the SAME ACK packet to the PTX over and over and over again. Correct?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;This is a race condition that could happen:&lt;/p&gt;
&lt;p&gt;1. PTX sends a packet, asks for ACK+packet.&lt;/p&gt;
&lt;p&gt;2. PRX radio raises an IRQ.&lt;/p&gt;
&lt;p&gt;3. PRX CPU then (because of my code) starts assembling an ACK packet and then uploads it to the radio by calling&amp;nbsp;hal_nrf_write_ack_payload, which uploads it using SPI.&lt;/p&gt;
&lt;p&gt;4. In the meantime, PRX radio is AUTOMATICALLY getting ready to send out the ACK packet.&lt;/p&gt;
&lt;p&gt;5. PRX radio sends out an ACK packet. The PRX CPU **may** have updated the ACK packet buffer in the radio before it was sent out... or not. Race condition, we don&amp;#39;t know what will happen.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;THUS, a good solution is to have PTX send a packet, notifying PRX that an ACK packet will be required soon. PRX then hurries up, creates a packet and uploads it to its radio by calling&amp;nbsp;hal_nrf_write_ack_payload(). PTX now sends a second packet. PRX gets this packet too and since the ACK packet is already uploaded into the PRX radio&amp;#39;s buffer, it is AUTOMATICALLY sent out with no interference from the CPU.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;So, use the first packet to get the ACK packet ready. Then when the second packet comes, DO NOTHING, and the ACK packet will be sent out AUTOMATICALLY.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BTW, this is how I set PTX to ask for ACK + payload:&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;hal_nrf_setup_dynamic_payload(0xFF);// Enable dynamic payload on all pipes&lt;/p&gt;
&lt;p&gt;hal_nrf_enable_dynamic_payload(1); //Enable Dynamic payload&lt;/p&gt;
&lt;p&gt;hal_nrf_enable_ack_payload(1);&amp;nbsp;// Enable ACK with payload&lt;/p&gt;
&lt;p&gt;hal_nrf_enable_dynamic_ack(1); // need this to be able to get &amp;amp; read ack payload sent by prx.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;D. What do you mean by &amp;quot;this has to be updated to a specific RF pipe?&amp;quot; Shouldn&amp;#39;t the PRX use the same pipe on which the RX packet was received to transmit the ACK packet?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126256?ContentTypeID=1</link><pubDate>Mon, 20 Feb 2017 07:10:57 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3dbbe86b-d7c1-43af-98bd-8d30eb4cc073</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;In order for the PRX device to send an ACK-payload, this has to be updated to a specific RF pipe.&lt;/p&gt;
&lt;p&gt;If you are, on the PRX, uploading this to the radio at the time of receiving a packet, the hardware simultaneously controlling the radio and performing the RX-&amp;gt;TX turnover. At this point, you have a race-condition between the CPU and the radio-hardware, and you&amp;#39;re not guaranteed to successfully upload the ACK-payload before the radio has started transmitting the empty ACK.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;This is the reason why case 3 will work. You send one TX-payload, the PRX is then able to upload the ACK, then you send a new TX-payload to fetch the ACK-payload.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126255?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2017 16:40:39 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0b9748c0-e174-4aaa-a9f6-5111929f9f3f</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi&amp;nbsp;Håkon,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I don&amp;#39;t quite understand.&lt;/p&gt;
&lt;p&gt;Case 2 is Wake, send 0, sleep, where PTX gets an ack but not the ack payload.&lt;/p&gt;
&lt;p&gt;Case 3 is wake, send 1, send 2, sleep. where PTX gets BOTH the ack payloads ackp1 and ackp2 (which have different data in them).&lt;/p&gt;
&lt;p&gt;Both case 2 and 3 end with send, sleep (for 2 seconds). Why would case 3 get ackp3?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;In case 2, I&amp;#39;ve tried putting in a delay before sleep: wake, send 0, delay_ms(1000), sleep. Makes no difference.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thanks!&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126254?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2017 10:17:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d1389b40-3166-4e2e-b141-41c9511124c3</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Mahesh,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;It looks like your application relies on reading the data from the PTX, then bouncing the data back via ACK payload dynamically. In such a scenario you will have to send two payloads from the PTX to successfully receive the ACK-payload.&lt;/p&gt;
&lt;p&gt;Case 2 does not work because there&amp;#39;s not enough time for the PRX to upload the ACK payload. Therefore you must send another one to fetch the ACK-payload.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The recommended procedure is:&lt;/p&gt;
&lt;p&gt;* PTX sends &amp;quot;ack payload prepare&amp;quot; to PRX&lt;/p&gt;
&lt;p&gt;* PRX uploads ACK-payload&lt;/p&gt;
&lt;p&gt;* PTX sends &amp;quot;fetch ACK-payload&amp;quot; command to PRX&lt;/p&gt;
&lt;p&gt;* PRX sends ACK with payload back to PTX device.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Based on this, case 3 is the recommended procedure.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: PTX with dyn ack, sleep problem</title><link>https://devzone.nordicsemi.com/thread/126253?ContentTypeID=1</link><pubDate>Fri, 17 Feb 2017 07:20:22 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:03d4ed3e-6b9e-4967-adb3-2a15868957ab</guid><dc:creator>mr_creosote</dc:creator><description>&lt;p&gt;Hi, I really need to get it done this week (deadline); I&amp;#39;d greatly appreciate it if you could send me a response today! Thanks!! Mahesh&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>