<?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>MCUXpresso Config Tools中的主题 Pins Tool quirk: same configuration, different code is generated</title>
    <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Pins-Tool-quirk-same-configuration-different-code-is-generated/m-p/1312820#M1213</link>
    <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;I'm fiddling with Pins Tools (MCUXpresso 11.4.0) and example code "&lt;EM&gt;led_blinky&lt;/EM&gt;" from the LPC5526 SDK.&lt;/P&gt;&lt;P&gt;I added another GPIO output with "Invert" set to "disabled" as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielholala_0-1627136160567.png" style="width: 1135px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/150761i26DC6AA667A2CEF0/image-dimensions/1135x149?v=v2" width="1135" height="149" role="button" title="danielholala_0-1627136160567.png" alt="danielholala_0-1627136160567.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Pins Tool generates this code (relevant parts only):&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    gpio_pin_config_t LED_RED_config = {
        .pinDirection = kGPIO_DigitalOutput,
        .outputLogic = 0U
    };
    /* Initialize GPIO functionality on pin PIO0_7 (pin 6)  */
    GPIO_PinInit(BOARD_INITPINS_LED_RED_GPIO, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, &amp;amp;LED_RED_config);


    const uint32_t LED_RED = (/* Pin is configured as PIO0_7 */
                              IOCON_PIO_FUNC0 |
                              /* No addition pin function */
                              IOCON_PIO_MODE_INACT |
                              /* Standard mode, output slew rate control is enabled */
                              IOCON_PIO_SLEW_STANDARD |
                              /* Input function is not inverted */
                              IOCON_PIO_INV_DI |
                              /* Enables digital function */
                              IOCON_PIO_DIGITAL_EN |
                              /* Open drain is disabled */
                              IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN7 (coords: 6) is configured as PIO0_7 */
    IOCON_PinMuxSet(IOCON, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, LED_RED);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now&lt;/STRONG&gt; in Pins Tool I switch "Invert" to "Reset (Disabled)" (which should be the same configuration as before):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielholala_1-1627136315487.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/150762i8357583131E3A244/image-size/large?v=v2&amp;amp;px=999" role="button" title="danielholala_1-1627136315487.png" alt="danielholala_1-1627136315487.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Spot the difference? &lt;EM&gt;Disabled&lt;/EM&gt; is in &lt;EM&gt;italics&lt;/EM&gt; now.&lt;/P&gt;&lt;P&gt;The generated code, however, looks mighty different:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;IOCON-&amp;gt;PIO[0][7] =
        ((IOCON-&amp;gt;PIO[0][7] &amp;amp;
          /* Mask bits to zero which are setting */
          (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_MODE_MASK | IOCON_PIO_SLEW_MASK | IOCON_PIO_DIGIMODE_MASK | IOCON_PIO_OD_MASK)))

         /* Selects pin function.
          * : PORT07 (pin 6) is configured as PIO0_7. */
         | IOCON_PIO_FUNC(PIO0_7_FUNC_ALT0)

         /* Selects function mode (on-chip pull-up/pull-down resistor control).
          * : Inactive.
          * Inactive (no pull-down/pull-up resistor enabled). */
         | IOCON_PIO_MODE(PIO0_7_MODE_INACTIVE)

         /* Driver slew rate.
          * : Standard-mode, output slew rate is slower.
          * More outputs can be switched simultaneously. */
         | IOCON_PIO_SLEW(PIO0_7_SLEW_STANDARD)

         /* Select Digital mode.
          * : Enable Digital mode.
          * Digital input is enabled. */
         | IOCON_PIO_DIGIMODE(PIO0_7_DIGIMODE_DIGITAL)

         /* Controls open-drain mode.
          * : Normal.
          * Normal push-pull output. */
         | IOCON_PIO_OD(PIO0_7_OD_NORMAL));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder why this is.&lt;/P&gt;</description>
    <pubDate>Sat, 24 Jul 2021 14:27:00 GMT</pubDate>
    <dc:creator>danielholala</dc:creator>
    <dc:date>2021-07-24T14:27:00Z</dc:date>
    <item>
      <title>Pins Tool quirk: same configuration, different code is generated</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Pins-Tool-quirk-same-configuration-different-code-is-generated/m-p/1312820#M1213</link>
      <description>&lt;P&gt;Hi again,&lt;/P&gt;&lt;P&gt;I'm fiddling with Pins Tools (MCUXpresso 11.4.0) and example code "&lt;EM&gt;led_blinky&lt;/EM&gt;" from the LPC5526 SDK.&lt;/P&gt;&lt;P&gt;I added another GPIO output with "Invert" set to "disabled" as follows:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielholala_0-1627136160567.png" style="width: 1135px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/150761i26DC6AA667A2CEF0/image-dimensions/1135x149?v=v2" width="1135" height="149" role="button" title="danielholala_0-1627136160567.png" alt="danielholala_0-1627136160567.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Pins Tool generates this code (relevant parts only):&lt;/P&gt;&lt;LI-CODE lang="c"&gt;    gpio_pin_config_t LED_RED_config = {
        .pinDirection = kGPIO_DigitalOutput,
        .outputLogic = 0U
    };
    /* Initialize GPIO functionality on pin PIO0_7 (pin 6)  */
    GPIO_PinInit(BOARD_INITPINS_LED_RED_GPIO, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, &amp;amp;LED_RED_config);


    const uint32_t LED_RED = (/* Pin is configured as PIO0_7 */
                              IOCON_PIO_FUNC0 |
                              /* No addition pin function */
                              IOCON_PIO_MODE_INACT |
                              /* Standard mode, output slew rate control is enabled */
                              IOCON_PIO_SLEW_STANDARD |
                              /* Input function is not inverted */
                              IOCON_PIO_INV_DI |
                              /* Enables digital function */
                              IOCON_PIO_DIGITAL_EN |
                              /* Open drain is disabled */
                              IOCON_PIO_OPENDRAIN_DI);
    /* PORT0 PIN7 (coords: 6) is configured as PIO0_7 */
    IOCON_PinMuxSet(IOCON, BOARD_INITPINS_LED_RED_PORT, BOARD_INITPINS_LED_RED_PIN, LED_RED);&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;Now&lt;/STRONG&gt; in Pins Tool I switch "Invert" to "Reset (Disabled)" (which should be the same configuration as before):&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="danielholala_1-1627136315487.png" style="width: 999px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/150762i8357583131E3A244/image-size/large?v=v2&amp;amp;px=999" role="button" title="danielholala_1-1627136315487.png" alt="danielholala_1-1627136315487.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Spot the difference? &lt;EM&gt;Disabled&lt;/EM&gt; is in &lt;EM&gt;italics&lt;/EM&gt; now.&lt;/P&gt;&lt;P&gt;The generated code, however, looks mighty different:&lt;/P&gt;&lt;LI-CODE lang="c"&gt;IOCON-&amp;gt;PIO[0][7] =
        ((IOCON-&amp;gt;PIO[0][7] &amp;amp;
          /* Mask bits to zero which are setting */
          (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_MODE_MASK | IOCON_PIO_SLEW_MASK | IOCON_PIO_DIGIMODE_MASK | IOCON_PIO_OD_MASK)))

         /* Selects pin function.
          * : PORT07 (pin 6) is configured as PIO0_7. */
         | IOCON_PIO_FUNC(PIO0_7_FUNC_ALT0)

         /* Selects function mode (on-chip pull-up/pull-down resistor control).
          * : Inactive.
          * Inactive (no pull-down/pull-up resistor enabled). */
         | IOCON_PIO_MODE(PIO0_7_MODE_INACTIVE)

         /* Driver slew rate.
          * : Standard-mode, output slew rate is slower.
          * More outputs can be switched simultaneously. */
         | IOCON_PIO_SLEW(PIO0_7_SLEW_STANDARD)

         /* Select Digital mode.
          * : Enable Digital mode.
          * Digital input is enabled. */
         | IOCON_PIO_DIGIMODE(PIO0_7_DIGIMODE_DIGITAL)

         /* Controls open-drain mode.
          * : Normal.
          * Normal push-pull output. */
         | IOCON_PIO_OD(PIO0_7_OD_NORMAL));&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I wonder why this is.&lt;/P&gt;</description>
      <pubDate>Sat, 24 Jul 2021 14:27:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Pins-Tool-quirk-same-configuration-different-code-is-generated/m-p/1312820#M1213</guid>
      <dc:creator>danielholala</dc:creator>
      <dc:date>2021-07-24T14:27:00Z</dc:date>
    </item>
    <item>
      <title>Re: Pins Tool quirk: same configuration, different code is generated</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Pins-Tool-quirk-same-configuration-different-code-is-generated/m-p/1313030#M1214</link>
      <description>&lt;P&gt;Hi Daniel,&lt;/P&gt;
&lt;P&gt;"Reset (Disabled)" means that configuration relies on after-reset value and does not affect the after reset configuration. This feature is not supported by "IOCON_PinMuxSet" function (this function always sets all bits), and so the generated code uses direct write to configuration register instead using SDK API.&lt;/P&gt;
&lt;P&gt;Hope this helps&lt;/P&gt;
&lt;P&gt;Regards,Marek&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Mon, 26 Jul 2021 06:36:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Pins-Tool-quirk-same-configuration-different-code-is-generated/m-p/1313030#M1214</guid>
      <dc:creator>marek-trmac</dc:creator>
      <dc:date>2021-07-26T06:36:42Z</dc:date>
    </item>
  </channel>
</rss>

