<?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>nrf24l01+: ack payload length &amp;gt; 1 on PRX TX&amp;#39;ed =&amp;gt; Same data as first byte RX&amp;#39;ed on PTX.</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/16187/nrf24l01-ack-payload-length-1-on-prx-tx-ed-same-data-as-first-byte-rx-ed-on-ptx</link><description>I have two NRF24L01+ modules - I am not sure if they are fake? 
 One node acts as PTX and another as PRX. 
 On both devices i have the features auto_ack and ack_payload enabled. 
 I can send data between PTX and PRX with no problem. 
 If i use the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Sep 2016 14:55:01 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/16187/nrf24l01-ack-payload-length-1-on-prx-tx-ed-same-data-as-first-byte-rx-ed-on-ptx" /><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61789?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 14:55:01 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a9d03b1b-e1a1-44dd-bff0-85033e24519f</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@ApaX: could you try to look into the example I provided in the answer above(that should be used with the nRFGo SDK ) and follow what we have there ? Especially the hal_nrf_read_multibyte_reg() function. We actually do a read for hal_nrf_read_rx_payload_width() before we read the buffer.&lt;/p&gt;
&lt;p&gt;The nRF24LE1 and the nRF24L01P has the same radio&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61790?ContentTypeID=1</link><pubDate>Tue, 13 Sep 2016 12:46:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:20cc839b-0c14-4116-a629-e7c0060a0c69</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Yes, it is possible to send more than one byte. You can have  a look in the example I attached, there are 3 bytes sending as ACK payload.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61788?ContentTypeID=1</link><pubDate>Mon, 12 Sep 2016 20:41:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:685889bc-b5c2-4fec-9e58-05283ac1b43c</guid><dc:creator>ApaX</dc:creator><description>&lt;p&gt;Thank you for your answer.&lt;/p&gt;
&lt;p&gt;Yes i&amp;#39;ve changed it from 10 bytes to 2. Just for simplicity. My code is working just fine with one ACK-payload-length. But with more than one ack-payload-length, the first ack payload is copied to the entire length.&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uint8_t nrf24_Read_RxPayload(uint8_t *pBuff, uint8_t Len)
{
  if (Len &amp;gt; 32)
    Len = 32;
  return nrf24_read(nrf24_SPIx, NRF24_CMD_R_RX_PAYLOAD, pBuff, Len);
}



uint8_t nrf24_read(SPI_TypeDef* SPIx, uint8_t Cmd, uint8_t *pBuff, uint8_t Len)
{
  NRF24_CSN_LOW();


  uint8_t State = SPI_SendRecvByte(SPIx, Cmd);

  SPI_recv8b(SPIx, pBuff, Len);
  
  NRF24_CSN_HIGH();

  return State;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;General question: Is it possible to have more than one ACK-payload byte sent (as auto response) via. Enhanced ShockBurst?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61787?ContentTypeID=1</link><pubDate>Thu, 08 Sep 2016 13:08:23 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:89d9317e-9221-4a37-b44d-5fa0cc71d234</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;@ApaX: I would need to see how you do &lt;code&gt;nrf24_Read_RxPayload&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;I attached in my answer above an example. It&amp;#39;s for the nRF24LE1 but the radio and the register are the same with nRF24L01.  You can  compile the example using the &lt;a href="http://www.nordicsemi.com/eng/Products/2.4GHz-RF/nRFgo-SDK"&gt;nRFGo SDK here.&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;I can see that you are expecting 2 bytes from the ack payload ?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61786?ContentTypeID=1</link><pubDate>Wed, 07 Sep 2016 20:53:47 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d2055708-9de4-4e58-b452-58bff1a8b18e</guid><dc:creator>ApaX</dc:creator><description>&lt;p&gt;Hello Hung,&lt;/p&gt;
&lt;p&gt;I am not using an interrupt i poll the data.&lt;/p&gt;
&lt;p&gt;This is my code:&lt;/p&gt;
&lt;blockquote&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;stm32f10x.h&amp;quot;
#include &amp;quot;stm32f10x_rcc.h&amp;quot;
#include &amp;quot;stm32f10x_gpio.h&amp;quot;
#include &amp;quot;main.h&amp;quot;
#include &amp;lt;nrf24.h&amp;gt;
#include &amp;lt;gpio.h&amp;gt;
#include &amp;lt;font.h&amp;gt;
#include &amp;lt;delay.h&amp;gt;

#define LED_Port        GPIOC
#define LED_Pin         GPIO_Pin_13
#define LED_ON()        GPIO_WriteBit(LED_Port, LED_Pin, Bit_RESET)
#define LED_OFF()       GPIO_WriteBit(LED_Port, LED_Pin,Bit_SET)


#define nRF_CHANNEL     70
#define nRF_isTX_DEMO   1       
#define nRF_PaketLen    32      



uint8_t Addr[] = {0x01, 0x02, 0x03, 0x04, 0x05};

#ifdef nRF_isTX_DEMO
uint8_t Buff[] = {
  0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
  0x11, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
  0x21, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08,
  0x31, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08
};

uint8_t Recieved[32];
#else
uint8_t send[] = {
  0x01, 0x02, 
};
uint8_t Buff[32];
#endif

uint8_t Pipe        = 0;  
uint8_t Len         = 0;  
uint32_t Counter    = 0;  
uint32_t TryCounter = 0;  
uint32_t Err        = 0;  

void main()
{
  SystemInit();

  gpio_PortClockStart(LED_Port);
  gpio_SetGPIOmode_Out(LED_Port, LED_Pin);
  
  nrf24_init(SPI2, nRF_CHANNEL);
 
  nrf24_RxPipe_Setup(0, Addr, nRF_PaketLen);      



  nrf24_AckPayload_OnOff(1);
  nrf24_DynPayload_OnOff(1);

  
#if (nRF_isTX_DEMO)
  Len = nRF_PaketLen;
  while (1)
  {
    LED_ON();
    
    int8_t TryNum = nrf24_Send(Addr, Buff, Len);      

    if (TryNum &amp;gt;= 0)            
    {
      Counter++;                
      uint8_t nrf24_ReadState();

      nrf24_Read_RxPayload(&amp;amp;Recieved[0], 2);

    }    
    else
      Err++;                   
    
    delay_ms(50);
  }
#else

  while (1)
  {
     Len = nrf24_Recv(&amp;amp;Pipe, Buff);      
    if (Len)    
    {
      delay_ms(10);
      nrf24_write_ackpayload(send, 2);
  
      Counter++;
    }
  }
#endif
}


uint8_t nrf24_Recv(uint8_t *pPipe, uint8_t *pBuff)
{
  uint8_t status = nrf24_ReadState();
  uint8_t Len = 0;

  if (status &amp;amp; NRF24_bTX_DS_Mask)
    nrf24_ResetStateFlags(NRF24_bTX_DS_Mask);

  if (status &amp;amp; NRF24_bRX_DR_Mask)       
  {

    *pPipe = (status &amp;gt;&amp;gt; 1) &amp;amp; 0x07;
    
  
    if (RxPipes[*pPipe].bDynPayLoad)
      Len = nrf24_getDynLen();
    else
      Len = RxPipes[*pPipe].PayLoadLen;
    
    nrf24_Read_RxPayload(pBuff, Len);
    

    nrf24_ResetStateFlags(NRF24_bRX_DR_Mask);
  }
  
  return Len;
}


void nrf24_AckPayload_OnOff(uint8_t Enable)
{
#if (NRF24_MODEL == NRF24_MODEL_L01)
  nrf24_activate(nrf24_SPIx);
#endif
  
  
  tNrf24Reg1Dh RegValue;
  nrf24_read_regs(nrf24_SPIx, NRF24_REG_FEATURE, (uint8_t *) &amp;amp;RegValue, 1);
  RegValue.bEN_DPL = 1;
  RegValue.bEN_ACK_PAY = (Enable) ? 1 : 0;
  nrf24_write_regs(nrf24_SPIx, NRF24_REG_FEATURE, (uint8_t *) &amp;amp;RegValue, 1);

  // Enable dynamic payload on pipes 0 &amp;amp; 1
  nrf24_write_reg(nrf24_SPIx, NRF24_REG_DYNPD, (1 &amp;lt;&amp;lt; 0) | (1 &amp;lt;&amp;lt; 1));
}

void nrf24_DynPayload_OnOff(uint8_t Enable)
{
#if (NRF24_MODEL == NRF24_MODEL_L01)    
  nrf24_activate(nrf24_SPIx);
#endif

  tNrf24Reg1Dh RegValue;
  nrf24_read_regs(nrf24_SPIx, NRF24_REG_FEATURE, (uint8_t *)  &amp;amp;RegValue, 1);
  RegValue.bEN_DPL = (Enable) ? 1 : 0;
  nrf24_write_regs(nrf24_SPIx, NRF24_REG_FEATURE, (uint8_t *)  &amp;amp;RegValue, 1);
}

uint8_t nrf24_write_ackpayload(uint8_t *pBuff, uint8_t Len)
{
  if (Len &amp;gt; 32)
    Len = 32;
  return nrf24_write(nrf24_SPIx, NRF24_CMD_W_ACK_PAYLOAD, pBuff, Len);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;/blockquote&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nrf24l01+: ack payload length &gt; 1 on PRX TX'ed =&gt; Same data as first byte RX'ed on PTX.</title><link>https://devzone.nordicsemi.com/thread/61785?ContentTypeID=1</link><pubDate>Mon, 05 Sep 2016 12:24:53 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:39842121-69d8-44e4-8bd0-893c35c1102d</guid><dc:creator>Hung Bui</dc:creator><description>&lt;p&gt;Hi ApaX,&lt;/p&gt;
&lt;p&gt;Have you made sure you enable dynamic payload length on both sides ?
You need to set EN_DPL besides EN_ACK_PAY. You also need to set the  DPL_Px matches with which pipe you used.&lt;/p&gt;
&lt;p&gt;Have you made sure you received 10 bytes when you have RX_DR interrupt (with R_RX_PL_WID ) ?&lt;/p&gt;
&lt;p&gt;EDIT:&lt;/p&gt;
&lt;p&gt;Example:&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/ptx-_2D00_-ACKPayload.rar"&gt;ptx - ACKPayload.rar&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/prx-_2D00_-ACKPayload.rar"&gt;prx - ACKPayload.rar&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>