<?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 Helping in I2C SDK Driver + GPIO Interrupt in Kinetis Software Development Kit</title>
    <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Helping-in-I2C-SDK-Driver-GPIO-Interrupt/m-p/408467#M1783</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a driver for the freescale mma8451q accelerometer, using the KSDK + KDS 3.0.0 + Processor Expert.&lt;/P&gt;&lt;P&gt;For test, was made a function calling in main.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70454_70454.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120578i37A9435C46DF4458/image-size/large?v=v2&amp;amp;px=999" role="button" title="70454_70454.png" alt="70454_70454.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53020i9AE6A3E551519F45/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The function waits a logic 1 in PTA13 to run. There are two options to read the samples from accelerometer:&lt;/P&gt;&lt;P&gt;pooling e interrupt.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, was tested the pooling mode, where the function constantly reads the samples from accelerometer, setting a LED from LED RGB, corresponding to the axis, using this loop:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70456_70456.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120579i7CFB72D2850D83E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="70456_70456.png" alt="70456_70456.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53162i4AF9818C36476C6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The firmware works right and the first test was passed.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second test was used the interrupt mode from accelerometer. When a sample is taken from accelerometer, a interrupt, active LOW, is generated in the pin PTA14.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncomment this loop, to active interrupt:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70459_70459.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120580iEDF089CDE98D9E1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="70459_70459.png" alt="70459_70459.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53249iC11DC65787E46AD3/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The loop used for pooling now is empty, and is used the ISR from PTA14 interrupt to read the samples.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70457_70457.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120581i20E239C23B5D9EB8/image-size/large?v=v2&amp;amp;px=999" role="button" title="70457_70457.png" alt="70457_70457.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53207iAA34A8D5C502F453/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But, when try to read the samples, the accel_GetXYZ function gets stucked in the I2C_DRV_MasterReceive function when try send the address of the slave.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70458_70458.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120582i8AE9502792BA10AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="70458_70458.png" alt="70458_70458.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53248iF732F4F8FE47E32A/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This occurs only inside the ISR!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is attached (the comments are in portuguese. Sorry!!!)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-339140"&gt;mma8451.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 31 Aug 2015 23:25:29 GMT</pubDate>
    <dc:creator>matheuspinto</dc:creator>
    <dc:date>2015-08-31T23:25:29Z</dc:date>
    <item>
      <title>Helping in I2C SDK Driver + GPIO Interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Helping-in-I2C-SDK-Driver-GPIO-Interrupt/m-p/408467#M1783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am trying to do a driver for the freescale mma8451q accelerometer, using the KSDK + KDS 3.0.0 + Processor Expert.&lt;/P&gt;&lt;P&gt;For test, was made a function calling in main.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70454_70454.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120578i37A9435C46DF4458/image-size/large?v=v2&amp;amp;px=999" role="button" title="70454_70454.png" alt="70454_70454.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53020i9AE6A3E551519F45/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The function waits a logic 1 in PTA13 to run. There are two options to read the samples from accelerometer:&lt;/P&gt;&lt;P&gt;pooling e interrupt.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;First, was tested the pooling mode, where the function constantly reads the samples from accelerometer, setting a LED from LED RGB, corresponding to the axis, using this loop:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70456_70456.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120579i7CFB72D2850D83E4/image-size/large?v=v2&amp;amp;px=999" role="button" title="70456_70456.png" alt="70456_70456.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53162i4AF9818C36476C6C/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;The firmware works right and the first test was passed.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;In the second test was used the interrupt mode from accelerometer. When a sample is taken from accelerometer, a interrupt, active LOW, is generated in the pin PTA14.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Uncomment this loop, to active interrupt:&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70459_70459.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120580iEDF089CDE98D9E1A/image-size/large?v=v2&amp;amp;px=999" role="button" title="70459_70459.png" alt="70459_70459.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53249iC11DC65787E46AD3/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The loop used for pooling now is empty, and is used the ISR from PTA14 interrupt to read the samples.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70457_70457.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120581i20E239C23B5D9EB8/image-size/large?v=v2&amp;amp;px=999" role="button" title="70457_70457.png" alt="70457_70457.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53207iAA34A8D5C502F453/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;But, when try to read the samples, the accel_GetXYZ function gets stucked in the I2C_DRV_MasterReceive function when try send the address of the slave.&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="70458_70458.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/120582i8AE9502792BA10AA/image-size/large?v=v2&amp;amp;px=999" role="button" title="70458_70458.png" alt="70458_70458.png" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="kkk.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/53248iF732F4F8FE47E32A/image-size/large?v=v2&amp;amp;px=999" role="button" title="kkk.png" alt="kkk.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This occurs only inside the ISR!&lt;/P&gt;&lt;P style="min- padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The project is attached (the comments are in portuguese. Sorry!!!)&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Original Attachment has been moved to: &lt;A _jive_internal="true" href="https://community.nxp.com/docs/DOC-339140"&gt;mma8451.rar&lt;/A&gt;&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 31 Aug 2015 23:25:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Helping-in-I2C-SDK-Driver-GPIO-Interrupt/m-p/408467#M1783</guid>
      <dc:creator>matheuspinto</dc:creator>
      <dc:date>2015-08-31T23:25:29Z</dc:date>
    </item>
    <item>
      <title>Re: Helping in I2C SDK Driver + GPIO Interrupt</title>
      <link>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Helping-in-I2C-SDK-Driver-GPIO-Interrupt/m-p/408468#M1784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Matheus Pinto:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You must be running in the same problem of the next post:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/message/522941"&gt;Re: I2C function failed when called from ISR&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not recommended to call Driver APIs requiring interrupt handling from inside an ISR. Instead you can use a flag to indicate the code that the interrupt occured, so you can trigger the accelerometer reads.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the short term try increasing the priority of the &lt;STRONG&gt;I2C&lt;/STRONG&gt; interrupts and see if that helps.&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Regards!&lt;BR /&gt;Jorge Gonzalez&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>Thu, 03 Sep 2015 02:55:18 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Software-Development-Kit/Helping-in-I2C-SDK-Driver-GPIO-Interrupt/m-p/408468#M1784</guid>
      <dc:creator>Jorge_Gonzalez</dc:creator>
      <dc:date>2015-09-03T02:55:18Z</dc:date>
    </item>
  </channel>
</rss>

