<?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: Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted. in MCUXpresso Config Tools</title>
    <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942020#M760</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="316743" data-username="frank@esielectronic.com" href="https://community.nxp.com/people/frank@esielectronic.com" style="color: #3d9ce7; border: 0px; font-weight: 600; text-decoration: none; font-size: 11.9994px;"&gt;Frank Sundermeyer&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do you configuration on Congfig Tool?&amp;nbsp; After finish config the GPIO pins, all the generate code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;should be in&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BOARD_InitPins().&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Could you please send your config project to me , I will check it on my side.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Also recommend you use the latest SDK version SDK2.6.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;BR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 04 Sep 2019 08:49:38 GMT</pubDate>
    <dc:creator>Alice_Yang</dc:creator>
    <dc:date>2019-09-04T08:49:38Z</dc:date>
    <item>
      <title>Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted.</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942019#M759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;My main application breaks up the initialization into two separate&lt;BR /&gt;routines. BOARD_InitPins(), and BOARD_InitLEDsPins().&lt;BR /&gt;Both of these files are specified in the pin wizard, and affect&lt;BR /&gt;different pins.&lt;BR /&gt;During initialization, this fails, since the generated code does&lt;BR /&gt;not preserve port direction and overwrites the previous port&lt;BR /&gt;direction bits for pins set as outputs.&lt;/P&gt;&lt;P&gt;MCUXpresso configuration tools version:&lt;BR /&gt;=========================================&lt;BR /&gt;product: Pins v6.0&lt;BR /&gt;processor: LPC51U68&lt;BR /&gt;package_id: LPC51U68JBD64&lt;BR /&gt;mcu_data: ksdk2_0&lt;BR /&gt;processor_version: 6.0.2&lt;BR /&gt;board: LPCXpresso51U68&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Application Code:&lt;BR /&gt;==================&lt;BR /&gt;The main routine call the two generated routines in sequence:&lt;/P&gt;&lt;P&gt;//*******************************************&lt;BR /&gt;// Initialize board hardware.&lt;BR /&gt;//*******************************************&lt;BR /&gt;// Set up basic I/O Pins&lt;BR /&gt;// Apply power to and reset both GPIO Ports&lt;BR /&gt;GPIO_PortInit(GPIO, 0);&lt;BR /&gt;GPIO_PortInit(GPIO, 1);&lt;BR /&gt;BOARD_InitPins();&lt;BR /&gt;// Set up pins for LEDs&lt;BR /&gt;BOARD_InitLEDsPins();&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;PinMux.c code, generated by Configuration tool:&lt;BR /&gt;=================================================&lt;/P&gt;&lt;P&gt;void BOARD_InitPins(void) {&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_Iocon);&lt;BR /&gt; GPIO-&amp;gt;DIR[0] = ((GPIO-&amp;gt;DIR[0] &amp;amp;&lt;BR /&gt; (~(GPIO_DIR_DIRP_MASK)))&lt;BR /&gt; | GPIO_DIR_DIRP(0x0D00u)&lt;BR /&gt; );&lt;BR /&gt; IOCON-&amp;gt;PIO[0][0] = ((IOCON-&amp;gt;PIO[0][0] &amp;amp;&lt;BR /&gt; (~(IOCON_PIO_FUNC_MASK | IOCON_PIO_DIGIMODE_MASK)))&lt;BR /&gt; | IOCON_PIO_FUNC(PIO00_FUNC_ALT1)&lt;BR /&gt; | IOCON_PIO_DIGIMODE(PIO00_DIGIMODE_DIGITAL)&lt;BR /&gt; );&lt;BR /&gt;....etc&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;void BOARD_InitLEDsPins(void) {&lt;BR /&gt; CLOCK_EnableClock(kCLOCK_Iocon);&lt;BR /&gt; GPIO-&amp;gt;DIR[0] = ((GPIO-&amp;gt;DIR[0] &amp;amp;&lt;BR /&gt; (~(GPIO_DIR_DIRP_MASK)))&lt;BR /&gt; | GPIO_DIR_DIRP(0xE0u)&lt;BR /&gt; );&lt;BR /&gt; GPIO-&amp;gt;DIR[1] = ((GPIO-&amp;gt;DIR[1] &amp;amp;&lt;BR /&gt; (~(GPIO_DIR_DIRP_MASK)))&lt;BR /&gt; | GPIO_DIR_DIRP(0x0800u)&lt;BR /&gt; );&lt;/P&gt;&lt;P&gt;Problem Description:&lt;BR /&gt;======================&lt;BR /&gt;When I execute the application code, BOARD_InitPins() executes&lt;BR /&gt;and sets up Port 0 direction register (CPIO-&amp;gt;DIR[0]) to 0xD00,&lt;BR /&gt;which sets up Port 0, pins 8,10, and 11 as outputs. This is correct.&lt;BR /&gt;Next, executing the BOARD_InitLEDsPins() function sets up Port 0&lt;BR /&gt;direction register (CPIO-&amp;gt;DIR[0]) to 0x0E0. It reads the Port Direction&lt;BR /&gt;register, but does not preserve the contents of the DIR[0] register.&lt;/P&gt;&lt;P&gt;Expected result: DIR[0] = 0x0DE0&lt;BR /&gt;Actual Result: DIR[0] = 0x00E0&lt;/P&gt;&lt;P&gt;In summary, the code generated by the configuration wizard always&lt;BR /&gt;appears to overwrite previously set direction bits, and does not&lt;BR /&gt;allow the configuration wizard to be used to set up port direction,&lt;BR /&gt;if the pin I/O is separated into sections.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;My workaround is to handle pin setup separately in the application,&lt;BR /&gt;to ensure the pins are properly configured, but I would like to&amp;nbsp;&lt;BR /&gt;clean up the code, and leave this to the configuration tools. Is&lt;BR /&gt;there something I need to do to prevent interaction, or do I need to&lt;BR /&gt;merge all my GPIO configuration into the single&amp;nbsp;BOARD_InitPins()&lt;/P&gt;&lt;P&gt;function.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Sep 2019 17:10:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942019#M759</guid>
      <dc:creator>frank5</dc:creator>
      <dc:date>2019-09-03T17:10:35Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted.</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942020#M760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello&amp;nbsp;&amp;nbsp;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;A _jive_internal="true" data-content-finding="Community" data-userid="316743" data-username="frank@esielectronic.com" href="https://community.nxp.com/people/frank@esielectronic.com" style="color: #3d9ce7; border: 0px; font-weight: 600; text-decoration: none; font-size: 11.9994px;"&gt;Frank Sundermeyer&lt;/A&gt;&lt;SPAN&gt;&amp;nbsp;,&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;How do you configuration on Congfig Tool?&amp;nbsp; After finish config the GPIO pins, all the generate code&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN&gt;should be in&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BOARD_InitPins().&amp;nbsp;&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Could you please send your config project to me , I will check it on my side.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Also recommend you use the latest SDK version SDK2.6.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;BR&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="background-color: #ffffff; color: #51626f; "&gt;Alice&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2019 08:49:38 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942020#M760</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-09-04T08:49:38Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted.</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942021#M761</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Attached is the .mex Configuration file and the&amp;nbsp;generated output files.&lt;/P&gt;&lt;P&gt;I am currently working with SDK_2.6.0_LPCXpresso51U68&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Sep 2019 17:20:28 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942021#M761</guid>
      <dc:creator>frank5</dc:creator>
      <dc:date>2019-09-04T17:20:28Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted.</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942022#M762</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello Frank,&lt;/P&gt;&lt;P&gt;OK, I know your meaning.&amp;nbsp;&lt;/P&gt;&lt;P&gt;Yes, I recommend you all the GPIO configuration in the&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BOARD_InitPins() function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;Or you need delete the code of&amp;nbsp; &amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;&amp;nbsp;(~(GPIO_DIR_DIRP_MASK)))&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;/* Mask bits to zero which are setting */&lt;/SPAN&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;to only exist in one pins init function.&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;TIC&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-------------------------------------------------------------------------------&lt;BR /&gt;Note:&lt;BR /&gt;- If this post answers your question, please click the "Mark Correct" button. Thank you!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;- We are following threads for 7 weeks after the last post, later replies are ignored&lt;BR /&gt; Please open a new thread and refer to the closed one, if you have a related question at a later point in time.&lt;BR /&gt;-------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2019 06:46:26 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942022#M762</guid>
      <dc:creator>Alice_Yang</dc:creator>
      <dc:date>2019-09-06T06:46:26Z</dc:date>
    </item>
    <item>
      <title>Re: Multiple BOARD_PinInit() functions cause GPIO Direction Register to be corrupted.</title>
      <link>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942023#M763</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I will use this workaround. This limitation prevents using multiple setup functions which set output pin directions, since they will interact with each other. I will merge all the separate setup functions into a&amp;nbsp;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;BOARD_InitPins()&amp;nbsp; function to allow the pin setup to be correct.&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 06 Sep 2019 16:28:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/MCUXpresso-Config-Tools/Multiple-BOARD-PinInit-functions-cause-GPIO-Direction-Register/m-p/942023#M763</guid>
      <dc:creator>frank5</dc:creator>
      <dc:date>2019-09-06T16:28:57Z</dc:date>
    </item>
  </channel>
</rss>

