<?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>data send from nrf52832 to nrf24l01p</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/46701/data-send-from-nrf52832-to-nrf24l01p</link><description>Hello, 
 Can I send data from nrf52832 to nrf24l01p? If yes, please suggest me the simple code for it. I tried to send data but it failed. Here is my piece of code : 
 Transmitter side (nRF52832) Receiver side(nRF24l01p)</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Sat, 04 May 2019 11:07:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/46701/data-send-from-nrf52832-to-nrf24l01p" /><item><title>RE: data send from nrf52832 to nrf24l01p</title><link>https://devzone.nordicsemi.com/thread/185285?ContentTypeID=1</link><pubDate>Sat, 04 May 2019 11:07:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a8090009-9fb5-4fa6-8ec3-cec08b815b54</guid><dc:creator>awneil</dc:creator><description>[quote userid="62609" url="~/f/nordic-q-a/46701/data-send-from-nrf52832-to-nrf24l01p/185278"]Here is working code if anybody needs[/quote]
&lt;p&gt;Thanks for feeding back.&lt;/p&gt;
&lt;p&gt;It will also help people needing it if you Verify the Answer - then they can see that the problem was actually resolved:&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/320x240/__key/communityserver-discussions-components-files/4/5488._5F00_Verify_2D00_answer_2D00_nordic.png" /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: data send from nrf52832 to nrf24l01p</title><link>https://devzone.nordicsemi.com/thread/185278?ContentTypeID=1</link><pubDate>Sat, 04 May 2019 07:17:18 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9bb0904b-e6c1-4e46-9cdc-064e9d26ea6b</guid><dc:creator>Rajkumar</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;I got help and be able to send/receive data between above mentioned nRFs.&lt;/p&gt;
&lt;p&gt;Here is working code if anybody needs:&lt;/p&gt;
&lt;p&gt;nrf52832 as Receiver&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;/**
 * Copyright (c) 2014 - 2019, Nordic Semiconductor ASA
 *
 * All rights reserved.
 *
 * Redistribution and use in source and binary forms, with or without modification,
 * are permitted provided that the following conditions are met:
 *
 * 1. Redistributions of source code must retain the above copyright notice, this
 *    list of conditions and the following disclaimer.
 *
 * 2. Redistributions in binary form, except as embedded into a Nordic
 *    Semiconductor ASA integrated circuit in a product or a software update for
 *    such product, must reproduce the above copyright notice, this list of
 *    conditions and the following disclaimer in the documentation and/or other
 *    materials provided with the distribution.
 *
 * 3. Neither the name of Nordic Semiconductor ASA nor the names of its
 *    contributors may be used to endorse or promote products derived from this
 *    software without specific prior written permission.
 *
 * 4. This software, with or without modification, must only be used with a
 *    Nordic Semiconductor ASA integrated circuit.
 *
 * 5. Any software provided in binary form under this license must not be reverse
 *    engineered, decompiled, modified and/or disassembled.
 *
 * THIS SOFTWARE IS PROVIDED BY NORDIC SEMICONDUCTOR ASA &amp;quot;AS IS&amp;quot; AND ANY EXPRESS
 * OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
 * OF MERCHANTABILITY, NONINFRINGEMENT, AND FITNESS FOR A PARTICULAR PURPOSE ARE
 * DISCLAIMED. IN NO EVENT SHALL NORDIC SEMICONDUCTOR ASA OR CONTRIBUTORS BE
 * LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
 * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE
 * GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION)
 * HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
 * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT
 * OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
 *
 */
#include &amp;quot;nrf_esb.h&amp;quot;

#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;sdk_common.h&amp;quot;
#include &amp;quot;nrf.h&amp;quot;
#include &amp;quot;nrf_esb_error_codes.h&amp;quot;
#include &amp;quot;nrf_delay.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;nrf_error.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;

#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_log_default_backends.h&amp;quot;

#define LED_ON          0
#define LED_OFF         1

#define NRF_ESB_LEGACY

/*lint -save -esym(40, BUTTON_1) -esym(40, BUTTON_2) -esym(40, BUTTON_3) -esym(40, BUTTON_4) -esym(40, LED_1) -esym(40, LED_2) -esym(40, LED_3) -esym(40, LED_4) */

static nrf_esb_payload_t tx_payload;
static nrf_esb_payload_t rx_payload;
static uint8_t m_state[4];
uint8_t led_nr;

void nrf_esb_event_handler(nrf_esb_evt_t const * p_event)
{
    switch (p_event-&amp;gt;evt_id)
    {
        case NRF_ESB_EVENT_TX_SUCCESS:
            NRF_LOG_INFO(&amp;quot;SUCCESS&amp;quot;);
            break;
        case NRF_ESB_EVENT_TX_FAILED:
            NRF_LOG_INFO(&amp;quot;FAILED&amp;quot;);
            (void) nrf_esb_flush_tx();
            break;
        case NRF_ESB_EVENT_RX_RECEIVED:
            while (nrf_esb_read_rx_payload(&amp;amp;rx_payload) == NRF_SUCCESS) ;
            NRF_LOG_INFO(&amp;quot;Receiving packet: %x&amp;quot;, rx_payload.data[0]);
            NRF_LOG_INFO(&amp;quot;Receiving RSSI: %x&amp;quot;, rx_payload.rssi);

            switch (rx_payload.data[0] &amp;amp; 0xFUL)
            {
                case 0x1:
                    m_state[0] = !m_state[0];
                    nrf_gpio_pin_write(LED_1, m_state[0]);
                    break;

                case 0x2:
                    m_state[1] = !m_state[1];
                    nrf_gpio_pin_write(LED_2, m_state[1]);
                    break;

                case 0x4:
                    m_state[2] = !m_state[2];
                    nrf_gpio_pin_write(LED_3, m_state[2]);
                    break;

                case 0x8:
                    m_state[3] = !m_state[3];
                    nrf_gpio_pin_write(LED_4, m_state[3]);
                    break;
            }

            nrf_gpio_pin_write(LED_1, m_state[0]);
            nrf_gpio_pin_write(LED_2, m_state[1]);
            nrf_gpio_pin_write(LED_3, m_state[2]);
            nrf_gpio_pin_write(LED_4, m_state[3]);

            tx_payload.length = 32;
            tx_payload.data[0] = m_state[0] &amp;lt;&amp;lt; 0
                               | m_state[1] &amp;lt;&amp;lt; 1
                               | m_state[2] &amp;lt;&amp;lt; 2
                               | m_state[3] &amp;lt;&amp;lt; 3;
            (void) nrf_esb_write_payload(&amp;amp;tx_payload);

            NRF_LOG_DEBUG(&amp;quot;Queue transmitt packet: %02x&amp;quot;, tx_payload.data[0]);
            break;
    }
}


void clocks_start( void )
{
    // Start HFCLK and wait for it to start.
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART = 1;
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0);
}


uint32_t esb_init( void )
{
    uint32_t err_code;
    uint8_t base_addr_0[4] = {0xE7, 0xE7, 0xE7, 0xE7};
    uint8_t base_addr_1[4] = {0xC2, 0xC2, 0xC2, 0xC2};
    uint8_t addr_prefix[8] = {0xE7, 0xC2, 0xC3, 0xC4, 0xC5, 0xC6, 0xC7, 0xC8 };

#ifndef NRF_ESB_LEGACY
    nrf_esb_config_t nrf_esb_config         = NRF_ESB_DEFAULT_CONFIG;
#else // NRF_ESB_LEGACY
    nrf_esb_config_t nrf_esb_config         = NRF_ESB_LEGACY_CONFIG;
#endif // NRF_ESB_LEGACY
    nrf_esb_config.selective_auto_ack       = 0;
    nrf_esb_config.payload_length           = 32;
    nrf_esb_config.bitrate                  = NRF_ESB_BITRATE_2MBPS;
    nrf_esb_config.mode                     = NRF_ESB_MODE_PRX;
    nrf_esb_config.event_handler            = nrf_esb_event_handler;

    err_code = nrf_esb_init(&amp;amp;nrf_esb_config);
    VERIFY_SUCCESS(err_code);

    err_code = nrf_esb_set_rf_channel(0); 
    VERIFY_SUCCESS(err_code);

    err_code = nrf_esb_set_base_address_0(base_addr_0);
    VERIFY_SUCCESS(err_code);

    err_code = nrf_esb_set_base_address_1(base_addr_1);
    VERIFY_SUCCESS(err_code);

    err_code = nrf_esb_set_prefixes(addr_prefix, 8);
    VERIFY_SUCCESS(err_code);

    tx_payload.length = 32;

    return NRF_SUCCESS;
}

void gpio_init( void )
{
    m_state[0] = LED_OFF;
    m_state[1] = LED_OFF;
    m_state[2] = LED_OFF;
    m_state[3] = LED_OFF;

    //nrf_gpio_range_cfg_output(8, 31);
    bsp_board_init(BSP_INIT_LEDS);

    nrf_gpio_pin_write(LED_1, m_state[0]);
    nrf_gpio_pin_write(LED_2, m_state[1]);
    nrf_gpio_pin_write(LED_3, m_state[2]);
    nrf_gpio_pin_write(LED_4, m_state[3]);
}


uint32_t logging_init( void )
{
    uint32_t err_code;
    err_code = NRF_LOG_INIT(NULL);

    NRF_LOG_DEFAULT_BACKENDS_INIT();

    return err_code;
}


void power_manage( void )
{
    // WFE - SEV - WFE sequence to wait until a radio event require further actions.
    __WFE();
    __SEV();
    __WFE();
}


int main(void)
{
    uint32_t err_code;
    err_code = logging_init();
    APP_ERROR_CHECK(err_code);
    gpio_init();
    err_code = esb_init();
    APP_ERROR_CHECK(err_code);
    clocks_start();

    NRF_LOG_INFO(&amp;quot;Enhanced ShockBurst Receiver Example started.&amp;quot;);

    err_code = nrf_esb_start_rx();
    APP_ERROR_CHECK(err_code);

    tx_payload.data[0] = m_state[0] &amp;lt;&amp;lt; 0
                       | m_state[1] &amp;lt;&amp;lt; 1
                       | m_state[2] &amp;lt;&amp;lt; 2
                       | m_state[3] &amp;lt;&amp;lt; 3;
    err_code = nrf_esb_write_payload(&amp;amp;tx_payload);
    APP_ERROR_CHECK(err_code);

    while (true)
    {
        if (NRF_LOG_PROCESS() == false)
        {
            power_manage();
        }
    }
}
/*lint -restore */
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;nrf24l01 as Transmitter:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#include &amp;lt;SPI.h&amp;gt;
#include &amp;lt;nRF24L01.h&amp;gt;
#include &amp;lt;RF24.h&amp;gt;
#include &amp;quot;printf.h&amp;quot;

RF24 radio(10, 9);
int packetCounter = 0;
//uint8_t incoming_data = 0;
uint8_t incoming_data[32] = {0xDE, 0x00, 0xA0, 0x1D, 0xCE, 0xEE, 0xFF, 0xD6, 0xAF, 0x1F, 0xF0, 0x0E, 0x1A, 0x2C, 0x3F, 0x4F, 0xEF, 0xDE, 0x00, 0xA0, 0x1D, 0xCE, 0xEE, 0xFF, 0xD6, 0xAF, 0x1F, 0xF0, 0x0E, 0x1A, 0x2C, 0x3F};
//uint8_t incoming_data[] = {0x05, 0x01, 0x02};
uint8_t message[1];

//int64_t pipe_adress[2] = {0xB3B4B5B601, 0x00E7E7E7E7};
int64_t pipe_adress[2] = {0xE7E7E7E7E7,0xC2C2C2C2C2};

void setupRadio()
{
  radio.begin();
  radio.setRetries(15, 15);
  radio.setChannel(0);
  radio.setCRCLength(2);
  radio.setPayloadSize(32);
  radio.setDataRate(RF24_2MBPS);
  radio.setPALevel(RF24_PA_MAX);
  radio.setAutoAck(true);
//  radio.enableDynamicPayloads();
//  radio.openReadingPipe(0, pipe_adress[0]);
//  radio.openReadingPipe(1, pipe_adress[1]);

  radio.openWritingPipe(pipe_adress[0]);
//  radio.openWritingPipe(1, pipe_adress[1]);
  radio.stopListening();
//  radio.startListening();
  radio.printDetails();
}

void setup() {
  Serial.begin(19200);
  Serial.println(&amp;quot;SETUP&amp;quot;);
  Serial.println(sizeof(incoming_data));
  printf_begin();

  setupRadio();
}
 uint8_t i = 5;
void loop() {
 
//Serial.println(&amp;quot;SUCCESS    &amp;quot;);
    if(radio.write(incoming_data, sizeof(incoming_data))){
      Serial.println(&amp;quot;SUCCESS    &amp;quot;);
       Serial.println(&amp;quot;SUCCESS    &amp;quot;);
      }
  delay(500);
//  incoming_data[0] = i ++;
}&lt;/pre&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: data send from nrf52832 to nrf24l01p</title><link>https://devzone.nordicsemi.com/thread/185277?ContentTypeID=1</link><pubDate>Sat, 04 May 2019 07:12:10 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d897dd70-42ca-40c7-a0ac-e9b11538b20f</guid><dc:creator>Rajkumar</dc:creator><description>&lt;p&gt;Thank you for your help this really helpful for me.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: data send from nrf52832 to nrf24l01p</title><link>https://devzone.nordicsemi.com/thread/184242?ContentTypeID=1</link><pubDate>Mon, 29 Apr 2019 09:05:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:9272d11c-f631-430f-a418-f860c2790aae</guid><dc:creator>Simonr</dc:creator><description>&lt;p&gt;Hi Raj&lt;/p&gt;
&lt;p&gt;This should be possible. &lt;a href="https://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk5.v14.2.0%2Fesb_users_guide.html&amp;amp;cp=4_0_1_5_1_2&amp;amp;anchor=esb_backwards"&gt;This link&lt;/a&gt;&amp;nbsp;should be helpful for backwards ESB communication.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Simon&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>