<?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: Difficulties using KL27 BOOT ROM in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657473#M40286</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;"KinetisFlashTool.exe" &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Found it to be a crap shoot if that works on any given PC.&lt;/P&gt;&lt;P&gt;On the PCs where it does not work *nothing* happens.&lt;/P&gt;&lt;P&gt;Zip, nothing, like you did not even click on the icon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always use bhost.exe in a batch file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not uncommon to see the board cycling at power up, have never figured out why.&lt;BR /&gt;A reset stops the cycling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Helpful to have this running to tell when things are really connecting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://www.nirsoft.net/utils/usb_devices_view.html" title="http://www.nirsoft.net/utils/usb_devices_view.html"&gt;View any installed/connected USB device on your system&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;It is most useful when configured to not show disconnected devices.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 07 Dec 2016 21:49:32 GMT</pubDate>
    <dc:creator>bobpaddock</dc:creator>
    <dc:date>2016-12-07T21:49:32Z</dc:date>
    <item>
      <title>Difficulties using KL27 BOOT ROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657471#M40284</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi All&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I am preparing the production of a new line of KL27 based USB devices where I plan to use the internal BOOT ROM loader for initial factory programming. In order to do some verification I have taken the FRDM-KL27Z to run through the process.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Initially I started with a blank chip and could program the application (in fact a secondary boot loader that will be used in case of firmware upgrades directly from the product's PC application). &lt;EM&gt;This is therefore fine for usual production circumstances&lt;/EM&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;However, in case of emergencies it is also possible to use the BOOTCFG0 input to get back to the internal BOOT ROM, &lt;EM&gt;but this wasn't working as expected&lt;/EM&gt;. I found that the application starts normally if the BOOTCFG0 is not asserted but the board just hangs when it is asserted - there is no USB enumeration and it doesn't react to the reset anymore even when the BOOTCFG0 is no longer applied - basically it needs a power cycle to recover. The mask of the chip on the board is 1N87M which doesn't have any references to such behavior (I know that some masks have a problem if the SPI lines float since it may falsely enable SPI loading mode).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Note that I don't configure the BCA area (it is all 0x00 and thus invalid, causing all interfaces to be active - same as a fresh chip).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thinking that this were a BOOTCFG0 issue I also tested forcing the ROM loader in the flash config setting. In this case it starts the application after about 5s &lt;SPAN style="text-decoration: underline;"&gt;but still no USB enumeration&lt;/SPAN&gt;.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Rather than panicking I did some careful comparisons and actually found that both of the configurations (forced ROM or BOOTCFG0 commanded) actually work as long as I &lt;EM&gt;leave the FRDM-KL27Z powered off for about 30s&lt;/EM&gt; or so before connecting and powering over USB; then it appears as USB device for 5s and there is just enough time to attach KBOOT host and reprogram it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If the reset button is used it &lt;EM&gt;never works&lt;/EM&gt;; if the power is removed for only a few seconds it &lt;EM&gt;never works&lt;/EM&gt; but if one is patient enough to power down for long enough it can indeed be used.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This means that it is probably safe to continue as planned but the question remains as to &lt;STRONG&gt;whether this is caused by a BOOT ROM errata that is not published for this device on the FRDM-KL27Z or whether there is some other explanation?&lt;/STRONG&gt;&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;P&gt;&lt;/P&gt;&lt;P&gt;Update 1: Original tests on Win 8.1 PC with Kinetis Updater program.&lt;BR /&gt;Repeats on Win 10 PC using "KinetisFlashTool.exe" showed no such difficulties.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Update 2: If the BOOT ROM mode is entered by forcing it with BOOTCFG0 it is possible to command a reset from "KinetisFlashTool.exe" and the application starts after about 5s delay. If "KinetisFlashTool.exe" is not connected the HW reset button doesn't cause the application to start and a power cycle is required. &lt;STRONG&gt;Can this be explained?&lt;/STRONG&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 15:48:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657471#M40284</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-12-07T15:48:39Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulties using KL27 BOOT ROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657472#M40285</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The five second delay is normal, and annoying. &amp;nbsp;After bootloading I always disconnect the cable (which in our hardware is connected to the boot pin) then cycle power. &lt;BR /&gt;It is imperative that NMI be disabled for any of this to work correctly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is my flash config area and the function below, is the key to making it work correctly:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* Flash configuration field: */&lt;BR /&gt;const uint8_t _kfcf[] __attribute__( ( section( ".kinetis_flash_config_field" ) ) ) =&lt;BR /&gt;{ [Not my real key]&lt;BR /&gt; 0x33U, /**&amp;lt; Backdoor Comparison Key 3., offset: 0x0 NV_BACKKEY3 */&lt;BR /&gt; 0x22U, /**&amp;lt; Backdoor Comparison Key 2., offset: 0x1 NV_BACKKEY2 */&lt;BR /&gt; 0x41U, /**&amp;lt; Backdoor Comparison Key 1., offset: 0x2 NV_BACKKEY1 */&lt;BR /&gt; 0x40U, /**&amp;lt; Backdoor Comparison Key 0., offset: 0x3 NV_BACKKEY0 */&lt;BR /&gt; 0x27U, /**&amp;lt; Backdoor Comparison Key 7., offset: 0x4 NV_BACKKEY7 */&lt;BR /&gt; 0x66U, /**&amp;lt; Backdoor Comparison Key 6., offset: 0x5 NV_BACKKEY6 */&lt;BR /&gt; 0x95U, /**&amp;lt; Backdoor Comparison Key 5., offset: 0x6 NV_BACKKEY5 */&lt;BR /&gt; 0x84U, /**&amp;lt; Backdoor Comparison Key 4., offset: 0x7 NV_BACKKEY4 */&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;0xFFU, /**&amp;lt; Non-volatile P-Flash Protection 1 - Low Register, offset: 0x8 NV_FPROT3 */&lt;BR /&gt; 0xFFU, /**&amp;lt; Non-volatile P-Flash Protection 1 - High Register, offset: 0x9 NV_FPROT2 */&lt;BR /&gt; 0xFFU, /**&amp;lt; Non-volatile P-Flash Protection 0 - Low Register, offset: 0xA NV_FPROT1 */&lt;BR /&gt; 0xFFU, /**&amp;lt; Non-volatile P-Flash Protection 0 - High Register, offset: 0xB NV_FPROT0 */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * FTFA_FSEC 0x040C:&lt;BR /&gt; *&lt;BR /&gt; * Note: The security features apply only to external&lt;BR /&gt; * accesses: debug. CPU accesses to the flash&lt;BR /&gt; * are not affected by the status of FTFA_FSEC.&lt;BR /&gt; *&lt;BR /&gt; * In the unsecured state, all flash commands are available on the&lt;BR /&gt; * programming interfaces either from the debug port (SWD) or user&lt;BR /&gt; * code execution. When the flash is secured (FTFA_FSEC[SEC] = 00,&lt;BR /&gt; * 01, or 11), the programmer interfaces are only allowed to&lt;BR /&gt; * launch mass erase operations. Additionally, in this mode, the&lt;BR /&gt; * debug port has no access to memory locations.&lt;BR /&gt; *&lt;BR /&gt; * KEYEN MEEN FSLACC SEC&lt;BR /&gt; * 7 6 5 4 3 2 1 0&lt;BR /&gt; *&lt;BR /&gt; * KEYEN = 0x01 Backdoor Disabled.&lt;BR /&gt; * KEYEN = 0x10 Backdoor Enabled.&lt;BR /&gt; *&lt;BR /&gt; * MEEN = 0x10 Mass Erase Disabled. All others Mass Erase Enabled.&lt;BR /&gt; *&lt;BR /&gt; * FSLACC Factory Security Level Access Code&lt;BR /&gt; *&lt;BR /&gt; * FSLACC = 0x01 or 0x11 Factory access granted. Others denied.&lt;BR /&gt; *&lt;BR /&gt; * SEC Flash Secutiry&lt;BR /&gt; *&lt;BR /&gt; * SEC = 0x10 Unsecure (0x7EU) which is the factory shipping state. 0xFEU is also unsecured which is what flash-erase-all-unsecure does.&lt;BR /&gt; */&lt;/P&gt;&lt;P&gt;//0x7EU, /**&amp;lt; Non-volatile Flash Security Register, offset: 0xC NV_FSEC. Backdoor Disabled, Unsecured */&lt;BR /&gt; //0xBEU, /**&amp;lt; Non-volatile Flash Security Register, offset: 0xC NV_FSEC. Backdoor enabled, Unsecured */&lt;BR /&gt; 0xBFU, /**&amp;lt; Non-volatile Flash Security Register, offset: 0xC NV_FSEC. Backdoor enabled, Secured */&lt;/P&gt;&lt;P&gt;/*&lt;BR /&gt; * FTFA_FOPT 0x04D:&lt;BR /&gt; * 7:BOOTSRC_SEL1 0x80U&lt;BR /&gt; * 6:BOOTSRC_SEL0 0x40U&lt;BR /&gt; * 00 = Flash, 01 = Reserved, 10/11 = ROM&lt;BR /&gt; *&lt;BR /&gt; * 5:NV_FOPT_FAST_INIT_MASK 0x20U&lt;BR /&gt; * 1 = Fast&lt;BR /&gt; *&lt;BR /&gt; * 4:NV_FOPT_LPBOOT1_MASK 0x10U&lt;BR /&gt; * See bit zero&lt;BR /&gt; *&lt;BR /&gt; * 3:NV_FOPT_RESET_PIN_CFG_MASK 0x08U&lt;BR /&gt; * 0 = Disabled Reset.&lt;BR /&gt; *&lt;BR /&gt; * 2:V_FOPT_NMI_DIS_MASK 0x04U&lt;BR /&gt; * 0 = Disable NMI&lt;BR /&gt; *&lt;BR /&gt; * 1:BOOTPIN_OPT 0x02U&lt;BR /&gt; * 0 = Force boot from ROM if BOOTCFG0 asserted.&lt;BR /&gt; *&lt;BR /&gt; * 0:NV_FOPT_LPBOOT0_MASK 0x01u&lt;BR /&gt; * 00 /8 VLPR on exit reset&lt;BR /&gt; * 01 /4 VLPR on exit reset&lt;BR /&gt; * 10 /2 RUN on exit&lt;BR /&gt; * 11 /1 RUN on exit&lt;BR /&gt; *&lt;BR /&gt; */&lt;BR /&gt; 0x38U, /**&amp;lt; Non-volatile Flash Option Register, offset: 0xD NV_FOPT Disable NMI pin. Boot from Flash not ROM */&lt;/P&gt;&lt;P&gt;0xFFU, /* Not used. Required to hold position to align vector table correctly */&lt;BR /&gt; 0xFFU&lt;BR /&gt;};&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You quested errata:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;static void vectors_bootloader_mr_setup( void );&lt;BR /&gt;static void vectors_bootloader_mr_setup( void )&lt;BR /&gt;{&lt;BR /&gt; /*&lt;BR /&gt; * RCM_MR Indicates the boot source, the boot source remains set&lt;BR /&gt; * until the next System Reset or software can write logic one to&lt;BR /&gt; * clear the corresponding mode bit. While either bit is set the&lt;BR /&gt; * NMI input is disabled and the vector table is relocated to the&lt;BR /&gt; * ROM base address at 0x1C00_0000. These bits should be cleared by&lt;BR /&gt; * writing logic one before executing any code from either Flash or&lt;BR /&gt; * SRAM. [Doesn't actually make sense, is what the data sheet says.]&lt;BR /&gt; *&lt;BR /&gt; * A reset is forced to clear out anything that the ROM&lt;BR /&gt; * bootloader did, so we are sure we have the data sheet reset&lt;BR /&gt; * values. [Which are Vcc Rise not all reset sources.]&lt;/P&gt;&lt;P&gt;*&lt;/P&gt;&lt;P&gt;* This method works around the buggy KL43/27/17 bootloaders as&lt;BR /&gt; * described in: "Problem Analysis and solutions for booting from&lt;BR /&gt; * ROM BOOTLOADER in KL series".&lt;BR /&gt; */&lt;BR /&gt; if( 0U != (RCM_MR &amp;amp; RCM_MR_BOOTROM_MASK) )&lt;BR /&gt; {&lt;BR /&gt; RCM_MR = RCM_MR_BOOTROM_MASK; /* Clear the bits that indicated a bootlaoder boot via ROM */&lt;BR /&gt; RCM_FM = 0U; /* Boot from Flash not ROM on next reset */&lt;/P&gt;&lt;P&gt;SCB_AIRCR = (SCB_AIRCR_VECTKEY(0x05FAU) | SCB_AIRCR_SYSRESETREQ_MASK); /* Force a Software Reset */&lt;BR /&gt; }&lt;BR /&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void _reset_init(void)&lt;BR /&gt;{&lt;BR /&gt; irq_disable(); /* Did bootloader leave IRQs on perhaps? */&lt;/P&gt;&lt;P&gt;bootloader_mr_setup();&lt;/P&gt;&lt;P&gt;SCB_VTOR = (uint32_t) interrupt_vector_table;&lt;BR /&gt; sync_barrier_data();&lt;/P&gt;&lt;P&gt;...&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 21:43:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657472#M40285</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2016-12-07T21:43:19Z</dc:date>
    </item>
    <item>
      <title>Re: Difficulties using KL27 BOOT ROM</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657473#M40286</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #51626f; background-color: #ffffff;"&gt;"KinetisFlashTool.exe" &lt;BR /&gt;&lt;BR /&gt;&lt;/SPAN&gt;Found it to be a crap shoot if that works on any given PC.&lt;/P&gt;&lt;P&gt;On the PCs where it does not work *nothing* happens.&lt;/P&gt;&lt;P&gt;Zip, nothing, like you did not even click on the icon.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I always use bhost.exe in a batch file.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is not uncommon to see the board cycling at power up, have never figured out why.&lt;BR /&gt;A reset stops the cycling.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Helpful to have this running to tell when things are really connecting:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;A class="link-titled" href="http://www.nirsoft.net/utils/usb_devices_view.html" title="http://www.nirsoft.net/utils/usb_devices_view.html"&gt;View any installed/connected USB device on your system&lt;/A&gt;&amp;nbsp;&lt;BR /&gt;It is most useful when configured to not show disconnected devices.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Dec 2016 21:49:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/Difficulties-using-KL27-BOOT-ROM/m-p/657473#M40286</guid>
      <dc:creator>bobpaddock</dc:creator>
      <dc:date>2016-12-07T21:49:32Z</dc:date>
    </item>
  </channel>
</rss>

