<?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>nrf_drv_spi_transfer takes too long time</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/75244/nrf_drv_spi_transfer-takes-too-long-time</link><description>Good morning, 
 I am working on nRF52840 DK, using nRF5 SDK. 
 
 I am trying to communicate using SPI. 
 However, I found out that the function nrf_drv_spi_transfer took 10&amp;#181;s, I need to work at high sampling rate to get a good result of my system, therefore</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 18 May 2021 07:13:46 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/75244/nrf_drv_spi_transfer-takes-too-long-time" /><item><title>RE: nrf_drv_spi_transfer takes too long time</title><link>https://devzone.nordicsemi.com/thread/310022?ContentTypeID=1</link><pubDate>Tue, 18 May 2021 07:13:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:810b7800-66a7-4525-b8f4-2e8d8aa0b474</guid><dc:creator>Susheel Nuguru</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;Can you also give me some info on how much time it takes for your spi&amp;nbsp;event handler to complete? I see that you rely on a rhd_spi_transfer_done flag to be set in the callback function. What other processing is done in that callback handler?&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&lt;/p&gt;
[quote user=""]We can see that within 2.33µs, I have already gotten the response from the slave. However LED0 is still at high level indicating that I am still inside the function nrf_drv_spi_transfer for another 7µs, I would like to know what is the function nrf_drv_spi_transfer waiting for ? Can I reduce this duration ?[/quote]
&lt;p&gt;If my math is correct, one CPU instruction on a 64MHz clocked system takes about 15.625 nano second to execute. So in 7 us it can execute 448 instruction. This is not such a big number for the post processing after&amp;nbsp;nrf_spim_task_trigger is called. Maybe you want to fine tune the driver and optimize it even more for your need?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>