<?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>nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/100554/nrf5340-spi4-tx-rx-gaps</link><description>Hi， 
 When developing the program, using SPI4 to send and receive, there is a large time gap between sending and receiving using spi_transceive() function, and the test results are recorded below，①What problem may be causing so big time gap，I see the</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Tue, 13 Jun 2023 08:19:56 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/100554/nrf5340-spi4-tx-rx-gaps" /><item><title>RE: nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/thread/430646?ContentTypeID=1</link><pubDate>Tue, 13 Jun 2023 08:19:56 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:79690c43-7e4d-4d60-901d-ca0c68139ceb</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;I was testing with ncs v2.3, maybe there is a difference, but can you show me the parameters used for the spi transfer function here? And maybe put some useful data in the entire SPI TX buffer so we can see the tx buffer is indeed the same length as rx?&lt;/p&gt;
&lt;p&gt;Edit: Does the following kconfig make any difference?&lt;br /&gt;&lt;a href="https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/kconfig/CONFIG_SPI_NRFX_RAM_BUFFER_SIZE.html#std-kconfig-CONFIG_SPI_NRFX_RAM_BUFFER_SIZE"&gt;https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/kconfig/CONFIG_SPI_NRFX_RAM_BUFFER_SIZE.html#std-kconfig-CONFIG_SPI_NRFX_RAM_BUFFER_SIZE&lt;/a&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/thread/430085?ContentTypeID=1</link><pubDate>Fri, 09 Jun 2023 01:28:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1e40f660-6d61-40b1-bf74-a6f3eb7888f7</guid><dc:creator>sean</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp; We tested the same number of bytes sent（10B） and received（10B） in a&amp;nbsp;spi_transceive() function , but there is still a time gap&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1686273726721v1.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/thread/430041?ContentTypeID=1</link><pubDate>Thu, 08 Jun 2023 15:24:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e8bd8ddd-75a9-47b5-b448-4aa756cf2676</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;You are right, looks like the low layer driver split the transfer if the length of rx and tx buffer are not equal.&lt;/p&gt;
&lt;p&gt;Please set tx and rx for the same length, even though you are wasting a bit RAM that way.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/thread/429869?ContentTypeID=1</link><pubDate>Thu, 08 Jun 2023 01:59:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:cec46bc3-1d0c-4b01-8244-d723063eb039</guid><dc:creator>sean</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Yes,spi can do sending and receiving in one transfer ,Therefore, I only use a spi_transceive() function in my code to complete the 5 byte sending and 50 byte receiving of data， in spi clock line should not have 27 us gap，but there is actually a&amp;nbsp; 27 us gap in spi clock line&lt;/p&gt;
&lt;p&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1686189287707v2.png" alt=" " /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: nRF5340 spi4 tx rx gaps</title><link>https://devzone.nordicsemi.com/thread/429798?ContentTypeID=1</link><pubDate>Wed, 07 Jun 2023 13:14:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:00c18ad4-791f-4ef2-b527-2cbc5157e247</guid><dc:creator>Kenneth</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;The short answer to your question is that there is an OS running and you are running on a high abstraction layer, and it takes time to pass data through the various layers and callbacks. If you want tighter and better control over the timing you should use the nrfx_spim_xfer() api, see examples here:&lt;br /&gt;&lt;a href="https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_spim"&gt;https://github.com/zephyrproject-rtos/hal_nordic/tree/master/nrfx/samples/src/nrfx_spim&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;That said though, what do you mean by sending and receiving? Normally in spi you can do both in one transfer, so for instance if you want to send a command to read a number of bytes, then you execute only one spi_transceive(), where the rx buffer must be the total length of the (command+data) it want to receive. After transfer the first bytes in the rx buffer you can ignore (since the command was sent during that time), but the remaing data bytes in rx buffer is then the data you want.&lt;/p&gt;
&lt;p&gt;Kenneth&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>