<?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 read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/73803/spi-read-with-ppi-fails-when-manual-read-writes-are-executed</link><description>Hi, 
 
 I am using ppi to read some continuous data from a sensor through SPI and i got it working, it reads data in evry 8ms from the sensor through ppi. 
 but it fails when i am trying to read some data using normal spi read (nrf_drv_spi_transfer()</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Fri, 16 Apr 2021 13:22:26 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/73803/spi-read-with-ppi-fails-when-manual-read-writes-are-executed" /><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/305306?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 13:22:26 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:4539ef80-2435-4135-b8b2-ccbab6db1154</guid><dc:creator>madblue</dc:creator><description>&lt;p&gt;Thank you Einar.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/305304?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 13:19:59 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a400050f-8866-4f27-8059-cc92afbf3666</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Good to hear.&lt;/p&gt;
&lt;p&gt;The choice between the nRF5 SDK and nRF Connect SDK depends on several factors. First of all, check which of the two meets your requirements. If both, then consider if you do not need new features going forward and need a mature SDK, then the nRF5 SDK could be a good choice. If you may need new features going forward&amp;nbsp;or have other preferences for the nRF Connect SDK, then that is probably it.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/305219?ContentTypeID=1</link><pubDate>Fri, 16 Apr 2021 07:32:31 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:a10a87f5-4e35-48e1-87dd-1fba204698dc</guid><dc:creator>madblue</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have made a test code with sdk17 with only timer and spi and it doesn&amp;#39;t have the issue. it doesn&amp;#39;t fail as it happened with my older code.&amp;nbsp;&lt;/p&gt;
&lt;p&gt;THanks for the support, i will upgrade my code with latest version of the sdk.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;What do you think about the nrf connect sdk ? How good is it compared to the nrf52 default sdk ?&lt;/p&gt;
&lt;p&gt;I am in a dilemma on which one to choose for the final firmware.&lt;/p&gt;
&lt;p&gt;my application needs 2 spi peripherals, 1 TWI, 2 timers and BLE with extended mtu size &amp;gt;150 and good power consumption&amp;nbsp; features.&amp;nbsp;&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/304925?ContentTypeID=1</link><pubDate>Wed, 14 Apr 2021 19:09:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:8683c6c5-b3fe-4751-a154-66aec8cef6f5</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
[quote user="joice_markose"]What about the priorities, does the ppi read has higher priority over the manual read writes ?[/quote]
&lt;p&gt;There is no priority concept with PPI. PPI simply allows you to trigger tasks in a peripheral using HW signals. So it happens when it happens, regardless of anything else. It is your responsibility to ensure that there cannot be any conflict by ensuring that you finish one operation before triggering the next (being from SW or PPI).&lt;/p&gt;
[quote user="joice_markose"]I have noted that&amp;nbsp; flags used for spi initialization also not working,[/quote]
&lt;p&gt;Can you elaborate?&lt;/p&gt;
[quote user="joice_markose"]Do you think the sdk version could cause any problem? i am planning to upgrade but not now as the migration process looks a bit tedious and time consuming.&amp;nbsp;[/quote]
&lt;p&gt;I have not seen enough of your code, but this looks more like wrong usage based on your description. That said, the SoftDevice that is part of SDK 14.x.x is not qualified for nRF52840 so if you are making a BLE product you should definitely migrate. I would advice to do so in any case, though.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/304694?ContentTypeID=1</link><pubDate>Wed, 14 Apr 2021 05:18:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:979cdf0e-66e8-4eac-b068-d40455b64264</guid><dc:creator>madblue</dc:creator><description>&lt;p&gt;Hi Einar,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Thank you for the quick reply.&lt;/p&gt;
&lt;p&gt;I am only doing some sensor reg read/write using the spi apis,&amp;nbsp;&lt;span&gt;nrf_drv_spi_transfer.&amp;nbsp;my worry is that, what happens when if i call the manual write when a ppi read is ongoing ? i&amp;nbsp;haven&amp;#39;t went through all the documentation on ppi.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;What about the priorities, does the ppi read has higher priority over the manual read writes ?&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have noted that&amp;nbsp; flags used for spi initialization also not working,&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;pre class="ui-code" data-mode="c_cpp"&gt;    nrf_drv_spi_config_t spi_config = NRF_DRV_SPI_DEFAULT_CONFIG;
    spi_config.miso_pin = SPI_MISO;
    spi_config.mosi_pin = SPI_MOSI;
    spi_config.sck_pin  = SPI_SCK;
    spi_config.mode = NRF_DRV_SPI_MODE_0;
    spi_config.frequency = NRF_DRV_SPI_FREQ_8M;

    APP_ERROR_CHECK(nrf_drv_spi_init(&amp;amp;spi, &amp;amp;spi_config, spi_event_handler, NULL));
    
    nrf_drv_spi_xfer_desc_t xfer = NRF_DRV_SPI_XFER_TRX(&amp;amp;ppi_txbuff_max30003, 1, ppi_rxbuff_max30003, 4); 
    uint32_t flags = NRF_DRV_SPI_FLAG_HOLD_XFER | 
                   NRF_DRV_SPI_FLAG_REPEATED_XFER | 
                   NRF_DRV_SPI_FLAG_RX_POSTINC  | 
                   NRF_DRV_SPI_FLAG_NO_XFER_EVT_HANDLER;  
    uint32_t err_code = nrf_drv_spi_xfer(&amp;amp;spi, &amp;amp;xfer, flags); 
    APP_ERROR_CHECK(err_code);  
  
    spi_start_task_addr = nrf_drv_spi_start_task_get(&amp;amp;spi); 
    spi_end_evt_addr = nrf_drv_spi_end_event_get(&amp;amp;spi);&lt;/pre&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Even if disable the event handler, it is getting updated.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Do you think the sdk version could cause any problem? i am planning to upgrade but not now as the migration process looks a bit tedious and time consuming.&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: spi read with ppi  fails when manual read/writes are executed</title><link>https://devzone.nordicsemi.com/thread/304363?ContentTypeID=1</link><pubDate>Mon, 12 Apr 2021 17:36:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:5c09496f-4444-45dd-aa16-be4832b90c7a</guid><dc:creator>Einar Thorsrud</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;There is no specific incompatibility between the SPI driver and PPI, but it depends on what you do. If you do something outside the driver that makes the state of the SPI(M) peripheral different then what the drivers expects, it will cause problems.&lt;/p&gt;
&lt;p&gt;(As a side note, I want to mention that the first SDK release that is suitable for production with the nRF52840 is SDK 15.0.0. So if you plan to use this for a mass produced product you should migrate to a newer SDK version).&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>