<?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 Reset asserting multiple times on POR, and fast execution in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reset-asserting-multiple-times-on-POR-and-fast-execution/m-p/914505#M53541</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We were asked to drive an output pin as quickly as possible on a KV11 Kinetis MCU.&amp;nbsp; And in the process we found some interesting behavior with the reset pin, that was causing additional delays.&amp;nbsp; Here are the details, and solution.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We wanted to use the FRDM-KV11Z board, and simple SDK example to demonstrate fast execution from POR.&amp;nbsp; The SDK demo led_blinky is a simple example for this, so we wanted to drive the Red LED pin low on PTD6 as fast as possible after reset is released.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is optimizing the application code to drive the GPIO quickly.&amp;nbsp; Placing code in main() will not execute immediately after reset, because there is startup code that executes first.&amp;nbsp; In particular, the variable initialization done by the runtime library can take some time, especially in larger applications.&amp;nbsp; The SDK already has a hook in place for code like this that needs to execute quickly after reset, and before the runtime library initialization.&amp;nbsp; This hook is&amp;nbsp;SystemInitHook().&amp;nbsp; Keep in mind, when using code in this hook, since variables have not been initialized, you cannot count on any to have a known value.&amp;nbsp; We used this code to drive PTD6 low:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; SystemInitHook &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="comment token"&gt;/* Port D Clock Gate Control: Clock enabled */&lt;/SPAN&gt;
 SIM&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;SCGC5 &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SIM_SCGC5_PORTD_MASK&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

 &lt;SPAN class="comment token"&gt;/* PORTD6 (pin 63) is configured as PTD6 */&lt;/SPAN&gt;
 PORTD&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;PCR&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;BOARD_LED_RED_GPIO_PIN&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PORT_PCR_MUX&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; PORT_PCR_DSE_MASK&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

 &lt;SPAN class="comment token"&gt;/* Init output LED GPIO. */&lt;/SPAN&gt;
 BOARD_LED_GPIO&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;PDDR &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; BOARD_LED_RED_GPIO_PIN&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This succeeded in driving the LED pin low very quickly after reset was released, only 5us.&amp;nbsp; But when watching reset during POR, we found this unexpected behavior shown below.&amp;nbsp; The top signal is reset, and we can see it toggles high 5 times before it finally stays high and executes the code.&amp;nbsp; We also monitor VDD as it rises.&amp;nbsp; On power up, the KV11 datasheet says the Low Voltage Detect (LVD) Low threshold is 1.6V, and the reset sequence should start once VDD exceeds that level.&amp;nbsp; After the reset sequence completes and flash has initialized, reset goes high and execution should start.&amp;nbsp; But here we see reset asserted again 5 more times after that initial release of reset.&amp;nbsp; After the 6th and final rising edge of Reset, the LED pin is driven low after only 5us.&amp;nbsp; But the total time from VDD=1.6V to LED pin going low is 686us.&amp;nbsp; Something else to notice is the high reset pulses are 25us, and the MCU is executing code during that pulse.&amp;nbsp; So why does the MCU execute for 25us before another reset is triggered, and yet it doesn't execute the code to drive the LED pin low, which only needs 5us?&amp;nbsp; It seems it is not executing our application code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="Reset_Toggling.jpg"&gt;&lt;IMG alt="Reset_Toggling.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85133i16FE3519FBB904EC/image-size/large?v=v2&amp;amp;px=999" title="Reset_Toggling.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cause of this behavior is the Non-Maskable Interrupt (NMI) pin on the MCU.&amp;nbsp; When NMI is asserted low, it forces an interrupt, and jumps to the NMI ISR.&amp;nbsp; Take a look at the NMI signal on PTA4 pin of this FRDM-KV11Z board:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="NMI_cap.jpg"&gt;&lt;IMG alt="NMI_cap.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85091iCB8BE88918AA9890/image-size/large?v=v2&amp;amp;px=999" title="NMI_cap.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cap on this pin keeps NMI low initially during POR, and with the weak pull-up it takes some time to get pulled high.&amp;nbsp; So reset releases, code starts executing, and it immediately jumps to the NMI ISR and gets stuck there.&amp;nbsp; This also means code doesn't disable or service the watchdog, so reset gets asserted again.&amp;nbsp; This continues to happen until NMI is pulled high, and then our application code finally executes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Kinetis MCUs do have an option stored in flash to disable NMI on boot, to prevent something like this from happening.&amp;nbsp; In the KV11, the NMI_DIS bit is bit2 in the FOPT flash location at address 0x40D.&amp;nbsp; By clearing the NMI_DIS bit in flash, NMI will be disabled.&amp;nbsp; The SDK projects configure the Flash_Config area using the structure below in the startup file, like&amp;nbsp;startup_mkv11z7.c.&amp;nbsp; The linker places this Flash_Config section at address 0x400, so the last word contains the FOPT byte for address 0x40D.&amp;nbsp; The FOPT byte was the default 0xFF, and was changed to 0xFB to clear the NMI_DIS bit2.&amp;nbsp; BTW, the 0xFE byte in the same word is the FSEC byte at 0x40C, and is set to 0xFE to leave the MCU unsecured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;__attribute__ ((used,section(".FlashConfig"))) const struct {
 unsigned int word1;
 unsigned int word2;
 unsigned int word3;
 unsigned int word4;
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFBFE}; // NMI_DIS cleared in FOPT
‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now with NMI disabled, the capture below shows the final results.&amp;nbsp; Reset no longer toggles, and only goes high once.&amp;nbsp; The LED pin is driven low so quickly, the logic analyzer on the digital signal does not even recognize it goes high.&amp;nbsp; The bottom channel is analog voltage of the LED pin.&amp;nbsp; It starts to rise with VDD until the code executes and drives it low.&amp;nbsp; This is 5us after reset is released like we saw before, but is only 98us after VDD=1.6V.&amp;nbsp; Much better!&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="NMI_DIS.jpg"&gt;&lt;IMG alt="NMI_DIS.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85134i834532C891D38366/image-size/large?v=v2&amp;amp;px=999" title="NMI_DIS.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The modified project with source code, and the binary image are attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Nov 2020 14:23:02 GMT</pubDate>
    <dc:creator>dereksnell</dc:creator>
    <dc:date>2020-11-02T14:23:02Z</dc:date>
    <item>
      <title>Reset asserting multiple times on POR, and fast execution</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reset-asserting-multiple-times-on-POR-and-fast-execution/m-p/914505#M53541</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;We were asked to drive an output pin as quickly as possible on a KV11 Kinetis MCU.&amp;nbsp; And in the process we found some interesting behavior with the reset pin, that was causing additional delays.&amp;nbsp; Here are the details, and solution.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We wanted to use the FRDM-KV11Z board, and simple SDK example to demonstrate fast execution from POR.&amp;nbsp; The SDK demo led_blinky is a simple example for this, so we wanted to drive the Red LED pin low on PTD6 as fast as possible after reset is released.&amp;nbsp;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The first step is optimizing the application code to drive the GPIO quickly.&amp;nbsp; Placing code in main() will not execute immediately after reset, because there is startup code that executes first.&amp;nbsp; In particular, the variable initialization done by the runtime library can take some time, especially in larger applications.&amp;nbsp; The SDK already has a hook in place for code like this that needs to execute quickly after reset, and before the runtime library initialization.&amp;nbsp; This hook is&amp;nbsp;SystemInitHook().&amp;nbsp; Keep in mind, when using code in this hook, since variables have not been initialized, you cannot count on any to have a known value.&amp;nbsp; We used this code to drive PTD6 low:&lt;/P&gt;&lt;PRE class="language-c line-numbers"&gt;&lt;CODE&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt; SystemInitHook &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="keyword token"&gt;void&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;{&lt;/SPAN&gt;
 &lt;SPAN class="comment token"&gt;/* Port D Clock Gate Control: Clock enabled */&lt;/SPAN&gt;
 SIM&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;SCGC5 &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; SIM_SCGC5_PORTD_MASK&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

 &lt;SPAN class="comment token"&gt;/* PORTD6 (pin 63) is configured as PTD6 */&lt;/SPAN&gt;
 PORTD&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;PCR&lt;SPAN class="punctuation token"&gt;[&lt;/SPAN&gt;BOARD_LED_RED_GPIO_PIN&lt;SPAN class="punctuation token"&gt;]&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="token function"&gt;PORT_PCR_MUX&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt; PORT_PCR_DSE_MASK&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;

 &lt;SPAN class="comment token"&gt;/* Init output LED GPIO. */&lt;/SPAN&gt;
 BOARD_LED_GPIO&lt;SPAN class="operator token"&gt;-&amp;gt;&lt;/SPAN&gt;PDDR &lt;SPAN class="operator token"&gt;|&lt;/SPAN&gt;&lt;SPAN class="operator token"&gt;=&lt;/SPAN&gt; &lt;SPAN class="punctuation token"&gt;(&lt;/SPAN&gt;&lt;SPAN class="number token"&gt;1&lt;/SPAN&gt; &lt;SPAN class="operator token"&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; BOARD_LED_RED_GPIO_PIN&lt;SPAN class="punctuation token"&gt;)&lt;/SPAN&gt;&lt;SPAN class="punctuation token"&gt;;&lt;/SPAN&gt;
&lt;SPAN class="punctuation token"&gt;}&lt;/SPAN&gt;‍‍‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;This succeeded in driving the LED pin low very quickly after reset was released, only 5us.&amp;nbsp; But when watching reset during POR, we found this unexpected behavior shown below.&amp;nbsp; The top signal is reset, and we can see it toggles high 5 times before it finally stays high and executes the code.&amp;nbsp; We also monitor VDD as it rises.&amp;nbsp; On power up, the KV11 datasheet says the Low Voltage Detect (LVD) Low threshold is 1.6V, and the reset sequence should start once VDD exceeds that level.&amp;nbsp; After the reset sequence completes and flash has initialized, reset goes high and execution should start.&amp;nbsp; But here we see reset asserted again 5 more times after that initial release of reset.&amp;nbsp; After the 6th and final rising edge of Reset, the LED pin is driven low after only 5us.&amp;nbsp; But the total time from VDD=1.6V to LED pin going low is 686us.&amp;nbsp; Something else to notice is the high reset pulses are 25us, and the MCU is executing code during that pulse.&amp;nbsp; So why does the MCU execute for 25us before another reset is triggered, and yet it doesn't execute the code to drive the LED pin low, which only needs 5us?&amp;nbsp; It seems it is not executing our application code.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="Reset_Toggling.jpg"&gt;&lt;IMG alt="Reset_Toggling.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85133i16FE3519FBB904EC/image-size/large?v=v2&amp;amp;px=999" title="Reset_Toggling.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cause of this behavior is the Non-Maskable Interrupt (NMI) pin on the MCU.&amp;nbsp; When NMI is asserted low, it forces an interrupt, and jumps to the NMI ISR.&amp;nbsp; Take a look at the NMI signal on PTA4 pin of this FRDM-KV11Z board:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="NMI_cap.jpg"&gt;&lt;IMG alt="NMI_cap.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85091iCB8BE88918AA9890/image-size/large?v=v2&amp;amp;px=999" title="NMI_cap.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The cap on this pin keeps NMI low initially during POR, and with the weak pull-up it takes some time to get pulled high.&amp;nbsp; So reset releases, code starts executing, and it immediately jumps to the NMI ISR and gets stuck there.&amp;nbsp; This also means code doesn't disable or service the watchdog, so reset gets asserted again.&amp;nbsp; This continues to happen until NMI is pulled high, and then our application code finally executes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Kinetis MCUs do have an option stored in flash to disable NMI on boot, to prevent something like this from happening.&amp;nbsp; In the KV11, the NMI_DIS bit is bit2 in the FOPT flash location at address 0x40D.&amp;nbsp; By clearing the NMI_DIS bit in flash, NMI will be disabled.&amp;nbsp; The SDK projects configure the Flash_Config area using the structure below in the startup file, like&amp;nbsp;startup_mkv11z7.c.&amp;nbsp; The linker places this Flash_Config section at address 0x400, so the last word contains the FOPT byte for address 0x40D.&amp;nbsp; The FOPT byte was the default 0xFF, and was changed to 0xFB to clear the NMI_DIS bit2.&amp;nbsp; BTW, the 0xFE byte in the same word is the FSEC byte at 0x40C, and is set to 0xFE to leave the MCU unsecured.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class="language-none line-numbers"&gt;&lt;CODE&gt;__attribute__ ((used,section(".FlashConfig"))) const struct {
 unsigned int word1;
 unsigned int word2;
 unsigned int word3;
 unsigned int word4;
} Flash_Config = {0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFFFF, 0xFFFFFBFE}; // NMI_DIS cleared in FOPT
‍‍‍‍‍‍&lt;SPAN class="line-numbers-rows"&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;SPAN&gt;‍&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Now with NMI disabled, the capture below shows the final results.&amp;nbsp; Reset no longer toggles, and only goes high once.&amp;nbsp; The LED pin is driven low so quickly, the logic analyzer on the digital signal does not even recognize it goes high.&amp;nbsp; The bottom channel is analog voltage of the LED pin.&amp;nbsp; It starts to rise with VDD until the code executes and drives it low.&amp;nbsp; This is 5us after reset is released like we saw before, but is only 98us after VDD=1.6V.&amp;nbsp; Much better!&lt;/P&gt;&lt;P&gt;&lt;SPAN class="lia-inline-image-display-wrapper" image-alt="NMI_DIS.jpg"&gt;&lt;IMG alt="NMI_DIS.jpg" src="https://community.nxp.com/t5/image/serverpage/image-id/85134i834532C891D38366/image-size/large?v=v2&amp;amp;px=999" title="NMI_DIS.jpg" /&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The modified project with source code, and the binary image are attached.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Nov 2020 14:23:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reset-asserting-multiple-times-on-POR-and-fast-execution/m-p/914505#M53541</guid>
      <dc:creator>dereksnell</dc:creator>
      <dc:date>2020-11-02T14:23:02Z</dc:date>
    </item>
    <item>
      <title>Re: Reset asserting multiple times on POR, and fast execution</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reset-asserting-multiple-times-on-POR-and-fast-execution/m-p/914506#M53542</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;&lt;SPAN class=""&gt;void&lt;/SPAN&gt; SystemInitHook &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;void&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;
 &lt;SPAN class=""&gt;/* Port D Clock Gate Control: Clock enabled */&lt;/SPAN&gt;
 SIM&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;SCGC5 &lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; SIM_SCGC5_PORTD_MASK&lt;SPAN class=""&gt;;&lt;/SPAN&gt;

 &lt;SPAN class=""&gt;/* PORTD6 (pin 63) is configured as PTD6 */&lt;/SPAN&gt;
 PORTD&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;PCR&lt;SPAN class=""&gt;[&lt;/SPAN&gt;BOARD_LED_RED_GPIO_PIN&lt;SPAN class=""&gt;]&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;PORT_PCR_MUX&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;|&lt;/SPAN&gt; PORT_PCR_DSE_MASK&lt;SPAN class=""&gt;;&lt;/SPAN&gt;

 &lt;SPAN class=""&gt;/* Init output LED GPIO. */&lt;/SPAN&gt;
 BOARD_LED_GPIO&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;PDDR &lt;SPAN class=""&gt;|&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; BOARD_LED_RED_GPIO_PIN&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;
&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;can be made a bit more efficient with&lt;/P&gt;&lt;PRE class=""&gt;&lt;CODE&gt;&lt;SPAN class=""&gt;void&lt;/SPAN&gt; SystemInitHook &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;void&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;{&lt;/SPAN&gt;
 &lt;SPAN class=""&gt;/* Port D Clock Gate Control: Clock enabled */&lt;/SPAN&gt;
&lt;STRONG&gt; SIM&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;SCGC5 &lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; SIM_SCGC5_PORTD_MASK&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;

 &lt;SPAN class=""&gt;/* PORTD6 (pin 63) is configured as PTD6 */&lt;/SPAN&gt;
 PORTD&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;PCR&lt;SPAN class=""&gt;[&lt;/SPAN&gt;BOARD_LED_RED_GPIO_PIN&lt;SPAN class=""&gt;]&lt;/SPAN&gt; &lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;PORT_PCR_MUX&lt;/SPAN&gt;&lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt;&lt;SPAN class=""&gt;)&lt;/SPAN&gt; &lt;SPAN class=""&gt;|&lt;/SPAN&gt; PORT_PCR_DSE_MASK&lt;SPAN class=""&gt;;&lt;/SPAN&gt;

 &lt;SPAN class=""&gt;/* Init output LED GPIO. */&lt;/SPAN&gt;
 &lt;STRONG&gt;BOARD_LED_GPIO&lt;SPAN class=""&gt;-&amp;gt;&lt;/SPAN&gt;PDDR &lt;SPAN class=""&gt;&lt;/SPAN&gt;&lt;SPAN class=""&gt;=&lt;/SPAN&gt; &lt;SPAN class=""&gt;(&lt;/SPAN&gt;&lt;SPAN class=""&gt;1&lt;/SPAN&gt; &lt;SPAN class=""&gt;&amp;lt;&amp;lt;&lt;/SPAN&gt; BOARD_LED_RED_GPIO_PIN&lt;SPAN class=""&gt;)&lt;/SPAN&gt;&lt;SPAN class=""&gt;;&lt;/SPAN&gt;&lt;/STRONG&gt;
&lt;SPAN class=""&gt;}&lt;/SPAN&gt;&lt;/CODE&gt;&lt;/PRE&gt;&lt;P&gt;The ORs are redundant since the register content is known after a reset.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 26 Sep 2019 10:32:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Reset-asserting-multiple-times-on-POR-and-fast-execution/m-p/914506#M53542</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2019-09-26T10:32:06Z</dc:date>
    </item>
  </channel>
</rss>

