<?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>Kinetis MicrocontrollersのトピックRe: How to debug K22 flash controller</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550896#M33503</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the table from FRM for FN22 part&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see there is NO 0x06 command as used in ALL OF THE BOOTLOADER &lt;/P&gt;&lt;P&gt;distributions CLAIMING to support the Kinetis parts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NXP I need an direct answer here as to why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i use the 0x07 command it works until I try and program only 4 bytes &lt;/P&gt;&lt;P&gt;instead of 8. then it fails even if I pad the other 4 bytes with 0xff.&lt;/P&gt;&lt;P&gt;The sector was erased before hand so it contains ff's and NOT data....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why? This makes absolutely no sense to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 12 Jul 2016 22:38:55 GMT</pubDate>
    <dc:creator>kennethtait</dc:creator>
    <dc:date>2016-07-12T22:38:55Z</dc:date>
    <item>
      <title>How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550890#M33497</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I have my custom K22 bootloader working from end to end, except it refuses to actually flash any bytes.&lt;/P&gt;&lt;P&gt;Erase comes back ok, as I would expect on a fresh load, but the FLASHprogramlongs() command always returns a fail.&lt;/P&gt;&lt;P&gt;I modified the linker file and flash_config area setup because original did not accomodate a 1M part. Each protect bit is 32k, so I moved the app start vector to 0x8000 and adjusted everything accordingly.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see any protection bits enabled, so don't think this is the problem.&lt;/P&gt;&lt;P&gt;I'm guessing it has something to do with clocks or wait states?&lt;/P&gt;&lt;P&gt;We are using an external xtal, 8.00mhz clocked up to 20.9 mhz. clock rail to FTFE is enabled.&lt;/P&gt;&lt;P&gt;anyone know what I can check or is there something else that needs to be set up?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;This is a pretty complicated flash controller and I see lots of workarounds for various parts in the original bootloader source I started with..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i run this on the debugger does debugging do something to prevent flash operation?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jul 2016 20:26:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550890#M33497</guid>
      <dc:creator>kennethtait</dc:creator>
      <dc:date>2016-07-07T20:26:00Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550891#M33498</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;Regarding to the issue, the FLASHprogramlongs() fucntion obviously fail to execute the program flash operation, and I don't think the frequency of flash clock cause the issue.&lt;/P&gt;&lt;P&gt;So I was wondering if you can share the code of FLASHprogramlongs() fucntion.&lt;/P&gt;&lt;P&gt;I'm looking forward to your reply.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Fri, 08 Jul 2016 06:51:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550891#M33498</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-07-08T06:51:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550892#M33499</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;the code used is straight from the "Kinetis Bootloader master 1027". &lt;/P&gt;&lt;P&gt;It's the standard flash_kinetis.c driver, basically the same one used in &lt;/P&gt;&lt;P&gt;all the other bootloader distributions.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I have not modified this. I checked the command codes used and &lt;/P&gt;&lt;P&gt;registers, all seem to match the MK22FN1M0 part.&lt;/P&gt;&lt;P&gt;I verified that the clock to the module is enabled, so it must be running.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In this version, the flash commands are copied to ram and executed from &lt;/P&gt;&lt;P&gt;there. I have 1 interrupt running for a timer, but I turn this off &lt;/P&gt;&lt;P&gt;before each flash operation. other than that the only other mods I have &lt;/P&gt;&lt;P&gt;made are to use a different uart and add a simplistic 7 segment display.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I could attach the whole project, but since it is for a custom board you &lt;/P&gt;&lt;P&gt;would have no way to actually run it.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 08 Jul 2016 13:12:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550892#M33499</guid>
      <dc:creator>kennethtait</dc:creator>
      <dc:date>2016-07-08T13:12:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550893#M33500</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;Thanks for your reply.&lt;/P&gt;&lt;P&gt;The FTFE can indicate the error condition through the corresponding bit in the FTFE_FSTAT register.&lt;/P&gt;&lt;P&gt;So I was wondering if you can tell what kind of the error condition rise after execute the flash command.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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, 11 Jul 2016 02:25:50 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550893#M33500</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-07-11T02:25:50Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550894#M33501</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;The original boot code doesn't return the error just pass/fail..which is &lt;/P&gt;&lt;P&gt;pretty useless IMHO.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I modified it and it is returning a 0x20, ACCERR..&lt;/P&gt;&lt;P&gt;The K22 1M part has a protection granularity of 32k, so only 1 bit set. &lt;/P&gt;&lt;P&gt;0XFFFFFFFE. This also means that App code MUST start at 0x8000. All &lt;/P&gt;&lt;P&gt;items pertaining to this have been modified.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;something else curious. Boot code has FLASH_PROGRAM_LONGWORD command as &lt;/P&gt;&lt;P&gt;0x06. Family manual for K22 parts says there is no 0x06 command..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We have working flash code in an MK70 part. It defines this as &lt;/P&gt;&lt;P&gt;0x07..which is listed and this code works in MK70, but it is slightly &lt;/P&gt;&lt;P&gt;different in that it is placed in ram using an __atrribute_ directive, &lt;/P&gt;&lt;P&gt;whereas the bootcode copies the commands into ram  using an INIT routine.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I don't see how the released boot code could ever work with these &lt;/P&gt;&lt;P&gt;errors..someone care to Splain it to me cause I clearly don't get it..&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks&lt;/P&gt;&lt;P&gt;Ken&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 11 Jul 2016 15:26:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550894#M33501</guid>
      <dc:creator>kennethtait</dc:creator>
      <dc:date>2016-07-11T15:26:17Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550895#M33502</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;Thanks for your reply, I'd like highly recommend that you can refer to the C90TFS flash driver for details.&lt;/P&gt;&lt;P&gt;You can download the driver through the link as below.&lt;/P&gt;&lt;P&gt;cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe?fromsite=zh-Hans&lt;/P&gt;&lt;P&gt;And after install, you can find the set of demos which contains the demo for the K22.&lt;/P&gt;&lt;P&gt;Hope it helps.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Tue, 12 Jul 2016 02:09:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550895#M33502</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-07-12T02:09:57Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550896#M33503</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;here is the table from FRM for FN22 part&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;As you can see there is NO 0x06 command as used in ALL OF THE BOOTLOADER &lt;/P&gt;&lt;P&gt;distributions CLAIMING to support the Kinetis parts.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;NXP I need an direct answer here as to why.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If i use the 0x07 command it works until I try and program only 4 bytes &lt;/P&gt;&lt;P&gt;instead of 8. then it fails even if I pad the other 4 bytes with 0xff.&lt;/P&gt;&lt;P&gt;The sector was erased before hand so it contains ff's and NOT data....&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Why? This makes absolutely no sense to me.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 12 Jul 2016 22:38:55 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550896#M33503</guid>
      <dc:creator>kennethtait</dc:creator>
      <dc:date>2016-07-12T22:38:55Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550897#M33504</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Ken,&lt;/P&gt;&lt;P&gt;The set of programming flash command:&lt;/P&gt;&lt;OL&gt;&lt;LI&gt;Program section&lt;/LI&gt;&lt;LI&gt;Program longword (32-bit)&lt;/LI&gt;&lt;LI&gt;Program phrase (64-bit)&lt;/LI&gt;&lt;/OL&gt;&lt;P&gt;Processors will support either the program longword or program phrase command, but not both. So you should refer to the flash module overview table for more information&lt;/P&gt;&lt;P&gt;I've attached an application note and you can learn the more information about the flash programming on Kinetis MCU.&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&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>Wed, 13 Jul 2016 02:12:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550897#M33504</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-07-13T02:12:35Z</dc:date>
    </item>
    <item>
      <title>Re: How to debug K22 flash controller</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550898#M33505</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Jeremy,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Im working with the C90TFS drivers and a MK22FN1M0AVLL12 and i having problems to erase and program flash sectors which are into block 0 when the running. I mean when i go step by step it works well.&lt;/P&gt;&lt;P&gt;Please could you check the following post i put??&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.nxp.com/thread/438256"&gt;K22 FTFE Erase Sector command failure&lt;/A&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;From &lt;SPAN class=""&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/thread/438256#comment"&gt;11-nov-2016 2:36&amp;nbsp; &lt;/A&gt;&lt;/SPAN&gt;forward&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It is due to&amp;nbsp; "FlashCommandSequence" function for sure, because i have commented its call from erase function and the MCU doesnt go to reset state.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Hope you can help me.&lt;/P&gt;&lt;P&gt;Thanks and best regards.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 15 Nov 2016 10:51:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/How-to-debug-K22-flash-controller/m-p/550898#M33505</guid>
      <dc:creator>alubeiro</dc:creator>
      <dc:date>2016-11-15T10:51:00Z</dc:date>
    </item>
  </channel>
</rss>

