<?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>Unable to read chunk of data  from Peripheral\SPIS Example</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/65335/unable-to-read-chunk-of-data-from-peripheral-spis-example</link><description>Hi, 
 
 I&amp;#39;m trying to implement a SPI Communication between Arduino UNO and PCA10056 DK. PCA10056 DK run as a SPI slave.. Arduino uno run as a SPI Master. 
 The problem is SPI Master keep sending a chunk of data (size - 25 bytes ) by each second.. But</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 28 Aug 2020 11:19:13 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/65335/unable-to-read-chunk-of-data-from-peripheral-spis-example" /><item><title>RE: Unable to read chunk of data  from Peripheral\SPIS Example</title><link>https://devzone.nordicsemi.com/thread/266975?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2020 11:19:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7e394ced-7209-4987-8c9b-82d6b8fd3753</guid><dc:creator>Edvin</dc:creator><description>&lt;p&gt;spis_config has a parameter:&lt;/p&gt;
&lt;p&gt;spis_config.mode =&amp;nbsp;NRF_SPIS_MODE_0, which is set by NRF_DRV_SPIS_DEFAULT_CONFIG;&lt;/p&gt;
&lt;p&gt;Try all the modes with your SPIM:&lt;/p&gt;
&lt;p&gt;NRF_SPIS_MODE_0&lt;br /&gt;NRF_SPIS_MODE_1&lt;br /&gt;NRF_SPIS_MODE_2&lt;br /&gt;NRF_SPIS_MODE_3&lt;/p&gt;
&lt;p&gt;And see if you receive all the data with any of these. Perhaps the master is using another mode than NRF_SPIS_MODE_0.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;BR,&lt;br /&gt;Edvin&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to read chunk of data  from Peripheral\SPIS Example</title><link>https://devzone.nordicsemi.com/thread/266933?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2020 09:37:29 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:3b5ba686-b52c-4623-8c64-f23356d3fc90</guid><dc:creator>usr123</dc:creator><description>&lt;p&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;#define TEST_STRING &amp;quot;Nordic&amp;quot;
static uint8_t       m_tx_buf[25];           /**&amp;lt; TX buffer. */
static uint8_t       m_rx_buf[25];    /**&amp;lt; RX buffer. */
static const uint8_t m_length =25;        /**&amp;lt; Transfer length. */
//static char     m_buf={0};

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;
		//if(event.rx_amount&amp;gt;2)
		//{
            NRF_LOG_INFO(&amp;quot; Transfer completed. Received: %d   %X&amp;quot;,event.rx_amount);//,m_rx_buf[0]);//event.rx_amount,m_rx_buf[0],m_rx_buf[1],m_rx_buf[2]);
		//}
    }
}

int main(void)
{
    // 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_init(BSP_INIT_LEDS);

    APP_ERROR_CHECK(NRF_LOG_INIT(NULL));
    NRF_LOG_DEFAULT_BACKENDS_INIT();

    NRF_LOG_INFO(&amp;quot;SPIS example&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;
    APP_ERROR_CHECK(nrf_drv_spis_init(&amp;amp;spis, &amp;amp;spis_config, spis_event_handler));

    while (1)
    {
        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;&amp;nbsp;The amount of received byte ...I&amp;#39;m printing it on console.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: Unable to read chunk of data  from Peripheral\SPIS Example</title><link>https://devzone.nordicsemi.com/thread/266912?ContentTypeID=1</link><pubDate>Fri, 28 Aug 2020 08:51:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:78fe11a0-cf3f-4576-9fc5-e6150d8adae8</guid><dc:creator>Turbo J</dc:creator><description>[quote userid="92943" url="~/f/nordic-q-a/65335/unable-to-read-chunk-of-data-from-peripheral-spis-example"] &amp;nbsp;Is it any Mode issue or Clock div?[/quote]
&lt;p&gt;Impossible to say without looking at code or the plot on a DSO (digital storage oscilloscope, 4 channels recommended for SPI).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>