<?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>How fast can the counter count?</title><link>https://devzone.nordicsemi.com/f/nordic-q-a/66050/how-fast-can-the-counter-count</link><description>I&amp;#39;m using an nRF52840-Preview-DK board in a POC (Proof Of Concept) to convert an I2S-TDM bus to SPI. 
 So it takes the I2S FS (frame sync) and CLK (clock) signals as inputs and generates the SPI CSN (chip select) signal 
 Then the I2S clock and data signals</description><dc:language>en-US</dc:language><generator>Telligent Community 13</generator><lastBuildDate>Mon, 21 Sep 2020 16:18:37 GMT</lastBuildDate><atom:link rel="self" type="application/rss+xml" href="https://devzone.nordicsemi.com/f/nordic-q-a/66050/how-fast-can-the-counter-count" /><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270671?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 16:18:37 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:871ec324-4459-436f-ab9a-39ec9748d4d1</guid><dc:creator>DBT</dc:creator><description>&lt;p&gt;This looks like the answer to my original question, but with the fix for errata 155 in place I was able to use a clock speed of 3.072MHz at 50% duty cycle - slightly higher than the 2.67MHz proposed here.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270670?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 16:17:13 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:ce0a512d-f694-4043-b8a8-e957dbf8fad3</guid><dc:creator>DBT</dc:creator><description>&lt;p&gt;This seemed to fix it!&amp;nbsp; Now CSN goes high after 10 clocks&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270669?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 15:54:52 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:72d34208-f09f-493e-ae17-ee5d5657d024</guid><dc:creator>hmolesworth</dc:creator><description>&lt;p&gt;Did you try the workaround for errata 155?&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52832_Rev2/ERR/nRF52832/Rev2/latest/anomaly_832_155.html"&gt;IN event may occur more than once on input edge&lt;/a&gt;&amp;nbsp;that was nRF52832, same errata on nRF52840&amp;nbsp;&lt;a href="https://infocenter.nordicsemi.com/topic/errata_nRF52840_Rev2/ERR/nRF52840/Rev2/latest/anomaly_840_155.html"&gt;here&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270664?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 15:23:41 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:388d2743-6c2f-4369-bc7c-f28a90c1432a</guid><dc:creator>Dmitry</dc:creator><description>&lt;p&gt;Hi,&lt;/p&gt;
&lt;p&gt;it seems I2S-CLK&amp;nbsp;is really too fast for GPIOTE. In&amp;nbsp;&lt;a href="https://devzone.nordicsemi.com/f/nordic-q-a/23514/max-freqency-gpiote-event-ppi-to-counter"&gt;this&lt;/a&gt;&amp;nbsp;thread, Martin suggests no more than 2.67MHz for 50%-duty signal.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270659?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 15:12:05 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:7a029a13-bd50-4fe1-86df-a3faaab5ec2d</guid><dc:creator>DBT</dc:creator><description>&lt;p&gt;By the way, I tested at half speed (I2S-CLK set to 1.536MHz instead of 3.072MHz) and that seemed to work.&amp;nbsp; The CSN pin goes high after 10 clock cycles.&lt;/p&gt;
&lt;p&gt;Isn&amp;#39;t this much slower than expected?&amp;nbsp; I would think from your initial response that the GPIOTE/PPI circuits should be able to handle signals up to 8MHz or so.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270637?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 14:10:38 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:1fb54b3f-06dc-47f0-942c-55f342520fc3</guid><dc:creator>DBT</dc:creator><description>&lt;p&gt;Using a separate pin for low-to-high transition did not fix it.&lt;/p&gt;
&lt;p&gt;The green trace is this new pin (SPI_CSN2_PIN).&amp;nbsp; There are still 17 clocks instead of 10 between CSN going low and CSN2 going high&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/communityserver-discussions-components-files/4/tek00018.png" /&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the new source code&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/7455.main.c"&gt;devzone.nordicsemi.com/.../7455.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;What do you think the race condition may be?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270497?ContentTypeID=1</link><pubDate>Mon, 21 Sep 2020 08:43:45 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:64b62060-f263-47b0-9537-e893afabc240</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;Thank you for the detailed explanation, I think I understand what the issue is now.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;There might be a race condition somewhere.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;I suggest you map the SPI-CSN transition from low to high to a separate GPIO pin and see if it will trigger the transition correctly, I&amp;#39;m curious to see what happens when there&amp;#39;s only one GPIOTE channel controlling the pin during this transition.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270363?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 14:29:20 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:bb9dfd3c-78fd-4641-ad81-01aee286303d</guid><dc:creator>DBT</dc:creator><description>&lt;p&gt;I looked through the errata on the processor in the PDK board and didn&amp;#39;t see a problem, but I&amp;#39;m getting a DK board just to be sure.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Sorry, I probably gave too much detail and it&amp;#39;s confusing you.&lt;/p&gt;
&lt;p&gt;I&amp;#39;m not using the I2S or SPI peripherals on the nRF52840 at all.&amp;nbsp;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The I2S is coming from an Audio ADC chip and has 8 channels of audio, so it uses TDM.&lt;/p&gt;
&lt;p&gt;The SPI bus is going to an nRF5340 (we had to use SPI because the I2S peripheral on the nRF5340 only supports stereo audio - not 8 channels)&lt;/p&gt;
&lt;p&gt;I&amp;#39;m only using GPIOTE, PPI and TIMER0 on the nRF52840.&lt;/p&gt;
&lt;p&gt;The nRF53840 is between the Audio ADC and the nRF5340.&lt;/p&gt;
&lt;p&gt;You can ignore the fact that its implementing an I2S to SPI converter.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s the source code&lt;/p&gt;
&lt;p&gt;&lt;a href="https://devzone.nordicsemi.com/cfs-file/__key/communityserver-discussions-components-files/4/6724.main.c"&gt;devzone.nordicsemi.com/.../6724.main.c&lt;/a&gt;&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;Here&amp;#39;s an oscilloscope trace&lt;/p&gt;
&lt;p&gt;&lt;img alt=" " src="https://devzone.nordicsemi.com/resized-image/__size/640x240/__key/communityserver-discussions-components-files/4/tek00017A.png" /&gt;&lt;/p&gt;
&lt;p&gt;Once SPI-CSN goes low, I want it to go high again after 10 clocks of I2S-CLK (10 is just a number I chose for test - The actual implementation will use&amp;nbsp;128 clocks)&lt;/p&gt;
&lt;p&gt;It doesn&amp;#39;t actually go high until after 18-19 clocks, depending on whether you count the one that occurs at the same time that SPI-CSN is going low.&amp;nbsp; And its not always the same number - sometimes is 16 and other times 20.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: How fast can the counter count?</title><link>https://devzone.nordicsemi.com/thread/270278?ContentTypeID=1</link><pubDate>Fri, 18 Sep 2020 08:58:02 GMT</pubDate><guid isPermaLink="false">137ad170-7792-4731-bb38-c0d22fbe4515:407fbd28-8d78-47a9-9b53-cd61960a915b</guid><dc:creator>haakonsh</dc:creator><description>&lt;p&gt;The preview DK likely has a&amp;nbsp;few&amp;nbsp;erratas, you really need to get a newer DK.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;Do you have a scope of the SPI and I2S communication?&amp;nbsp;&lt;/p&gt;
&lt;p&gt;The GPIOTE tasks should only be delayed by one 16MHz clock cycle, 62.5ns. There is however some delay in the GPIO peripheral, but that should be much lower than one 16MHz clock cycle.&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&amp;nbsp;&lt;/p&gt;
&lt;p&gt;[quote user=""][/quote]&lt;/p&gt;
&lt;p&gt;So it takes the I2S FS (frame sync) and CLK (clock) signals as inputs and generates the SPI CSN (chip select) signal&amp;nbsp;&lt;/p&gt;
&lt;p&gt;Then the I2S clock and data signals pass through unmodified to the SPI bus clock and data signals.&lt;/p&gt;
&lt;p&gt;&lt;/p&gt;
&lt;p&gt;&amp;nbsp;Have I understood you correctly that the nRF52 operates as an I2S slave and a SPI master?&amp;nbsp;&lt;br /&gt;&lt;br /&gt;&lt;/p&gt;
[quote user=""]Then the I2S clock and data signals pass through unmodified to the SPI bus clock and data signals.[/quote]
&lt;p&gt;&amp;nbsp;Can you elaborate?&amp;nbsp;&lt;br /&gt;Do you mean that you share the DMA buffer between the I2S and SPI peripheral?&amp;nbsp;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>