<?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 lwgpio interrupt restrictions? in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250136#M7190</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having trouble with the lwgpo and interrupts. Should I be able to use lwgpio_toggle_value() within an interrupt? If I toggle one pin in the int, and toggle a different pin in the foreground they seem to conflict. Do I really need to disable interrupts round lwgpio function calls?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are no references made to this in either the io user guide, or the mqx ug. For the life of me I can't find a definitive list of components I can safely use in the background, is there one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 03 Apr 2013 09:41:14 GMT</pubDate>
    <dc:creator>billnd</dc:creator>
    <dc:date>2013-04-03T09:41:14Z</dc:date>
    <item>
      <title>lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250136#M7190</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I'm having trouble with the lwgpo and interrupts. Should I be able to use lwgpio_toggle_value() within an interrupt? If I toggle one pin in the int, and toggle a different pin in the foreground they seem to conflict. Do I really need to disable interrupts round lwgpio function calls?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;There are no references made to this in either the io user guide, or the mqx ug. For the life of me I can't find a definitive list of components I can safely use in the background, is there one?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks in advance&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 09:41:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250136#M7190</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-03T09:41:14Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250137#M7191</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello billnd,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;there shouldn't be any problem to use lwpgio inside ISR. Can you describe it more what you do, a code snippet would be appreciated.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Toggle value only writes into PTOR register inside GPIO module ( 0 - no change, 1 - the inverse of its existing logic state)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1364987151470969" jivemacro_uid="_1364987151470969" modifiedtitle="true"&gt;
&lt;P&gt;handle-&amp;gt;gpio_ptr-&amp;gt;PTOR = handle-&amp;gt;pinmask;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;0xc0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 11:08:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250137#M7191</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-04-03T11:08:18Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250138#M7192</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;OK, my mistake. Its not quite what I thought, but still causing a problem. I have the PDB firing the ADC, which in turn generates a DMA, which finally generates an interrupt.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is constantly running in the foreground to indicate the activity of the ADC...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13650122183526702" jivemacro_uid="_13650122183526702"&gt;
&lt;P&gt;while( true ){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _sched_yield();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; while( ( ADC0_SC2 &amp;amp; ADC_SC2_ADACT_MASK ) ){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwgpio_set_value( &amp;amp;LED2, LWGPIO_VALUE_HIGH );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; }&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwgpio_set_value( &amp;amp;LED2, LWGPIO_VALUE_LOW );&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;While this interrupt should just show the DMA int status.&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_1365012213234667" jivemacro_uid="_1365012213234667"&gt;
&lt;P&gt;void int_dmaX(void *pin)&lt;/P&gt;
&lt;P&gt;{&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; DMA_CINT = DMA_CINT_CINT( X );&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwgpio_toggle_value( &amp;amp;LED1 );&lt;/P&gt;
&lt;P&gt;}&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;What I get though is the LED1 status altering almost randomly. Its something to do with locking up the task and using lwgpio while waiting for the ADC activity to finish. If I use (next bit of code) it works as expected. It also works as expected if I remove the lwgpio call from the while loop.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13650122259573145" jivemacro_uid="_13650122259573145"&gt;
&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;while&lt;/SPAN&gt;( ( ADC0_SC2 &amp;amp; ADC_SC2_ADACT_MASK ) ){&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; _sched_yield();&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; lwgpio_set_value( &amp;amp;LED2, LWGPIO_VALUE_HIGH );&lt;/P&gt;
&lt;P&gt;}&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="mce_paste_marker"&gt;Cheers for your help so far.&lt;BR /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 13:01:01 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250138#M7192</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-03T13:01:01Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250139#M7193</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello billnd,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;why don't you change you approach to :&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE __default_attr="c++" __jive_macro_name="code" class="jive_text_macro jive_macro_code _jivemacro_uid_13650119918221915" jivemacro_uid="_13650119918221915"&gt;
&lt;P&gt;LED2_HIGH;&lt;/P&gt;
&lt;P&gt;while(conversion_ongoing);&lt;/P&gt;
&lt;P&gt;LED2_LOW;&lt;/P&gt;
&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;By the way, lwgpio_set_value accesses PDOR register which in your case happens also in DMA ISR. Because PTOR changes PDOR register.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;0xc0170&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 18:03:11 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250139#M7193</guid>
      <dc:creator>c0170</dc:creator>
      <dc:date>2013-04-03T18:03:11Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250140#M7194</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Martin,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for the suggestion, but I don't really think that is getting to the heart of the problem. In fact really all that method is doing is reducing the chance of the problem, rather than curing it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Can I just check that I've understood you correctly. You are saying that set_value and toggle_value should not be done in the foreground and the isr because they can cause this sort of unexpected result? Is this in the documentation somewhere, how do I know which functions are safe to use in ISR's? Do I really have to read every line of MQX source code and work it out for myself?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Sorry, not griping at you, just frustrated with MQX!!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 03 Apr 2013 22:47:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250140#M7194</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-03T22:47:00Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250141#M7195</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bill,&lt;/P&gt;&lt;P&gt;I don't think Martin is saying not to do it but there are many ways to skin a cat and some better than others but at end of day the solution that you like is best.&lt;/P&gt;&lt;P&gt;My $0.02 is you should use synchronization methods to do this rather than polling.&amp;nbsp; I'd recomment using lwevent to set flag(s) in the interrupt and clear it in the task(s).&lt;/P&gt;&lt;P&gt;I'm just guessing that you have other tasks in the system that must run at higher priority which mean you could miss seeing the ADC conversion active bit setting.&lt;/P&gt;&lt;P&gt;Another factor is how fast are you triggering a ADC sample?&amp;nbsp; Just question to better understand the situation.&lt;/P&gt;&lt;P&gt;I still think synchronization is the way to go to notify a task that the ADC converstion is complete.&amp;nbsp; But if you are just toggling an LED why bother having the task mess with the LED?&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 13:38:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250141#M7195</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-04-04T13:38:21Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250142#M7196</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I agree, there are more elegant ways to to achieve the LED function. In reality, it was just a bit of hacked together code to prove to myself that the DMA was being generated at the correct intervals. Adding a whole task in, just to test that, seemed a bit long winded. I've learned my lesson now. I'll include as little as possible in the ISR routines, even my prototype ones.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'd still like a list of MQX functions that are safe to use in INTs. The UG list some functions that should not be used, for mostly obvious reasons, perhaps there should be a list of functions that are OK to use?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers for your help.&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:17:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250142#M7196</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-04T14:17:33Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250143#M7197</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Bill,&lt;/P&gt;&lt;P&gt;Rule ot Thumb in an ISR is not to call any blocking function.&lt;/P&gt;&lt;P&gt;The MQXUG.pdf (C:\Freescale\Freescale_MQX_4_0\doc\mqx) Section 3.9 Handling Interrupts and Exceptions does have list of MQX function that are OK to use in Section 3.9.3.1.&lt;/P&gt;&lt;P&gt;Section 3.9.3.2 has a list of MQX functions not to call.&lt;/P&gt;&lt;P&gt;Hope this helps but your experimentation is really good.&amp;nbsp; Glad you are doing that as that is often my process to answer these questions.&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;David&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 Apr 2013 14:44:13 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250143#M7197</guid>
      <dc:creator>DavidS</dc:creator>
      <dc:date>2013-04-04T14:44:13Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250144#M7198</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We must be looking at different documents. Mine is MQXUG, rev 6. 12/2012. Section 3.9.3.1 has a list of functions that the ISR "cannot" call, and 3.9.3.2 has a list that ISR's "should not" call. I can't find a list of functions that are OK to call.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3.9.3.1 Functions That the ISR Cannot Call&lt;/P&gt;&lt;P&gt;3.9.3.2 Functions That ISRs Should Not Call&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I think you must have a more up to date document than I have access to. Just in case, I downloaded the latest MQX 4.0 from Freescale and installed it on my laptop, still comes up with the rev 6 document.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 09:10:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250144#M7198</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-08T09:10:46Z</dc:date>
    </item>
    <item>
      <title>Re: lwgpio interrupt restrictions?</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250145#M7199</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Ah, just seen in section 3.9.2, it says that these functions can be used...&lt;/P&gt;&lt;P&gt;_event_set()&lt;/P&gt;&lt;P&gt;_lwsem_post()&lt;/P&gt;&lt;P&gt;_sem_post()&lt;/P&gt;&lt;P&gt;_msgq_send family&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Cheers&lt;/P&gt;&lt;P&gt;Bill&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 08 Apr 2013 13:36:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/lwgpio-interrupt-restrictions/m-p/250145#M7199</guid>
      <dc:creator>billnd</dc:creator>
      <dc:date>2013-04-08T13:36:44Z</dc:date>
    </item>
  </channel>
</rss>

