<?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>NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/37336/nrf51-dk-interrupts-using-spi</link><description>Hello, 
 I am working on a project with nRF51822, I want to connect two or more nRF51DK boards using SPI and send an interrupt from one board to another, Is there any code or any tutorial which will help me through this project. That would be really appreciated</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 31 Aug 2018 08:43:14 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/37336/nrf51-dk-interrupts-using-spi" /><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/146675?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 08:43:14 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1bdfc70c-4c63-4f87-8d3a-405c63872e34</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Can you try to define DEBUG in your preprocessor defines, and then set a breakpoint in app_error.c on line 76, and see if this is hit. If it is, what is the .line_num, .p_file_name and .err_code. When you have these, what is the function call that returned the err_code passed onto APP_ERROR_CHECK(err_code); that is on that place in the project?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/146618?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 07:10:58 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:50896158-a1a1-4365-9803-48654efda822</guid><dc:creator>BeaconBLE</dc:creator><description>&lt;p&gt;It compiles properly and I am able to flash the code in the board, but I don&amp;#39;t&amp;nbsp;see any output, like when I run just the radio transmitter and receiver, I am able to see the received packet in the serial port at the receiver end. When I run my code, I am not getting any output in the serial port and it looks like they are not transmitting or receiving at all.&lt;/p&gt;
&lt;p&gt;Thank You.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/146615?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 07:01:08 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:58050440-7120-4cca-b1e9-ad530d93bc43</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What seems to be the problem with the code? Are you not able to compile? Or does the project &amp;quot;crash&amp;quot;, entering an APP_ERROR_CHECK(err_code); during runtime? Or do you just lack the SPI events?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/146610?ContentTypeID=1</link><pubDate>Fri, 31 Aug 2018 05:52:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:0d6fdaca-54df-4f3a-8e4f-d01643a1951d</guid><dc:creator>BeaconBLE</dc:creator><description>&lt;p&gt;Hello Edvin,&lt;/p&gt;
&lt;p&gt;I am trying to combine the radio transmitter and receiver code in SDK v12.3 with the spi and spis&amp;nbsp;example.&lt;/p&gt;
&lt;p&gt;I want to transmit a packet from the transmitter over the radio and at the receiver send the RSSI value back to the transmitter using SPI. I have combined the two codes in the SDK i.e examples-&amp;gt;peripheral-&amp;gt;radio(transmitter and receiver) and examples-&amp;gt;peripheral-&amp;gt;(spi&amp;nbsp;and spis) but it doesn&amp;#39;t&amp;nbsp;seem to work, I have been trying to figure the problem in my code but couldn&amp;#39;t, if you can please check the code out and point me towards the right direction that would be great.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The transmitter and spis&amp;nbsp;combined code is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * Copyright (c) 2014 - 2017, 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.
 * 
 */

/** @file
*
* @defgroup nrf_dev_button_radio_tx_example_main main.c
* @{
* @ingroup nrf_dev_button_radio_tx_example
*
* @brief Radio Transceiver Example Application main file.
*
* This file contains the source code for a sample application using the NRF_RADIO peripheral.
*
*/
#include &amp;quot;sdk_config.h&amp;quot;
#include &amp;quot;nrf_drv_spis.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;radio_config.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_error.h&amp;quot;
#define NRF_LOG_MODULE_NAME &amp;quot;APP&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;


#define APP_TIMER_PRESCALER      0                           /**&amp;lt; Value of the RTC1 PRESCALER register. */
#define APP_TIMER_OP_QUEUE_SIZE  2                           /**&amp;lt; Size of timer operation queues. */

static uint32_t                   packet;                    /**&amp;lt; Packet to transmit. */


#define SPIS_INSTANCE 1 /**&amp;lt; SPIS instance index. */
static const nrf_drv_spis_t spis = NRF_DRV_SPIS_INSTANCE(SPIS_INSTANCE);/**&amp;lt; SPIS instance. */

#define TEST_STRING &amp;quot;Nordic&amp;quot;
static uint8_t       m_tx_buf[] = TEST_STRING;           /**&amp;lt; TX buffer. */
static uint8_t       m_rx_buf[sizeof(TEST_STRING) + 1];    /**&amp;lt; RX buffer. */
static const uint8_t m_length = sizeof(m_tx_buf);        /**&amp;lt; Transfer length. */

static volatile bool spis_xfer_done; /**&amp;lt; Flag used to indicate that SPIS instance completed the transfer. */


/**
 * @brief SPIS user event handler.
 *
 * @param event
 */
void spis_event_handler(nrf_drv_spis_event_t event)
{
    if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
    {
        spis_xfer_done = true;
        NRF_LOG_INFO(&amp;quot; Transfer completed. Received: %s\r\n&amp;quot;,(uint32_t)m_rx_buf);
    }
}


/**@brief Function for sending packet.
 */
void send_packet()
{
    // send the packet:
    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
    NRF_RADIO-&amp;gt;TASKS_TXEN   = 1;

    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
    {
        // wait
    }
    NRF_RADIO-&amp;gt;EVENTS_END  = 0U;
    NRF_RADIO-&amp;gt;TASKS_START = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
    {
        // wait
    }

    uint32_t err_code = bsp_indication_set(BSP_INDICATE_SENT_OK);
    NRF_LOG_INFO(&amp;quot;The packet was sent\r\n&amp;quot;);
    APP_ERROR_CHECK(err_code);

    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
    // Disable radio
    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
    {
        // wait
    }
}


/**@brief Function for handling bsp events.
 */
void bsp_evt_handler(bsp_event_t evt)
{
    uint32_t prep_packet = 0;
    switch (evt)
    {
        case BSP_EVENT_KEY_0:
            /* Fall through. */
        case BSP_EVENT_KEY_1:
            /* Fall through. */
        case BSP_EVENT_KEY_2:
            /* Fall through. */
        case BSP_EVENT_KEY_3:
            /* Fall through. */
        case BSP_EVENT_KEY_4:
            /* Fall through. */
        case BSP_EVENT_KEY_5:
            /* Fall through. */
        case BSP_EVENT_KEY_6:
            /* Fall through. */
        case BSP_EVENT_KEY_7:
            /* Get actual button state. */
            for (int i = 0; i &amp;lt; BUTTONS_NUMBER; i++)
            {
                prep_packet |= (bsp_board_button_state_get(i) ? (1 &amp;lt;&amp;lt; i) : 0);
            }
            break;
        default:
            /* No implementation needed. */
            break;
    }
    packet = prep_packet;
}


/**@brief Function for initialization oscillators.
 */
void clock_initialization()
{
    /* Start 16 MHz crystal oscillator */
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    /* Wait for the external oscillator to start up */
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0)
    {
        // Do nothing.
    }

    /* Start low frequency crystal oscillator for app_timer(used by bsp)*/
    NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
}


/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;

    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);

    err_code = bsp_init(BSP_INIT_LED | BSP_INIT_BUTTONS,
                        APP_TIMER_TICKS(100, APP_TIMER_PRESCALER),
                        bsp_evt_handler);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();

    // Set payload pointer
    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)&amp;amp;packet;

    err_code = bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
    NRF_LOG_INFO(&amp;quot;Press Any Button\r\n&amp;quot;);
    APP_ERROR_CHECK(err_code);
		
		// Enable the constant latency sub power mode to minimize the time it takes
    // for the SPIS peripheral to become active after the CSN line is asserted
    // (when the CPU is in sleep mode).
    NRF_POWER-&amp;gt;TASKS_CONSTLAT = 1;

    //bsp_board_leds_init();

    //APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_INFO(&amp;quot;SPIS example\r\n&amp;quot;);

    nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG;
    spis_config.csn_pin               = APP_SPIS_CS_PIN;
    spis_config.miso_pin              = APP_SPIS_MISO_PIN;
    spis_config.mosi_pin              = APP_SPIS_MOSI_PIN;
    spis_config.sck_pin               = APP_SPIS_SCK_PIN;

    err_code = nrf_drv_spis_init(&amp;amp;spis, &amp;amp;spis_config, spis_event_handler);
		APP_ERROR_CHECK(err_code);
    while (true)
    {
        if (packet != 0)
        {
            send_packet();
            NRF_LOG_INFO(&amp;quot;The contents of the package was %u\r\n&amp;quot;, (unsigned int)packet);
            packet = 0;
        }
        //NRF_LOG_FLUSH();
        __WFE();
				
				memset(m_rx_buf, 0, m_length);
        spis_xfer_done = false;

        APP_ERROR_CHECK(nrf_drv_spis_buffers_set(&amp;amp;spis, m_tx_buf, m_length, m_rx_buf, m_length));

        while (!spis_xfer_done)
        {
            __WFE();
        }

        NRF_LOG_FLUSH();

        bsp_board_led_invert(BSP_BOARD_LED_0);
    }
}


/**
 *@}
 **/
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;The receiver and SPI combined code is:&lt;/p&gt;
&lt;p&gt;&lt;pre class="ui-code" data-mode="text"&gt;/**
 * Copyright (c) 2014 - 2017, 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.
 * 
 */

/** @file
*
* @defgroup nrf_dev_radio_rx_example_main main.c
* @{
* @ingroup nrf_dev_radio_rx_example
* @brief Radio Receiver example Application main file.
*
* This file contains the source code for a sample application using the NRF_RADIO peripheral.
*
*/
#include &amp;lt;stdint.h&amp;gt;
#include &amp;lt;stdbool.h&amp;gt;
#include &amp;lt;stdio.h&amp;gt;
#include &amp;quot;radio_config.h&amp;quot;
#include &amp;quot;nrf_gpio.h&amp;quot;
#include &amp;quot;boards.h&amp;quot;
#include &amp;quot;bsp.h&amp;quot;
#include &amp;quot;app_timer.h&amp;quot;
#include &amp;quot;nordic_common.h&amp;quot;
#include &amp;quot;nrf_error.h&amp;quot;
#include &amp;quot;app_error.h&amp;quot;
 #define NRF_LOG_MODULE_NAME &amp;quot;APP&amp;quot;
#include &amp;quot;nrf_log.h&amp;quot;
#include &amp;quot;nrf_log_ctrl.h&amp;quot;
#include &amp;quot;nrf_drv_spi.h&amp;quot;
#include &amp;quot;app_util_platform.h&amp;quot;
#include &amp;lt;string.h&amp;gt;
#include &amp;quot;nrf_delay.h&amp;quot;

#define APP_TIMER_PRESCALER      0                     /**&amp;lt; Value of the RTC1 PRESCALER register. */
#define APP_TIMER_OP_QUEUE_SIZE  2                     /**&amp;lt; Size of timer operation queues. */
#define SPI_INSTANCE  0 /**&amp;lt; SPI instance index. */
static const nrf_drv_spi_t spi = NRF_DRV_SPI_INSTANCE(SPI_INSTANCE);  /**&amp;lt; SPI instance. */
static volatile bool spi_xfer_done;  /**&amp;lt; Flag used to indicate that SPI instance completed the transfer. */
uint32_t rssi;
#define TEST_STRING &amp;quot;Nordic&amp;quot;
uint8_t       m_tx_buf[1] ;           /**&amp;lt; TX buffer. */
uint8_t       m_rx_buf[sizeof(m_tx_buf) + 1];    /**&amp;lt; RX buffer. */
uint8_t m_length = sizeof(m_tx_buf);        /**&amp;lt; Transfer length. */
uint32_t                   packet;              /**&amp;lt; Packet to transmit. */


/**@brief Function for initialization oscillators.
 */
void clock_initialization()
{
    /* Start 16 MHz crystal oscillator */
    NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_HFCLKSTART    = 1;

    /* Wait for the external oscillator to start up */
    while (NRF_CLOCK-&amp;gt;EVENTS_HFCLKSTARTED == 0)
    {
        // Do nothing.
    }

    /* Start low frequency crystal oscillator for app_timer(used by bsp)*/
    NRF_CLOCK-&amp;gt;LFCLKSRC            = (CLOCK_LFCLKSRC_SRC_Xtal &amp;lt;&amp;lt; CLOCK_LFCLKSRC_SRC_Pos);
    NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED = 0;
    NRF_CLOCK-&amp;gt;TASKS_LFCLKSTART    = 1;

    while (NRF_CLOCK-&amp;gt;EVENTS_LFCLKSTARTED == 0)
    {
        // Do nothing.
    }
}


/**@brief Function for reading packet.
 */
uint32_t read_packet()
{
	
		NRF_RADIO-&amp;gt;SHORTS |= RADIO_SHORTS_ADDRESS_RSSISTART_Msk;
	
		NRF_RADIO-&amp;gt;INTENSET = RADIO_INTENSET_READY_Msk | RADIO_INTENSET_END_Msk | RADIO_INTENSET_DISABLED_Msk;
	
    uint32_t result = 0;

    NRF_RADIO-&amp;gt;EVENTS_READY = 0U;
    // Enable radio and wait for ready
    NRF_RADIO-&amp;gt;TASKS_RXEN = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_READY == 0U)
    {
        // wait
    }
    NRF_RADIO-&amp;gt;EVENTS_END = 0U;
    // Start listening and wait for address received event
    NRF_RADIO-&amp;gt;TASKS_START = 1U;

    // Wait for end of packet or buttons state changed
    while (NRF_RADIO-&amp;gt;EVENTS_END == 0U)
    {
        // wait
    }

    if (NRF_RADIO-&amp;gt;CRCSTATUS == 1U)
    {
        result = packet;
				rssi = NRF_RADIO-&amp;gt;RSSISAMPLE;
				
    }
    NRF_RADIO-&amp;gt;EVENTS_DISABLED = 0U;
    // Disable radio
    NRF_RADIO-&amp;gt;TASKS_DISABLE = 1U;

    while (NRF_RADIO-&amp;gt;EVENTS_DISABLED == 0U)
    {
        // wait
    }
    return result;
}

void spi_event_handler(nrf_drv_spi_evt_t const * p_event)
{
    spi_xfer_done = true;
    NRF_LOG_INFO(&amp;quot;Transfer completed.\r\n&amp;quot;);
    if (m_rx_buf[0] != 0)
    {
        NRF_LOG_INFO(&amp;quot; Received: \r\n&amp;quot;);
        NRF_LOG_HEXDUMP_INFO(m_rx_buf, strlen((const char *)m_rx_buf));
    }
}


/**
 * @brief Function for application main entry.
 * @return 0. int return type required by ANSI/ISO standard.
 */
int main(void)
{
    uint32_t err_code = NRF_SUCCESS;
	
		nrf_gpio_range_cfg_output(21, 24);

    clock_initialization();
    APP_TIMER_INIT(APP_TIMER_PRESCALER, APP_TIMER_OP_QUEUE_SIZE, NULL);

    err_code = NRF_LOG_INIT(NULL);
    APP_ERROR_CHECK(err_code);
    err_code = bsp_init(BSP_INIT_LED, APP_TIMER_TICKS(100, APP_TIMER_PRESCALER), NULL);
    APP_ERROR_CHECK(err_code);

    // Set radio configuration parameters
    radio_configure();
    NRF_RADIO-&amp;gt;PACKETPTR = (uint32_t)&amp;amp;packet;

    err_code = bsp_indication_set(BSP_INDICATE_USER_STATE_OFF);
    NRF_LOG_INFO(&amp;quot;Wait for first packet\r\n&amp;quot;);
    APP_ERROR_CHECK(err_code);
    NRF_LOG_FLUSH(); 

		//bsp_board_leds_init();

    //APP_ERROR_CHECK(NRF_LOG_INIT(NULL));

    NRF_LOG_INFO(&amp;quot;SPI example\r\n&amp;quot;);

    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.ss_pin   = SPI_SS_PIN;
    spi_config.miso_pin = SPI_MISO_PIN;
    spi_config.mosi_pin = SPI_MOSI_PIN;
    spi_config.sck_pin  = SPI_SCK_PIN;
    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler));

    while (true)
    {
        uint32_t received = read_packet();

        err_code = bsp_indication_set(BSP_INDICATE_RCV_OK);
        NRF_LOG_INFO(&amp;quot;Packet was received\r\n&amp;quot;);
        APP_ERROR_CHECK(err_code);

        NRF_LOG_INFO(&amp;quot;The contents of the package is %u\r\n&amp;quot;, (unsigned int)received);
				NRF_LOG_INFO(&amp;quot;The RSSI of the package is %u\r\n&amp;quot;, (unsigned int)rssi);
			
				m_tx_buf[0] = rssi;
				m_length = sizeof(m_tx_buf);
			
				if(rssi&amp;gt;40 &amp;amp;&amp;amp; rssi&amp;lt;50)
				{
					nrf_gpio_pin_write(21, 0);
					nrf_gpio_pin_write(22, 0);
					nrf_gpio_pin_write(23, 0);
					nrf_gpio_pin_write(24, 0);
				}
				
				if(rssi&amp;gt;50 &amp;amp;&amp;amp; rssi&amp;lt;60)
				{
					nrf_gpio_pin_write(21, 1);
					nrf_gpio_pin_write(22, 0);
					nrf_gpio_pin_write(23, 0);
					nrf_gpio_pin_write(24, 0);
				}
				
				if(rssi&amp;gt;60 &amp;amp;&amp;amp; rssi&amp;lt;70)
				{ 
					nrf_gpio_pin_write(21, 1);
					nrf_gpio_pin_write(22, 1);
					nrf_gpio_pin_write(23, 0);
					nrf_gpio_pin_write(24, 0);
				}
			
				if(rssi&amp;gt;70 &amp;amp;&amp;amp; rssi&amp;lt;80)
				{
					nrf_gpio_pin_write(21, 1);
					nrf_gpio_pin_write(22, 1);
					nrf_gpio_pin_write(23, 1);
					nrf_gpio_pin_write(24, 0);
				}
       // NRF_LOG_FLUSH();
				
				// Reset rx buffer and transfer done flag
        memset(m_rx_buf, 0, m_length);
        spi_xfer_done = false;

        APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length));

        while (!spi_xfer_done)
        {
            __WFE();
        }

        NRF_LOG_FLUSH();

        bsp_board_led_invert(BSP_BOARD_LED_0);
        nrf_delay_ms(200);
    }
}

/**
 *@}
 **/
&lt;/pre&gt;&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/radio.zip"&gt;devzone.nordicsemi.com/.../radio.zip&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have also attached the zip file of the code to make it easier for you.&lt;/p&gt;
&lt;p&gt;Thank You for all your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/145968?ContentTypeID=1</link><pubDate>Mon, 27 Aug 2018 14:13:24 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:95bc4e7b-683f-4cd7-9ead-fd77caa9a80c</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;You can transfer integers using the example application. You just need to change the m_tx_buf and length to match your data.&lt;/p&gt;
&lt;p&gt;m_tx_buf[0] = 123;&lt;/p&gt;
&lt;p&gt;m_length = 1;&lt;/p&gt;
&lt;p&gt;APP_ERROR_CHECK(nrf_drv_spi_transfer(&amp;amp;spi, m_tx_buf, m_length, m_rx_buf, m_length));&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Have you tried this?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/145737?ContentTypeID=1</link><pubDate>Sat, 25 Aug 2018 00:41:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:38582dcb-560b-4f41-8a0f-5272033ed5b0</guid><dc:creator>BeaconBLE</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;Thank You for all your help KevinL and Edvin. I executed spi&amp;nbsp;and spis&amp;nbsp;code in nRF51DK. I am using SDK version 12.3, I want to know how do I transfer a variable that I want using the spi&amp;nbsp;as in what changes do I make in the spi and spis&amp;nbsp;code for that and I want to transfer an unsigned integer variable instead of a string. If you could give me a gist of the code changes that would really help me a lot.&lt;/p&gt;
&lt;p&gt;Thank You.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/143689?ContentTypeID=1</link><pubDate>Fri, 10 Aug 2018 09:06:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8a4e4ae7-24d5-4319-aeff-3f638026081a</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;What &lt;a href="https://devzone.nordicsemi.com/members/kevinl"&gt;KevinL&lt;/a&gt; is saying is correct. On Infocenter (that he linked to) you can find a description of the examples in SDK[version]\Hardware peripheral examples\SPI ...&lt;/p&gt;
&lt;p&gt;In the SDK, which you can find &lt;a href="http://developer.nordicsemi.com/nRF5_SDK/"&gt;here&lt;/a&gt;, the examples for spi are located under SDK&amp;lt;version&amp;gt;\examples\peripheral\spi...&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;I suggest that you download SDK15.0.0, if you are starting from scratch now. I also recommend that you start with the examples &amp;quot;spi&amp;quot; and &amp;quot;spis&amp;quot; from the path above.&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Best regards,&lt;/p&gt;
&lt;p&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: NRF51 DK Interrupts using SPI</title><link>https://devzone.nordicsemi.com/thread/143667?ContentTypeID=1</link><pubDate>Fri, 10 Aug 2018 07:39:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:278f2715-d267-4015-8125-d5d4f6f09dec</guid><dc:creator>KevinL</dc:creator><description>&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;margin-top:0px;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Hi,&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;I don&amp;#39;t know which SDK you are using, so I will just post the generic way to find a suitable example.&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Under&lt;a href="http://infocenter.nordicsemi.com/index.jsp?topic=%2Fcom.nordic.infocenter.sdk%2Fdita%2Fsdk%2Fnrf5_sdk.html&amp;amp;cp=4_0"&gt; this link&lt;/a&gt; you can find all the documentation. Under the SDK of your choosing go to \examples\Hardware peripheral examples\Pin Change Interrupt Example. This will then give you a brief overview of what the example does and where to find it.&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;I hope this is enough to help you&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;Edit to add:&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;I&amp;#39;m not sure if you need some SPI examples too, but you can find them at&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;\examples\Hardware peripheral examples\SPI Master Example&lt;/span&gt;&lt;/p&gt;
&lt;p style="background-color:transparent;color:#000000;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;&lt;span style="background-color:transparent;color:#000000;float:none;font-family:Verdana,Arial,Helvetica,sans-serif;font-size:12px;font-style:normal;font-weight:400;letter-spacing:normal;text-align:left;text-decoration:none;text-indent:0px;text-transform:none;white-space:normal;"&gt;\examples\Hardware peripheral examples\SPI Slave Example&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>