<?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 iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS) in i.MX Processors</title>
    <link>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814921#M125551</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hit on an issue with the gpio_imx driver shipped with the FreeRTOS BSP v1.0.1 (FreeRTOS_BSP_1.0.1_iMX6SX\platform\drivers\src\gpio_imx.c). In the beggining of the GPIO_Init() function, GPIO_IMR and GPIO_EDGE_SEL registers are cleared:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Register reset to default value */
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_IMR_REG(base) = 0;
&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIO_EDGE_SEL_REG(base) = 0;&lt;/PRE&gt;&lt;P&gt;Anyway, the function serves for initialization of a single GPIO pin. When called to reinitialize a pin configuration at runtime, the settings of IMR and EDGE_SEL registers are lost for all pins on that port. I believe this is a bug and the aforementioned code should be masked to only affect a single bit, as follows:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Register reset to default value */
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_IMR_REG(base) &amp;amp;= ~(1U &amp;lt;&amp;lt; pin);
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_EDGE_SEL_REG(base) &amp;amp;= ~(1U &amp;lt;&amp;lt; pin);&lt;/PRE&gt;&lt;P&gt;Can someone please confirm this is a correct fix? Or would that cause any side effects?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 25 Jun 2018 07:57:00 GMT</pubDate>
    <dc:creator>kubiznak_petr</dc:creator>
    <dc:date>2018-06-25T07:57:00Z</dc:date>
    <item>
      <title>iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814921#M125551</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I hit on an issue with the gpio_imx driver shipped with the FreeRTOS BSP v1.0.1 (FreeRTOS_BSP_1.0.1_iMX6SX\platform\drivers\src\gpio_imx.c). In the beggining of the GPIO_Init() function, GPIO_IMR and GPIO_EDGE_SEL registers are cleared:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Register reset to default value */
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_IMR_REG(base) = 0;
&amp;nbsp;&amp;nbsp; &amp;nbsp;GPIO_EDGE_SEL_REG(base) = 0;&lt;/PRE&gt;&lt;P&gt;Anyway, the function serves for initialization of a single GPIO pin. When called to reinitialize a pin configuration at runtime, the settings of IMR and EDGE_SEL registers are lost for all pins on that port. I believe this is a bug and the aforementioned code should be masked to only affect a single bit, as follows:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* Register reset to default value */
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_IMR_REG(base) &amp;amp;= ~(1U &amp;lt;&amp;lt; pin);
&amp;nbsp;&amp;nbsp;&amp;nbsp; GPIO_EDGE_SEL_REG(base) &amp;amp;= ~(1U &amp;lt;&amp;lt; pin);&lt;/PRE&gt;&lt;P&gt;Can someone please confirm this is a correct fix? Or would that cause any side effects?&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 25 Jun 2018 07:57:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814921#M125551</guid>
      <dc:creator>kubiznak_petr</dc:creator>
      <dc:date>2018-06-25T07:57:00Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814922#M125552</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Petr&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;fix seems as quite sensible, I do not think it would cause any side effects.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Best regards&lt;BR /&gt;igor&lt;BR /&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>Mon, 25 Jun 2018 23:37:20 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814922#M125552</guid>
      <dc:creator>igorpadykov</dc:creator>
      <dc:date>2018-06-25T23:37:20Z</dc:date>
    </item>
    <item>
      <title>Re: iMX6SX: GPIO_Init() resets IMR of all pins (gpio_imx driver @FreeRTOS)</title>
      <link>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814923#M125553</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Great, thank you Igor.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 26 Jun 2018 06:13:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/i-MX-Processors/iMX6SX-GPIO-Init-resets-IMR-of-all-pins-gpio-imx-driver-FreeRTOS/m-p/814923#M125553</guid>
      <dc:creator>kubiznak_petr</dc:creator>
      <dc:date>2018-06-26T06:13:35Z</dc:date>
    </item>
  </channel>
</rss>

