<?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>7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/106838/7usec-delay-seems-to-be-required-between-ss-and-sck-on-spi-slave</link><description>I&amp;#39;m trying to access the nRF5340 over SPI Slave from another processor who is SPI Master. Running a simple &amp;quot;looback test&amp;quot; between an nRF5340 SPI Master and SPI Slave seems to work fine but when I try it with the external processor&amp;#39;s SPI Master the data</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Wed, 03 Jan 2024 13:29:00 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/106838/7usec-delay-seems-to-be-required-between-ss-and-sck-on-spi-slave" /><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/462508?ContentTypeID=1</link><pubDate>Wed, 03 Jan 2024 13:29:00 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:35d6315b-29f8-425b-9760-a35336df32a8</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello Robert,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;The IFTIMING.x registers are only available on the SPIM4 instance.&lt;/p&gt;
&lt;p&gt;&lt;img style="max-height:240px;max-width:320px;" src="https://devzone.nordicsemi.com/resized-image/__size/640x480/__key/communityserver-discussions-components-files/4/pastedimage1704287999114v1.png" alt=" " /&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I have few questions here:&lt;/p&gt;
&lt;p&gt;What is your setup? Are you using NRF5340 as a SPI slave? What is your SPI Master? Is it a Nordic Device?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;And what do you mean by this:&lt;/p&gt;
[quote user=""]when I try it with the external processor&amp;#39;s SPI Master the data sent on the MOSI line isn&amp;#39;t read correctly by the nRF5340&amp;nbsp; SPI Slave.[/quote]
&lt;p&gt;What is the CSN to CLK delay you get in this case? (with external master)&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]However, I notice about a 7 microsecond delay between the SS going low and the SCK transitions.[/quote]
&lt;p&gt;your SPI master should have control on this? right?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]When I try my own SPI Master there&amp;#39;s only about 70ns delay between SS and SCK.[/quote]
&lt;p&gt;What do you mean here? What is &amp;quot;my own SPI Master&amp;quot; vs &amp;quot;External SPI Master&amp;quot;?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;I would like to understand your overall setup. Will be nice if you could share h/w and code snapshots.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Regards, Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/462371?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2024 20:12:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:83936b00-e88b-4ac2-841a-c0a7207cca01</guid><dc:creator>tozz88</dc:creator><description>&lt;p&gt;Great. Thanks for the information. However, the linked solution sounds like it only works for SPIM4 and I am using SPI Slave, not master. Is there a way to get a similar behavior for SPI Slave?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/462276?ContentTypeID=1</link><pubDate>Tue, 02 Jan 2024 12:22:21 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:d95279e0-8f76-4488-b92f-495055afc48a</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
[quote user="tozz88"]Your measured ~6us SS-to-SCK delay jibes with my measurements as well. I must say, I&amp;#39;ve never encountered a part before that adds 12us to every SPI transaction by design.[/quote]
&lt;p&gt;Please have a look at this ticket which is pretty much same as your concern, and the suggestion from my colleague to use the SPIM4 instance:&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/90197/how-to-reduce-spi-chipselect-to-sclk-delay"&gt;Reduce CS to CLK Delay&lt;/a&gt;&lt;/p&gt;
[quote user="tozz88"]Are you saying that I can use this field to reduce the SPI Slave device SS-to-SCK delay[/quote]
&lt;p&gt;No, this is a parameter for extra delay if you want to have controlled delay for synchronization etc.&amp;nbsp;As you want lower delay, you should not use it or have set it to 0.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/461767?ContentTypeID=1</link><pubDate>Wed, 27 Dec 2023 10:14:46 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:46f48e83-2c10-487a-be4d-c9befe0b4e6c</guid><dc:creator>Maria Gilje</dc:creator><description>&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;We are severely understaffed this week because of the Christmas holidays, and Naeem will have to get back to you on this next week. &lt;/span&gt;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&lt;span dir="ltr"&gt;Sorry for the inconvenience.&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/461626?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2023 18:37:33 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e89b2848-6585-41b6-8573-cb86e0a5cee8</guid><dc:creator>tozz88</dc:creator><description>&lt;p&gt;Thank you for your timely response. I&amp;#39;m glad, in a way, to hear that the measured delay I am seeing is expected and not something else I have to diagnose on my side. Your measured ~6us SS-to-SCK delay jibes with my measurements as well. I must say, I&amp;#39;ve never encountered a part before that adds 12us to every SPI transaction by design.&lt;/p&gt;
&lt;p&gt;&lt;span&gt;&amp;gt;There is a delay parameter in the spi_cs_control struct which is part of the spi_config.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;I have read the documentation on this field here&amp;nbsp;&lt;a href="https://docs.zephyrproject.org/latest/hardware/peripherals/spi.html"&gt;Serial Peripheral Interface (SPI) Bus &amp;mdash; Zephyr Project Documentation&lt;/a&gt;&amp;nbsp;but it&amp;#39;s a bit vague about how to use it and its bounds, etc.&amp;nbsp;&amp;nbsp;Are you saying that I can use this field to reduce the SPI Slave device SS-to-SCK delay on the nRF5340 to below 6? To 1 or even 0?&amp;nbsp;&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Could you provide me with an example device tree usage? Since I supplied my device tree entry in the original post if you could show how I might add spi_cs_control to that it would be fantastic.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;&lt;span&gt;Sadly, there is no such control on the SPI Master device side other than using a GPIO instead of the SS line and putting delays between the GPIO control and the SPI. So if there is no way to reduce the latency on your part, we&amp;#39;ll need to rethink our design here.&lt;/span&gt;&lt;/p&gt;
&lt;p&gt;Thank you&lt;span&gt;&amp;nbsp;for your time.&lt;/span&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: 7usec delay seems to be required between SS and SCK on SPI Slave</title><link>https://devzone.nordicsemi.com/thread/461599?ContentTypeID=1</link><pubDate>Fri, 22 Dec 2023 14:33:15 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:e43fdd9d-96fc-43b6-a488-95e5f95ec2e5</guid><dc:creator>Naeem Maroof</dc:creator><description>&lt;p&gt;Hello,&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Yes, there would&amp;nbsp;always be delay after the CS has been enabled till the clock is enabled.&lt;/p&gt;
&lt;p&gt;I have tested it previously and it was ~6u.&lt;/p&gt;
&lt;p&gt;You could send multiple bytes in one transaction and see if it meets your overall requirement.&lt;/p&gt;
&lt;p&gt;Over here:&lt;/p&gt;
[quote user=""]&lt;span&gt;.operation &lt;/span&gt;&lt;span&gt;=&lt;/span&gt;&lt;span&gt; &lt;/span&gt;&lt;span&gt;SPI_WORD_SET&lt;/span&gt;&lt;span&gt;(&lt;/span&gt;&lt;span&gt;8&lt;/span&gt;&lt;span&gt;)&lt;/span&gt;[/quote]
&lt;p&gt;You are setting word size as 8 bit, so what you mean by 16 bit transfers are not detected correctly?&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
[quote user=""]plus the only way I can perform the delay on the SPI Master side is to replace the SS signal with a GPIO that I toggle manually[/quote]
&lt;p&gt;There is a delay parameter in the spi_cs_control struct which is part of the spi_config.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;/BR, Naeem&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>