<?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: FTFE Flash sector command always return ACCERR in Kinetis Microcontrollers</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTFE-Flash-sector-command-always-return-ACCERR/m-p/469497#M28366</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Two options:&lt;/P&gt;&lt;P&gt;1. You can use the FLASH_ProgramSectionByPhrases() fuction to program the Flash which is provided by AN2295 demo code too.&lt;/P&gt;&lt;P&gt;2. I'd also like to suggest that you can use use the C90TFS flash driver which include a quite of flash functions, and you can use these functions directly.&lt;/P&gt;&lt;P&gt;C90TFS flash driver:cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe?fromsite=zh-Hans&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>Mon, 14 Mar 2016 08:21:35 GMT</pubDate>
    <dc:creator>jeremyzhou</dc:creator>
    <dc:date>2016-03-14T08:21:35Z</dc:date>
    <item>
      <title>FTFE Flash sector command always return ACCERR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTFE-Flash-sector-command-always-return-ACCERR/m-p/469496#M28365</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;BR /&gt;Hello,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm using a Kinetis K61 (MK61FN1M0) and trying to use the FTFE module for boot loading.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I'm able to get Erase Sector and Program Phrase to work, but somehow I spend hours and still couldn't get Flash sector to work (always return ACCERR). I follow through Table 30-53 and verify that my parameters are correct - below is a section of the code that I'm using. I copied the data onto 0x14000000 (the programming acceleration RAM) and if I understand the reference manual correctly, I should be able to flash 4k byte at a time using the Program Sector command. &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;#define FLASH_PROGRAM_SECTOR 0x0B&lt;/P&gt;&lt;P&gt;#define PROGRAM_SECTOR_INDEX 0x06&lt;/P&gt;&lt;P&gt;LWord FLASH_ProgramSector(LWord destination, LWord size)&lt;/P&gt;&lt;P&gt;{&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* destination must be 128-bit aligned */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long NumOfDoublePhrase;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* double phrase align check */&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; if (destination &amp;amp; 0x0F)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; return 0;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; NumOfDoublePhrase = size * 8 / 128;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandObj.regsLong.fccob3210 = destination;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandObj.regs.fccob0 = FLASH_PROGRAM_SECTOR;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandObj.regs.fccob4 = (NumOfDoublePhrase &amp;amp; 0xFF00) &amp;gt;&amp;gt; 8;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; CommandObj.regs.fccob5 = NumOfDoublePhrase &amp;amp; 0x00FF;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; return FLASH_FlashCommandSequence(PROGRAM_SECTOR_INDEX);&amp;nbsp; /* always return ACCERR */&lt;/P&gt;&lt;P&gt;}&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;/* FLASH_FlashCommandSequenceStart cames from Freescale's Kinetis Serial Bootloader A2295 */&lt;/P&gt;&lt;P&gt;LWord FLASH_FlashCommandSequenceStart(Byte index)&lt;/P&gt;&lt;P&gt;{&lt;/P&gt;&lt;P&gt;&amp;nbsp; Byte* ptrFccobReg = (Byte*)&amp;amp;FLASH_BASE_PTR-&amp;gt;FCCOB3;&lt;/P&gt;&lt;P&gt;&amp;nbsp; Byte* ptrCommandObj = (Byte*)&amp;amp;CommandObj;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* wait till CCIF bit is set */&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(!(FLASH_FSTAT &amp;amp; FLASH_FSTAT_CCIF_MASK)){};&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* clear RDCOLERR &amp;amp; ACCERR &amp;amp; FPVIOL flag in flash status register */&lt;/P&gt;&lt;P&gt;&amp;nbsp; FLASH_FSTAT = FLASH_FSTAT_ACCERR_MASK | FLASH_FSTAT_FPVIOL_MASK | FLASH_FSTAT_RDCOLERR_MASK;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; /* load FCCOB registers */&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; while(index--)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *ptrFccobReg++ = *ptrCommandObj++;&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp; /*&amp;nbsp; launch a command&amp;nbsp; */&lt;/P&gt;&lt;P&gt;&amp;nbsp; FLASH_FSTAT |= FLASH_FSTAT_CCIF_MASK; &lt;/P&gt;&lt;P&gt;&amp;nbsp; /*&amp;nbsp; waiting for the finishing of the command */&lt;/P&gt;&lt;P&gt;&amp;nbsp; while(!(FLASH_FSTAT &amp;amp; FLASH_FSTAT_CCIF_MASK)){};&lt;/P&gt;&lt;P&gt;&amp;nbsp; &lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp; /* Check error bits */&lt;/P&gt;&lt;P&gt;&amp;nbsp; /* Get flash status register value */&lt;/P&gt;&lt;P&gt;&amp;nbsp; return (FLASH_FSTAT &amp;amp; (FLASH_FSTAT_ACCERR_MASK | FLASH_FSTAT_FPVIOL_MASK | FLASH_FSTAT_MGSTAT0_MASK));&amp;nbsp; &lt;/P&gt;&lt;P&gt;} &lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thank you for your help!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 11 Mar 2016 02:58:21 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTFE-Flash-sector-command-always-return-ACCERR/m-p/469496#M28365</guid>
      <dc:creator>jackylau</dc:creator>
      <dc:date>2016-03-11T02:58:21Z</dc:date>
    </item>
    <item>
      <title>Re: FTFE Flash sector command always return ACCERR</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTFE-Flash-sector-command-always-return-ACCERR/m-p/469497#M28366</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi&lt;/P&gt;&lt;P&gt;Two options:&lt;/P&gt;&lt;P&gt;1. You can use the FLASH_ProgramSectionByPhrases() fuction to program the Flash which is provided by AN2295 demo code too.&lt;/P&gt;&lt;P&gt;2. I'd also like to suggest that you can use use the C90TFS flash driver which include a quite of flash functions, and you can use these functions directly.&lt;/P&gt;&lt;P&gt;C90TFS flash driver:cache.freescale.com/files/32bit/software/C90TFS_FLASH_DRIVER.exe?fromsite=zh-Hans&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>Mon, 14 Mar 2016 08:21:35 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/FTFE-Flash-sector-command-always-return-ACCERR/m-p/469497#M28366</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-03-14T08:21:35Z</dc:date>
    </item>
  </channel>
</rss>

