<?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>Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/1950/advice-for-simple-communication-from-nrf51822-to-nrf24l01</link><description>Hi everyone !
I&amp;#39;m trying to send data from an nrf51822 to an nrf24l01 with arduino and I guess I&amp;#39;m doing something wrong... 
 For the moment I succeeded to have these talking together: 
 ...so I guess the hardware is not the problem :)
(if you&amp;#39;re</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 01 Dec 2015 01:45:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/1950/advice-for-simple-communication-from-nrf51822-to-nrf24l01" /><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8391?ContentTypeID=1</link><pubDate>Tue, 01 Dec 2015 01:45:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7f6c7935-e344-4a0b-a73a-dbc1afc5aafc</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;Finally got it! I tried those further changes to the rf24 library without luck. Did some more digging, and saw that in the latest library release for micro-esb on github they reversed the polarity of the NOACK flag. Changing back to the original fixed my problem. I guess I wasn&amp;#39;t getting an ACK because I wasn&amp;#39;t asking for one in my packet! :) I can now read ACK payloads as well. Thanks for all the help, Gavin!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8389?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 23:30:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a2b177d6-b7c9-4526-b79a-472878d3c0cc</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;The library I have for the RPi is clearly based on the Arduino one at maniacbug&amp;#39;s GitHub repository - though someone has made some tweaks to port it for the RPi. I was convinced I had downloaded it from there but must be mistaken - my bad.&lt;/p&gt;
&lt;p&gt;I have done a text comparison and found that apart from changes required to port to the RPi (minor language differences), there are a few more changes which you could try and replicate in your Arduino library. So aside from setting the EN_DYN_ACK registers as above:&lt;/p&gt;
&lt;ol&gt;
&lt;li&gt;comment out the flush_rx and flush_tx commands near the top of the startListening routine - just above the Go! comment (comments in mine say &amp;#39;as per gcopeland fork&amp;#39;)&lt;/li&gt;
&lt;li&gt;Add 150 microsecond delays in the powerDown and powerUp routines after the write_register commands&lt;/li&gt;
&lt;li&gt;comment out the powerDown and flush_tx commands from the end of the write routine&lt;/li&gt;
&lt;li&gt;comment out the 150 microsecond delay at the start of the startWrite routine&lt;/li&gt;
&lt;li&gt;adjust the 15 microsecond delay to 10 microseconds in the startWrite routine (beneath the Allons! comment)&lt;/li&gt;
&lt;/ol&gt;
&lt;p&gt;The ackd=true command in my NRF51 code is safe to remove - it&amp;#39;s one of my global vars that&amp;#39;s specific to my application (which I didn&amp;#39;t define in the code snippet)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8393?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 22:54:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ab0b5a7f-1016-4e62-a7a1-7d5990648ca8</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;Interesting.. I&amp;#39;m still not able to get the nrf51822 to enter into the success portion of uesb_event_handler. It keeps going right into the tx failed section instead. I copy/pasted the same library you&amp;#39;re using for micro esb without luck, but perhaps the difference lies in the RF24 library instead? which version are you using there? I&amp;#39;m on the one &lt;a href="https://github.com/maniacbug/RF24"&gt;here&lt;/a&gt;.&lt;/p&gt;
&lt;p&gt;Is there anything that may have been lost in your posted code due to the formatting? I did notice a few oddities, for example the &amp;#39;ackd = true&amp;#39; line in your 51 code causes a compiler error and had to be removed.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m also trying to dig through to see if there may be any differences between the RPi version and Arduino that I may have missed.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8392?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 21:46:50 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:60b42364-ff2f-490f-9d69-c4e73d0a4dbd</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;The only other thing I can think of is that I am working off of an older version of Nordic&amp;#39;s micro esb library on the NRF 51822- I wonder if something has changed that might be affecting behaviour? The one that I am using is &lt;a href="https://github.com/NordicSemiconductor/nrf51-micro-esb/blob/437fc790c698a3ec0d50389ca62c49311df24592/common/micro_esb.c"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8399?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 21:18:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:75bd89fa-cc9c-4424-8a8c-7a291757d2b9</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;Yes, am receiving acks to trigger the success portion of the uesb_event_handler. Occasional false-negatives when I am the edge of range, but generally it works.&lt;/p&gt;
&lt;p&gt;Almost  year ago, so my memory is a little hazy, but if I remember correctly it was the edit to the RF24.cpp file that sorted the problem.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8394?ContentTypeID=1</link><pubDate>Mon, 30 Nov 2015 17:00:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3be12aae-a664-4dc6-9da0-71c7da387ad0</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;Hi Gavin, Thanks so much! This is super helpful. I got this up and running pretty well on an arduino, and can post back to my github for others once I&amp;#39;m done cleaning it up a bit.&lt;/p&gt;
&lt;p&gt;One other question - when running this code are you properly receiving acks back to the 51822 that cause the success portion of the uesb_event_handler to run? I seem to only be entering the failed portion of that function.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8398?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2015 00:38:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f8646341-c1f1-40dc-8f50-56dd52b7eeda</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;Apologies for formatting issues (and abuse of commenting system for posting code)!&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8397?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2015 00:37:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bf3217fd-af42-4302-815e-3a040176bbf3</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;(3/3) Bare-bones of NRF51822 transmitting code:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;micro_esb.h&amp;quot;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;#include &amp;quot;uesb_error_codes.h&amp;quot;&lt;/p&gt;
&lt;p&gt;static uesb_payload_t tx_payload, rx_payload;&lt;/p&gt;
&lt;p&gt;void uesb_event_handler()
{
static uint32_t rf_interrupts;
static uint32_t tx_attempts;&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;uesb_get_clear_interrupts(&amp;amp;rf_interrupts);

if(rf_interrupts &amp;amp; UESB_INT_TX_SUCCESS_MSK)
{   
			ackd=true;
	}

if(rf_interrupts &amp;amp; UESB_INT_TX_FAILED_MSK)
{
    uesb_flush_tx();
}

if(rf_interrupts &amp;amp; UESB_INT_RX_DR_MSK)
{
    uesb_read_rx_payload(&amp;amp;rx_payload);
    NRF_GPIO-&amp;gt;OUTCLR = 0xFUL &amp;lt;&amp;lt; 8;
    NRF_GPIO-&amp;gt;OUTSET = (uint32_t)((rx_payload.data[2] &amp;amp; 0x0F) &amp;lt;&amp;lt; 8);
}

uesb_get_tx_attempts(&amp;amp;tx_attempts);
NRF_GPIO-&amp;gt;OUTCLR = 0xFUL &amp;lt;&amp;lt; 12;
NRF_GPIO-&amp;gt;OUTSET = (tx_attempts &amp;amp; 0x0F) &amp;lt;&amp;lt; 12;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;int main(void)
{&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Put power up high for testing purposes
uesb_set_tx_power(UESB_TX_POWER_4DBM);

// Set receive address
uint8_t rx_addr_p0[] = {0xD2, 0xF0, 0xF0, 0xF0, 0xF0};
uint8_t rx_addr_p1[] = {0xE1, 0xF0, 0xF0, 0xF0, 0xF0};
uint8_t rx_addr_p2   = 0x66;	

// Start the high-frequency clock - we&amp;#39;ll need it for the radio
NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
while(NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);	

// Configure the radio
uesb_config_t uesb_config       = UESB_DEFAULT_CONFIG;
uesb_config.rf_channel          = 5;
uesb_config.crc                 = UESB_CRC_16BIT;
uesb_config.retransmit_count    = 6;
uesb_config.retransmit_delay    = 500;
uesb_config.dynamic_ack_enabled = true;
uesb_config.protocol            = UESB_PROTOCOL_ESB_DPL;
uesb_config.bitrate             = UESB_BITRATE_1MBPS;
uesb_config.event_handler       = uesb_event_handler;

uesb_init(&amp;amp;uesb_config);
uesb_set_address(UESB_ADDRESS_PIPE0, rx_addr_p0);
uesb_set_address(UESB_ADDRESS_PIPE1, rx_addr_p1);
uesb_set_address(UESB_ADDRESS_PIPE2, &amp;amp;rx_addr_p2);

// Load the payload with some dummy information
tx_payload.length  = 13;
tx_payload.pipe    = 0;
tx_payload.data[0] = 0x01;
tx_payload.data[1] = 0x02;
tx_payload.data[2] = 0x03;
tx_payload.data[3] = 0x04;


while (true)
{

			// -------------- TRANSMIT ---------------------
		
			if(uesb_write_tx_payload(&amp;amp;tx_payload) == UESB_SUCCESS)
			{
					tx_payload.data[0]++;
			}
		
			nrf_delay_ms(100);
			
		
			
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8396?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2015 00:33:03 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2bef3f38-a48c-4b54-8768-216ebe8b1f86</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;(2/3) Bare bones of the RPi code that calls the RF24 routines:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;#include &amp;quot;../RF24.h&amp;quot;;
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;RF24 radio(&amp;quot;/dev/spidev0.0&amp;quot;,8000000 , 25);&lt;br /&gt;
const int role_pin = 7;
const uint64_t pipes[2] = { 0xF0F0F0F0E1LL, 0xF0F0F0F0D2LL };&lt;/p&gt;
&lt;p&gt;void rf24setup(void){&lt;/p&gt;
&lt;p&gt;radio.begin();
radio.setRetries( 15, 15);
radio.setChannel(0x05);
radio.setPALevel(RF24_PA_MAX);
radio.setPALevel(RF24_PA_MAX);
radio.setDataRate(RF24_1MBPS);
radio.setPayloadSize(0x0c);
radio.enableAckPayload();&lt;/p&gt;
&lt;p&gt;radio.openWritingPipe(pipes[0]);
radio.openReadingPipe(1,pipes[1]);
radio.startListening();
radio.printDetails();
}&lt;/p&gt;
&lt;p&gt;int main( int argc, char *argv[]){&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;// Declarations
uint8_t message[12];

    // Initialise radio (and print settings to screen)
    rf24setup();

// Finishing
while (1)
{
	radio.startListening(); // Start listening for incoming messages

	while ( ! radio.available() ) { // Wait for a message
		__msleep(10);
	}

	radio.read( &amp;amp;message,12); // Get the message

	// do something with message here	
            
	radio.stopListening(); // stop listening so we can send an acknowledgement
	radio.writeAckPayload(2,&amp;amp;message,13);
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;}&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8395?ContentTypeID=1</link><pubDate>Sun, 29 Nov 2015 00:31:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:76f9d7d6-f0b5-4b60-a41e-e946d1cb0c85</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;(1/3)&lt;/p&gt;
&lt;p&gt;Apologies for the delay - been busy. The code below (spread over 3 messages) is running on a Raspberry Pi Model B with an NRF24L01 board, and an NRF51822 without softdevice.&lt;/p&gt;
&lt;p&gt;At the RPi end, the enableAckPayload routine in maniacbug&amp;#39;s RF24.cpp needs to be modified so that both the writeregister commands set the EN_DYN_ACK register too. ie. change from:&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;write_register(FEATURE,read_register(FEATURE) | _BV(EN_ACK_PAY) | _BV(EN_DPL) );
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;to&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;write_register(FEATURE,read_register(FEATURE) | _BV(EN_ACK_PAY) | _BV(EN_DPL) | _BV(EN_DYN_ACK) );
&lt;/code&gt;&lt;/pre&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8390?ContentTypeID=1</link><pubDate>Tue, 24 Nov 2015 17:04:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:2daec00d-05d6-4a8b-952e-f22fde34a29b</guid><dc:creator>Matt</dc:creator><description>&lt;p&gt;Gavin, do you have any example code that you managed to get working with that maniacbug library for the RF24 and the nRF51 SDK? I&amp;#39;m trying to accomplish the same thing and having a bit of trouble.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8388?ContentTypeID=1</link><pubDate>Sun, 28 Dec 2014 12:07:36 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:59ff3166-6689-40db-b4f0-70ddced840bb</guid><dc:creator>Gavin</dc:creator><description>&lt;p&gt;This is quite an important post for people trying to get NRF51822s working with legacy NRF24 systems, and solved the problems that I was having with acking. I had to modify the &lt;a href="http://maniacbug.github.io/RF24/index.html"&gt;RF24 library&lt;/a&gt; I was using to set the EN_DYN_ACK register.&lt;/p&gt;
&lt;p&gt;Is there any reading I can do to better understand why this is necessary?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8387?ContentTypeID=1</link><pubDate>Mon, 24 Mar 2014 08:51:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8c46552-725c-42ac-ac6b-d24639776a38</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Glad to hear it worked.
I do not think anyone can replicate that great piece of hair. ;-)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8386?ContentTypeID=1</link><pubDate>Mon, 24 Mar 2014 06:15:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:c41786f0-f563-4954-a08a-0060eec981ce</guid><dc:creator>Cedric Honnet</dc:creator><description>&lt;p&gt;Thanks a lot for your answer Håkon, it works !
Cedric.&lt;/p&gt;
&lt;p&gt;PS: you mustache rocks, but my haircut is unique, lol ;p&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Advice for simple communication from nrf51822 to nrf24l01 ?</title><link>https://devzone.nordicsemi.com/thread/8385?ContentTypeID=1</link><pubDate>Fri, 21 Mar 2014 11:01:55 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:6fb588ff-efaf-4fab-8cf1-bf22e4efc0e5</guid><dc:creator>H&amp;#229;kon Alseth</dc:creator><description>&lt;p&gt;Hi Cedric,&lt;/p&gt;
&lt;p&gt;The nRF51 does not have the enhanced shockburst in hardware anymore, which means that when you send a payload from the nRF51 side, and the L01+ is configured to do auto-ACKing, you will run into issues.&lt;/p&gt;
&lt;p&gt;What I would suggest is that you use the ESB-library on the nRF51 side, and on the nRF24L-side you enable registers:&lt;/p&gt;
&lt;ul&gt;
&lt;li&gt;EN_DPL for your pipes.&lt;/li&gt;
&lt;li&gt;EN_DYN_ACK&lt;/li&gt;
&lt;li&gt;EN_ACK_PAY&lt;/li&gt;
&lt;/ul&gt;
&lt;p&gt;If you look at the ESB library documentation, there&amp;#39;s a section on how the nRF24LE1 should be configured (see the nRFgo SDKs hal_nrf.c file for reference to the calls, its basically the registers I posted):
&lt;a href="https://devzone.nordicsemi.com/documentation/nrf51/5.2.0/html/a00139.html"&gt;devzone.nordicsemi.com/.../a00139.html&lt;/a&gt;&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>