<?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>Issue w/ nRF24L01 Tx</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1802/issue-w-nrf24l01-tx</link><description>I am having an interesting issue trying to send packets. Only a very small number are being received (~1 per second even when transmitting one after another), and they are only partially correct (receiving 0x9DAFAAAA when transmitting 0xAAAAAAAA). 
</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 10 Mar 2014 10:28:58 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1802/issue-w-nrf24l01-tx" /><item><title>RE: Issue w/ nRF24L01 Tx</title><link>https://devzone.nordicsemi.com/thread/7847?ContentTypeID=1</link><pubDate>Mon, 10 Mar 2014 10:28:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4ea7abd5-1579-40c3-9c66-97b08c76084f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Bryan,&lt;/p&gt;
&lt;p&gt;From the files that you&amp;#39;ve attached, I cannot see something that stands out.
However, you are clearing the STATUS register with a constant. It is recommended that you read out the register and write back the read-content, to make sure you clear the correct bits.&lt;/p&gt;
&lt;p&gt;Given that you need to reset the nRF to be able to change your payload (on the STM?), this indicates that there&amp;#39;s something wrong in the handling when switching from RX-&amp;gt;TX. Try avoiding high delays (ms-range and higher), and setup a pin-interrupt on the IRQ pin from the nRF.&lt;/p&gt;
&lt;p&gt;Also, you can try to cut down the program, and verify that things work one step of the time.
Start with a simple transmitter (no RX) on the STM side, and when you&amp;#39;ve verified that this works, add more functionality.&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue w/ nRF24L01 Tx</title><link>https://devzone.nordicsemi.com/thread/7846?ContentTypeID=1</link><pubDate>Thu, 06 Mar 2014 20:08:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:fff858b5-6b76-43a4-bee3-b1fcbda57fd7</guid><dc:creator>Bryan</dc:creator><description>&lt;p&gt;Here is the code being used on the Arduino side:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;
#include &amp;lt;SPI.h&amp;gt;
#include &amp;lt;Mirf.h&amp;gt;
#include &amp;lt;nRF24L01.h&amp;gt;
#include &amp;lt;MirfHardwareSpiDriver.h&amp;gt;

void setup(){
  Serial.begin(9600);
  Mirf.spi = &amp;amp;MirfHardwareSpi;
  Mirf.init();
  Mirf.setRADDR((byte *)&amp;quot;clie1&amp;quot;);
  Mirf.payload = sizeof(unsigned long);  // 4 bytes
  Mirf.config();
  Serial.println(&amp;quot;Beginning ... &amp;quot;); 
}

unsigned long data;

void loop(){ 
  while(!Mirf.dataReady());
  
  Mirf.getData((byte *) &amp;amp;data);
   
  Serial.println(data, HEX); 
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;(the Mirf library being used has been attached as well)&lt;/p&gt;
&lt;p&gt;On the STM32 side I have the following:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;stm32f4_discovery.h&amp;quot;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;nRF24L01P.h&amp;quot;

#define ADR_WIDTH 5
#define RX_PLOAD_WIDTH 4
#define TX_PLOAD_WIDTH 4

unsigned char Tx_Buf[4] = {0xAA,0xAA,0xAA,0xAA};
unsigned char Tx_Buf2[4] = {0xBB,0xBB,0xBB,0xBB};

int state = 0;

int main (void) {
	nRF24L01_HW_Init();
	RX_Mode();
	Delay(10000);

	while (1) {
		
		if (i % 100000 == 0) {
		  state = !state;
		}
		
		if (state) {
	                nRF24L01_TxPacket(Tx_Buf);
		} else {
			nRF24L01_TxPacket(Tx_Buf2);
		}
		RX_Mode();
		Delay(1000);
		}
	}
}

void nRF24L01_TxPacket(unsigned char * tx_buf) {
        nRF24L01_CE_L();
	 	
	SPI_WR_Reg(WRITE_nRF_REG + NRFRegSTATUS, 0x30);
	nRF24L01_Delay_us(20);
	SPI_WR_Reg(WRITE_nRF_REG + CONFIG, 0x3A);
	nRF24L01_Delay_us(20);
	nRF24L01_SPI_NSS_L();  
	nRF24L01_SPI_Send_Byte(FLUSH_TX);
	nRF24L01_SPI_NSS_H();  
	nRF24L01_Delay_us(20);
	SPI_Write_Buf(WR_TX_PLOAD, tx_buf, TX_PLOAD_WIDTH);
	nRF24L01_Delay_us(20);
        
        nRF24L01_CE_H();
	nRF24L01_Delay_us(20);
        nRF24L01_CE_L();
}

void RX_Mode(void) {
        nRF24L01_CE_L();
	SPI_WR_Reg(WRITE_nRF_REG + CONFIG, 0x39);
	nRF24L01_Delay_us(20);
	
	SPI_WR_Reg(WRITE_nRF_REG + RF_CH,0x01);
	nRF24L01_Delay_us(20);
	SPI_WR_Reg(WRITE_nRF_REG + RX_PW_P0,4);
	nRF24L01_Delay_us(20);
	SPI_WR_Reg(WRITE_nRF_REG + RX_PW_P1,4);
	nRF24L01_Delay_us(20);
	SPI_WR_Reg(WRITE_nRF_REG + EN_RXADDR, 0x03);
	nRF24L01_Delay_us(20);
	SPI_Write_Buf(WRITE_nRF_REG + TX_ADDR, TX_ADDRESS, ADR_WIDTH);
	nRF24L01_Delay_us(20);
	SPI_Write_Buf(WRITE_nRF_REG + RX_ADDR_P0, TX_ADDRESS, ADR_WIDTH); 
	nRF24L01_Delay_us(20);
	SPI_Write_Buf(WRITE_nRF_REG + RX_ADDR_P1, RX_ADDRESS, ADR_WIDTH); 
	nRF24L01_Delay_us(20);
	
	SPI_WR_Reg(WRITE_nRF_REG + CONFIG, 0x33);
	nRF24L01_Delay_us(20);
        nRF24L01_CE_H();
	nRF24L01_Delay_us(2000);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;I appreciate the help (and apologize the code is a bit sloppy)&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;Bryan&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/Mirf.zip"&gt;Mirf.zip&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Issue w/ nRF24L01 Tx</title><link>https://devzone.nordicsemi.com/thread/7845?ContentTypeID=1</link><pubDate>Thu, 06 Mar 2014 11:32:16 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d5009d72-ff7e-48bb-8585-36648031906f</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Bryan,&lt;/p&gt;
&lt;p&gt;Can you post more detailed code on both sides?
It&amp;#39;s hard to tell what can be wrong here, as it may be a problem in the transmission or the reception.&lt;/p&gt;
&lt;p&gt;Best regards
Håkon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>