<?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>SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/17267/spi-slave-and-sofdevice</link><description>Hi. 
 Is it possible to use SPI slave and SofDevice at the same time? I try to do device which status will be read by master uc by SPI. I&amp;#39;m using nRF51422(rev.3), SDK10.0.0, SD5.0.1. ANT application working as 4-channel background scanning. I used SPI</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Thu, 17 Nov 2016 08:54:02 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/17267/spi-slave-and-sofdevice" /><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66330?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2016 08:54:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:326db718-1969-4f11-9317-a370b05b6585</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Thanks for adding an answer :)&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66329?ContentTypeID=1</link><pubDate>Thu, 17 Nov 2016 08:46:49 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:baf32f5a-9df5-4af6-b623-a596d17938a4</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;Hello.&lt;/p&gt;
&lt;p&gt;Problem was solved. I made mistake with bootloader. Examples in SDK10.0.0 working fine.&lt;/p&gt;
&lt;p&gt;Best regards,
PW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66328?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2016 14:30:30 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d7d92c60-ac12-43c3-9c86-9aab4fa4c3f9</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;Ok. Maybe you can edit your question and include your complete project? So I can test it here?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66327?ContentTypeID=1</link><pubDate>Wed, 02 Nov 2016 07:57:34 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:f074a77e-c20a-4fd2-9bdf-8bcfb7e1ff14</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;sd_nvic_SetPriority(SPI1_TWI1_IRQn, NRF_APP_PRIORITY_LOW) - my mistake, I erased it, but
it didn&amp;#39;t help. I always get NRF_DRV_SPIS_XFER_DONE event after master transfer, but after SPI trasmission I never get again ant_evt_dispatch(ant_evt_t * p_ant_evt).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66325?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 11:45:54 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:25a58a24-eff7-4d39-a659-8ae4b7b7b16e</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It stops? Where in spis_irq_handler() does it stop? Why are you calling err_code = sd_nvic_SetPriority(SPI1_TWI1_IRQn, NRF_APP_PRIORITY_LOW); every time you get the NRF_DRV_SPIS_XFER_DONE event? And why do you not check the returned error code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66324?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 11:18:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:51ba44c4-a1ba-4da9-a295-560649440d08</guid><dc:creator>PW</dc:creator><description>&lt;p&gt;When SPI transmission occured, program stops on:&lt;/p&gt;
&lt;p&gt;&lt;code&gt;spis_irq_handler(NRF_SPIS_Type * p_spis, spis_cb_t * p_cb)&lt;/code&gt;&lt;/p&gt;
&lt;p&gt;SPI transmission is slow: 250kbps&lt;/p&gt;
&lt;p&gt;Initialization SPI slave (before soft device init):&lt;/p&gt;
&lt;pre&gt;&lt;code&gt;    static void spi_slave_event_handle(nrf_drv_spis_event_t event)
{
    uint32_t err_code;
    
    if (event.evt_type == NRF_DRV_SPIS_XFER_DONE)
    {
				err_code = sd_nvic_SetPriority(SPI1_TWI1_IRQn, NRF_APP_PRIORITY_LOW);       

				APP_ERROR_CHECK_BOOL(event.rx_amount == RX_BUF_SIZE);
        
        bool success = spi_slave_buffer_check(m_rx_buf, event.rx_amount);
        APP_ERROR_CHECK_BOOL(success);
        
        err_code = nrf_drv_spis_buffers_set(&amp;amp;m_spis, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_rx_buf));
        APP_ERROR_CHECK(err_code);          
    }
}

    uint32_t spi_slave_init(void)
{
    uint32_t              err_code;
    nrf_drv_spis_config_t spis_config = NRF_DRV_SPIS_DEFAULT_CONFIG(SPIS_INSTANCE_NUMBER); 

    spis_config.miso_pin        = ANT_MISO_PIN;
    spis_config.mosi_pin        = ANT_MOSI_PIN;
    spis_config.sck_pin         = ANT_SCK_PIN;
    spis_config.csn_pin         = ANT_CS_PIN;
    spis_config.mode            = NRF_DRV_SPIS_MODE_1;
    spis_config.bit_order       = NRF_DRV_SPIS_BIT_ORDER_MSB_FIRST;
    spis_config.def             = DEF_CHARACTER;
    spis_config.orc             = ORC_CHARACTER;
    
    err_code = nrf_drv_spis_init(&amp;amp;m_spis, &amp;amp;spis_config, spi_slave_event_handle);
    APP_ERROR_CHECK(err_code);
    
    //Initialize buffers.
    spi_slave_buffers_init(m_tx_buf, m_rx_buf, (uint16_t)TX_BUF_SIZE);
    
    //Set buffers.
    err_code = nrf_drv_spis_buffers_set(&amp;amp;m_spis, m_tx_buf, sizeof(m_tx_buf), m_rx_buf, sizeof(m_rx_buf));
    APP_ERROR_CHECK(err_code);            

    return NRF_SUCCESS;
}
&lt;/code&gt;&lt;/pre&gt;
&lt;p&gt;Have you got any example with working softdevice?&lt;/p&gt;
&lt;p&gt;PW&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: SPI slave and Sofdevice</title><link>https://devzone.nordicsemi.com/thread/66326?ContentTypeID=1</link><pubDate>Tue, 25 Oct 2016 09:27:12 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79f09bfa-3ad7-486e-a735-efc586671a3d</guid><dc:creator>Petter Myhre</dc:creator><description>&lt;p&gt;It should be possible to use SPI slave and SoftDevice together. What happens if you use SPI slave with the SoftDevice?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>