<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Re: I2S Slave with SGPIO in LPC Microcontrollers</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522414#M5050</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by GH on Fri Nov 28 05:41:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason the complete message doesn't appear in the forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So here follows the rest:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
while(LPC_SGPIO-&amp;gt;REG[SGPIO_SLICE_N]!=SGPIO_PATTERN_MATCH_VALUE)
{
count++;
if(count&amp;gt;=MAX_SYNC_COUNT){return -1;}
}

LPC_SGPIO-&amp;gt;CTRL_ENABLED |= (SGPIO_SLICE_L);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the right design pattern to implement such a synchronization to a external signal? Or are there other ways to implement such a task?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GH&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 16:39:24 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T16:39:24Z</dc:date>
    <item>
      <title>I2S Slave with SGPIO</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522413#M5049</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by GH on Fri Nov 28 02:09:00 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;im working on the implementation of a I2S slave on the SGPIO peripheral of a LPC4337.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;All in all it works, but from time to time I experience some synchronization problems. &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;All clocks are provided by external peripherals. I'm running all Slices with the external word clock (SCK).&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Further I need to synchronize the Position Counters of the Slices with the word clock. Therefore I continuously read the REG value of the Slice connected to the WCLK pin and enable the other slices (connected to the data lines) when I read the expected pattern.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Sometimes the synchronization fails and position counters are activated to late, thus the data lines are misaligned to the WCLK by one bit. It seems like the timing is in someway unpredicted, when starting the slices using the CTRL_ENABLED register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Usually I would expect the LPC4337 to be fast enough to perform this tasks, since it's running at 196MHz while the I2S bus is running at 3MHz (bit clock) with a 48kHz word clock.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;See the code of the synchronization loop:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
while(LPC_SGPIO-&amp;gt;REG[SGPIO_SLICE_N]!=SGPIO_PATTERN_MATCH_VALUE)
{
count++;
if(count&amp;gt;=MAX_SYNC_COUNT){return -1;}
}

LPC_SGPIO-&amp;gt;CTRL_ENABLED |= (1&amp;lt;&amp;lt;SGPIO_SLICE_L);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the right design pattern to implement such a synchronization to a external signal? Or are there other ways to implement such a task?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GH&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:39:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522413#M5049</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:39:23Z</dc:date>
    </item>
    <item>
      <title>Re: I2S Slave with SGPIO</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522414#M5050</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by GH on Fri Nov 28 05:41:13 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;For some reason the complete message doesn't appear in the forum.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;So here follows the rest:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;
while(LPC_SGPIO-&amp;gt;REG[SGPIO_SLICE_N]!=SGPIO_PATTERN_MATCH_VALUE)
{
count++;
if(count&amp;gt;=MAX_SYNC_COUNT){return -1;}
}

LPC_SGPIO-&amp;gt;CTRL_ENABLED |= (SGPIO_SLICE_L);
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Is this the right design pattern to implement such a synchronization to a external signal? Or are there other ways to implement such a task?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks in advance for any help.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;GH&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:39:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522414#M5050</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:39:24Z</dc:date>
    </item>
    <item>
      <title>Re: I2S Slave with SGPIO</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522415#M5051</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by xianghuiwang on Mon Dec 08 17:27:18 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, GH,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;You will want to set the CTRL_ENABLED before changing the count register.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Thanks!&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 16:39:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/I2S-Slave-with-SGPIO/m-p/522415#M5051</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T16:39:25Z</dc:date>
    </item>
  </channel>
</rss>

