<?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: PIT0 Timer Module, and GPIO Direct Acess in MQX Software Solutions</title>
    <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608766#M16788</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-content-finding="Community" data-objectid="219553" data-objecttype="3" href="https://community.nxp.com/people/broccolee"&gt;Dao Yan Lim&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me explain it more clearly.&lt;/P&gt;&lt;P&gt;1).&amp;nbsp; The system Tick Timer's and PIT (Periodic Interrupt Timer), they are different . I don't think they will have an effect on each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Directly access should work in MQX, I suggest you debug your code, and check the register's real value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3).&amp;nbsp; lwgpio_set_value is from a light weight GPIO driver, and &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;ioctl(port_file2, GPIO_IOCTL_WRITE_LOG1, NULL )&lt;/SPAN&gt; is from an old version GPIO driver. which is no longer supported.&amp;nbsp;&amp;nbsp; LWGPIO is better, it can be used before IO subsystem of MQX RTOS is initialized. LWGPIO driver is designed as a per-pin driver, meaning that an LWGPIO API call handles only one pin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 08 Mar 2017 05:43:09 GMT</pubDate>
    <dc:creator>danielchen</dc:creator>
    <dc:date>2017-03-08T05:43:09Z</dc:date>
    <item>
      <title>PIT0 Timer Module, and GPIO Direct Acess</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608763#M16785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;Hi,&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;I am using TWR-K60N512 with PK60DN512Z VMD10 chip, and Codewarrior 10.5 IDE with MQX&amp;nbsp;3.8. I have three&amp;nbsp;questions:&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;1) Does the MQX 3.8 kernel still use PIT0 as tick reference? I'm currently using it to generate a pulse train and it works fine, just curious what effects it might have if it still is actually still being used as tick reference simultaneously.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;2) Why doesn't simple GPIO direct access work anymore in MQX? The code is shown below, which works in a baremetal project.&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;3) Any drawback or advantages in using MQX I/O in interrupt? For example, I'm able to write high or low in an interrupt using 'ioctl(port_file2, GPIO_IOCTL_WRITE_LOG1, NULL );' since GPIO direct access doesn't work...&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;SIM_SCGC5 |= SIM_SCGC5_PORTA_MASK | SIM_SCGC5_PORTB_MASK | SIM_SCGC5_PORTC_MASK | SIM_SCGC5_PORTE_MASK;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;PORTC_PCR18 |= PORT_PCR_MUX(1);&amp;nbsp;&lt;BR /&gt; GPIOC_PDDR |= GPIO_PIN(18);&lt;BR /&gt; GPIOC_PSOR |= GPIO_PIN(18);&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;GPIOC_PTOR |= GPIO_PDOR_PDO(GPIO_PIN(18));&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;/P&gt;&lt;P style="color: #51626f; background-color: #ffffff; border: 0px; font-size: 14px;"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff; border: 0px; font-weight: inherit; font-size: 14px;"&gt;Thanks.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 28 Feb 2017 19:47:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608763#M16785</guid>
      <dc:creator>broccolee</dc:creator>
      <dc:date>2017-02-28T19:47:57Z</dc:date>
    </item>
    <item>
      <title>Re: PIT0 Timer Module, and GPIO Direct Acess</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608764#M16786</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-content-finding="Community" data-userid="219553" data-username="broccolee" href="https://community.nxp.com/people/broccolee"&gt;Dao Yan Lim&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) MQX requires the use of the Interrupt 0x0f SysTick Interrupt to generate ticks for MQX, the clock source is processor clock; &lt;/P&gt;&lt;P&gt;while PIT0 use 0x54 to generate ticks. please see vectors.c&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;DEFAULT_VECTOR,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* 0x0F&amp;nbsp; 0x0000003C&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp; ivINT_SysTick&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&amp;nbsp;DEFAULT_VECTOR,&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* 0x54&amp;nbsp; 0x00000150&amp;nbsp;&amp;nbsp; -&amp;nbsp;&amp;nbsp; ivINT_PIT0&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; */&lt;/P&gt;&lt;P&gt;......&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2)&amp;nbsp; we don't recommend our customers access GPIO directly,because MQX RTOS provides a pleasant and effective user interface.&amp;nbsp; The purpose is to hide details of hardware and provides a high level functions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) We have API to do that,&amp;nbsp; please refer to the gpio demo for how to use GPIO, it is under the installation folder of MQX.&lt;/P&gt;&lt;P&gt;Freescale_MQX_4_2\mqx\examples\gpio&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;For example&lt;/P&gt;&lt;P&gt;lwgpio_set_attribute(&amp;amp;btn1, LWGPIO_ATTR_PULL_DOWN, LWGPIO_AVAL_ENABLE)&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Have a great day&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button . Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2017 15:29:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608764#M16786</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2017-03-07T15:29:40Z</dc:date>
    </item>
    <item>
      <title>Re: PIT0 Timer Module, and GPIO Direct Acess</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608765#M16787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks for your answers. I should have been more clear with my questions.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;1) I should have also asked does it mean we must not modify PIT0 and that we cannot use PIT0 for other applications? At the time I posted this question I was still able to use PIT0 to generate pulse train in interrupt. But now it just wouldn't work all of a sudden, nothing's changed in the code either, I'm puzzled by the inconsistency...&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Now you mention that you don't recommend using direct GPIO access, is that an implication that technically it works, but I just didn't set things up correctly? Or simply it doesn't work?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3) I should have been more clear on this question too. I'm well aware of the lwgpio api and I am also able to use lwgpio in the interrupt to generate pulse train. So my question now is, what is the difference between using lwgpio and ioctl to toggle a gpio in interrupt for example: using "lwgpio_set_value(&amp;amp;pit, LWGPIO_VALUE_HIGH)" vs "&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;ioctl(port_file2, GPIO_IOCTL_WRITE_LOG1, NULL )"&lt;/SPAN&gt;? Any advantages? Disadvantages? Which is better?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 07 Mar 2017 19:31:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608765#M16787</guid>
      <dc:creator>broccolee</dc:creator>
      <dc:date>2017-03-07T19:31:38Z</dc:date>
    </item>
    <item>
      <title>Re: PIT0 Timer Module, and GPIO Direct Acess</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608766#M16788</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi &lt;A _jive_internal="true" data-containerid="-1" data-containertype="-1" data-content-finding="Community" data-objectid="219553" data-objecttype="3" href="https://community.nxp.com/people/broccolee"&gt;Dao Yan Lim&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Let me explain it more clearly.&lt;/P&gt;&lt;P&gt;1).&amp;nbsp; The system Tick Timer's and PIT (Periodic Interrupt Timer), they are different . I don't think they will have an effect on each other.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;2) Directly access should work in MQX, I suggest you debug your code, and check the register's real value .&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;3).&amp;nbsp; lwgpio_set_value is from a light weight GPIO driver, and &lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;ioctl(port_file2, GPIO_IOCTL_WRITE_LOG1, NULL )&lt;/SPAN&gt; is from an old version GPIO driver. which is no longer supported.&amp;nbsp;&amp;nbsp; LWGPIO is better, it can be used before IO subsystem of MQX RTOS is initialized. LWGPIO driver is designed as a per-pin driver, meaning that an LWGPIO API call handles only one pin.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 05:43:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608766#M16788</guid>
      <dc:creator>danielchen</dc:creator>
      <dc:date>2017-03-08T05:43:09Z</dc:date>
    </item>
    <item>
      <title>Re: PIT0 Timer Module, and GPIO Direct Acess</title>
      <link>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608767#M16789</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I created a new MQX 3.8 project to test if I can use all PIT modules in interrupt to adjust LED brightness. I used lwgpio to toggle the pin state instead of ioctl. I can only use at most two at the same time, it doesn't matter what the combination of two modules is. Any idea why I can't use more than two PIT modules? I attached my source code for your reference. It would be great if you could recreate this on the same hardware I'm using, which is the ancient prototype version...&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 08 Mar 2017 21:24:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MQX-Software-Solutions/PIT0-Timer-Module-and-GPIO-Direct-Acess/m-p/608767#M16789</guid>
      <dc:creator>broccolee</dc:creator>
      <dc:date>2017-03-08T21:24:19Z</dc:date>
    </item>
  </channel>
</rss>

