<?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>LPC MicrocontrollersのトピックLPC4370 SGPIO one-shot madness.</title>
    <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572486#M18596</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by David Lee on Fri Jun 06 13:53:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I've configured a few slices to generate a custom serial interface. It has typical stuff like CHIP_SELECT, SERIAL_CLOCK, DATA, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It runs in one-shot mode, sending a data payload of 24 bits. The single transmission is controlled according to the documentation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in the user manual (UM10503.PDF) Sec. 19.6.17.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It worked solid as a rock during testing with a simple data pattern like 0x00AA00AA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I decided to test it by sending random data payloads and I noticed on my scope that infrequently, the slices fail&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to stop after 1 "cycle". That is to say, I see two transmission sequences back to back. Yuck! The failure is data dependent!!!???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am starting the slices like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;// Start SGPIO operation by enabling slice clocks.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = m_controlMask;&lt;BR /&gt;//We only want 1 countdown cycle (1 transmission) so this will stop when POS reaches zero.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = m_controlMask;&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the recommended process from Sec. 19.6.17.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In desperation, I tried reversing the order, in contradiction to Sec. 19.6.17:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;//Try setting CTRL_DISABLE BEFORE CTRL_ENABLE. This contradicts 19.6.17 in user manual!&lt;BR /&gt;//We only want 1 countdown cycle (1 transmission) so this will stop when POS reaches zero.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = m_controlMask;&lt;BR /&gt;// Start SGPIO operation by enabling slice clocks.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = m_controlMask;&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is rock solid transmission with NO observable anomalous transmissions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would be grateful for help with this issue. I really, really do not like getting code to work by swapping the order&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;of commands willy nilly. Especially when it directly contradicts the documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A little help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note. There's a typo in Sec 19.6.17:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;this register should always be cleared. If&lt;BR /&gt;only on POSi countdown is needed&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;should read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;this register should always be cleared. If&lt;BR /&gt;only one POSi countdown is needed&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 18:56:24 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T18:56:24Z</dc:date>
    <item>
      <title>LPC4370 SGPIO one-shot madness.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572486#M18596</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by David Lee on Fri Jun 06 13:53:29 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;I've configured a few slices to generate a custom serial interface. It has typical stuff like CHIP_SELECT, SERIAL_CLOCK, DATA, etc.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;It runs in one-shot mode, sending a data payload of 24 bits. The single transmission is controlled according to the documentation&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;in the user manual (UM10503.PDF) Sec. 19.6.17.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;It worked solid as a rock during testing with a simple data pattern like 0x00AA00AA.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;So I decided to test it by sending random data payloads and I noticed on my scope that infrequently, the slices fail&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;to stop after 1 "cycle". That is to say, I see two transmission sequences back to back. Yuck! The failure is data dependent!!!???&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I am starting the slices like this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;// Start SGPIO operation by enabling slice clocks.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = m_controlMask;&lt;BR /&gt;//We only want 1 countdown cycle (1 transmission) so this will stop when POS reaches zero.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = m_controlMask;&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is the recommended process from Sec. 19.6.17.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;In desperation, I tried reversing the order, in contradiction to Sec. 19.6.17:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;//Try setting CTRL_DISABLE BEFORE CTRL_ENABLE. This contradicts 19.6.17 in user manual!&lt;BR /&gt;//We only want 1 countdown cycle (1 transmission) so this will stop when POS reaches zero.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = m_controlMask;&lt;BR /&gt;// Start SGPIO operation by enabling slice clocks.&lt;BR /&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = m_controlMask;&lt;BR /&gt;&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;The result is rock solid transmission with NO observable anomalous transmissions.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I would be grateful for help with this issue. I really, really do not like getting code to work by swapping the order&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;of commands willy nilly. Especially when it directly contradicts the documentation.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;A little help?&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Note. There's a typo in Sec 19.6.17:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;this register should always be cleared. If&lt;BR /&gt;only on POSi countdown is needed&lt;/SPAN&gt;&lt;HR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;should read:&lt;/SPAN&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;this register should always be cleared. If&lt;BR /&gt;only one POSi countdown is needed&lt;/SPAN&gt;&lt;HR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:56:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572486#M18596</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 SGPIO one-shot madness.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572487#M18597</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 Fri Jun 06 18:23:05 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi, David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Your observation makes sense if you want to do single shot. We will do some more validation and update the user manual in this regard.&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 18:56:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572487#M18597</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:56:24Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 SGPIO one-shot madness.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572488#M18598</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by JohnR on Sat Jun 07 05:44:54 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi David,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;More or less by chance some time ago, I came up with the same solution as yours.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Thus in my SGPIO_POS_IRQHandler():&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt; SGPIO_POS_IRQHandler()&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;{&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTR_STATUS_1 = 1&amp;lt;&amp;lt;D;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;while(LPC_SGPIO-&amp;gt;STATUS_1 &amp;amp; 1&amp;lt;&amp;lt;D);// wait for status to clear&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = 0; &lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LPC_SGPIO-&amp;gt;CTRL_DISABLED = 0;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// &amp;gt;REG[H chip select&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;REG[H] = 0x20001; &lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;// REG[N] data&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;REG[N]&amp;nbsp; =&amp;nbsp;&amp;nbsp;&amp;nbsp; ;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;......................................&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;.......................................&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;SET_EN_1 =&amp;nbsp; (1L &amp;lt;&amp;lt;&amp;nbsp; D);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED =&amp;nbsp; (1L &amp;lt;&amp;lt;&amp;nbsp; H) | (1L &amp;lt;&amp;lt;&amp;nbsp; D) | (1L &amp;lt;&amp;lt;&amp;nbsp; N);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = (1L &amp;lt;&amp;lt;&amp;nbsp; H) | (1L &amp;lt;&amp;lt;&amp;nbsp; D) | (1L &amp;lt;&amp;lt;&amp;nbsp; N);&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;}&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I have never understood why both registers need to be updated and in this order. Maybe NXP could provide the reason.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;John.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:56:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572488#M18598</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:56:25Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 SGPIO one-shot madness.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572489#M18599</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by DPeters on Sat Jun 07 22:44:19 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The documentation was confusing for me too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;If the recommended order is followed, there is a chance the CPU will get interrupted by IRQ, or if a pre-emptive OS task swap happens between:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTRL_ENABLED = m_controlMask;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;and:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;LPC_SGPIO-&amp;gt;CTRL_DISABLED = m_controlMask;&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then, if the SGPIO is clocking with any speed at all, POS reaches zero before the second instruction is executed while the CPU is off doing something else.&amp;nbsp; I think this is what David was experiencing with the double transmissions.&amp;nbsp; To me, it makes more sense to reverse the instructions, despite user manual explicitly stating in UM Rev 1.8 sec 19.6.17, Slice count disable register :&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;SPAN style="color: #0000ff;"&gt;&lt;STRONG&gt;Quote: &lt;/STRONG&gt;&lt;BR /&gt;When starting COUNTi (by setting CTRL_ENi), this register should always be cleared. If&lt;BR /&gt;only on POSi countdown is needed (when only one slice should be processed), then [CTRL_DISi]&lt;BR /&gt;register should be set &lt;STRONG&gt;after &lt;/STRONG&gt;COUNTi is started with register CTRL_ENi.&lt;/SPAN&gt;&lt;HR /&gt;&lt;SPAN&gt; (bold emphasis and [ ] mine)&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;But maybe there is some reason for the recommended order that has to do with internal workings of the peripheral.&amp;nbsp; But it would be very beneficial for our current project to get confirmation from NXP that reversing the instruction order is OK.&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:56:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572489#M18599</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:56:26Z</dc:date>
    </item>
    <item>
      <title>Re: LPC4370 SGPIO one-shot madness.</title>
      <link>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572490#M18600</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by David Lee on Mon Jun 09 06:52:53 MST 2014&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;JohnR,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Right! That reminds me, I may have swapped the recommended order of the register setups at the initialization stage too.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'll look at my code and follow up. Thanks for the reply!&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;DPeters,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Good point. The re-transmissions I'm seeing are not data-dependent (that would be evil) but are, as you imply, timing dependent.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Nice insight. I will play with the timing of my loop, and perhaps disable interrupts to verify.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;xianghuiwang,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt; Thank you for the reply. Errors in the User Manual are inevitable. But when all work together, as in this forum, we produce&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;better tools, products, and a better community. Nicely done, sir.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Cheers,&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;David&lt;/SPAN&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 18:56:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPC-Microcontrollers/LPC4370-SGPIO-one-shot-madness/m-p/572490#M18600</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T18:56:26Z</dc:date>
    </item>
  </channel>
</rss>

