<?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 A batch of Flash writing in S12 / MagniV Microcontrollers</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135938#M2332</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;BR /&gt;I implemented a Flash driver for E64.&lt;BR /&gt;The functionalilty of driver have Flash erasing, Flash writing...etc.&lt;BR /&gt;&lt;BR /&gt;But there is a situation very strange when doing a batch of Flash writing.(&lt;SPAN style="color: #996633; font-size: 2;"&gt;See following pseudo code&lt;/SPAN&gt;)&lt;BR /&gt;It will run very smoothly in debug mode(&lt;SPAN style="color: #996633; font-size: 2;"&gt;Use BDM and press debug button on Metrowerks IDE&lt;/SPAN&gt;),&lt;BR /&gt;every word(0x1111) you programmed is correct, but in free running mode(&lt;SPAN style="color: #996633; font-size: 2;"&gt;Turn off EVB power then turn on EVB power&lt;/SPAN&gt;) you'll see there are a lot of word incorrect. (&lt;SPAN style="color: #996633; font-size: 2;"&gt;How can I see the word is incorrect? Because I didn't disconnect BDM from MCU, if you wanna see the Flash, you just need to press reset button on Hi-Wave. Remember to set the mode of memory window as periodical then double click any memory.&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN style="color: #0000CC; font-size: 2;"&gt;&lt;BR /&gt;Pseudo code:&lt;BR /&gt;INT32U StartAddress = 0x003C8000;&lt;BR /&gt;INT16U Word = 0x1111;&lt;BR /&gt;for(; StartAddress&amp;lt;0x003CBFFF; StartAddress+=2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Flash_WriteWord(StartAddress, Word);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Attached file, TestFlashProg.rar can be opened by Metrowerks CW3.1.&lt;BR /&gt;If you do not have E64 EVB, you just change header file usage, &amp;lt;MC9S12E64.h&amp;gt;.&lt;BR /&gt;First, you have to select target, Flash RAM Func in Metrowerks and make it.&lt;BR /&gt;Second, open Hyper-Terminal set baudrate as 19200bps.&lt;BR /&gt;Third, select target, Bootloader and build then you can start to run this project.&lt;BR /&gt;&lt;BR /&gt;-----------------------------------&lt;BR /&gt;Thanks for looking.&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_1_TestFlashProg.zip" rel="nofollow" target="_blank"&gt;TestFlashProg.zip&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_2_Correct5.jpg" rel="nofollow" target="_blank"&gt;Correct5.jpg&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_3_Error2.jpg" rel="nofollow" target="_blank"&gt;Error2.jpg&lt;/A&gt;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-10-21&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;12:46 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 06 Jun 2007 10:40:57 GMT</pubDate>
    <dc:creator>MaxY</dc:creator>
    <dc:date>2007-06-06T10:40:57Z</dc:date>
    <item>
      <title>A batch of Flash writing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135938#M2332</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all,&lt;BR /&gt;I implemented a Flash driver for E64.&lt;BR /&gt;The functionalilty of driver have Flash erasing, Flash writing...etc.&lt;BR /&gt;&lt;BR /&gt;But there is a situation very strange when doing a batch of Flash writing.(&lt;SPAN style="color: #996633; font-size: 2;"&gt;See following pseudo code&lt;/SPAN&gt;)&lt;BR /&gt;It will run very smoothly in debug mode(&lt;SPAN style="color: #996633; font-size: 2;"&gt;Use BDM and press debug button on Metrowerks IDE&lt;/SPAN&gt;),&lt;BR /&gt;every word(0x1111) you programmed is correct, but in free running mode(&lt;SPAN style="color: #996633; font-size: 2;"&gt;Turn off EVB power then turn on EVB power&lt;/SPAN&gt;) you'll see there are a lot of word incorrect. (&lt;SPAN style="color: #996633; font-size: 2;"&gt;How can I see the word is incorrect? Because I didn't disconnect BDM from MCU, if you wanna see the Flash, you just need to press reset button on Hi-Wave. Remember to set the mode of memory window as periodical then double click any memory.&lt;/SPAN&gt;)&lt;BR /&gt;&lt;SPAN style="color: #0000CC; font-size: 2;"&gt;&lt;BR /&gt;Pseudo code:&lt;BR /&gt;INT32U StartAddress = 0x003C8000;&lt;BR /&gt;INT16U Word = 0x1111;&lt;BR /&gt;for(; StartAddress&amp;lt;0x003CBFFF; StartAddress+=2)&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Flash_WriteWord(StartAddress, Word);&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Attached file, TestFlashProg.rar can be opened by Metrowerks CW3.1.&lt;BR /&gt;If you do not have E64 EVB, you just change header file usage, &amp;lt;MC9S12E64.h&amp;gt;.&lt;BR /&gt;First, you have to select target, Flash RAM Func in Metrowerks and make it.&lt;BR /&gt;Second, open Hyper-Terminal set baudrate as 19200bps.&lt;BR /&gt;Third, select target, Bootloader and build then you can start to run this project.&lt;BR /&gt;&lt;BR /&gt;-----------------------------------&lt;BR /&gt;Thanks for looking.&lt;BR /&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_1_TestFlashProg.zip" rel="nofollow" target="_blank"&gt;TestFlashProg.zip&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_2_Correct5.jpg" rel="nofollow" target="_blank"&gt;Correct5.jpg&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=http%3A%2F%2Fwww.freescale.com%2Ffiles%2Fcommunity_files%2F16BITCOMM%2F4011_3_Error2.jpg" rel="nofollow" target="_blank"&gt;Error2.jpg&lt;/A&gt;&lt;/P&gt;&lt;DIV class="message-edit-history"&gt;&lt;SPAN class="edit-author"&gt;Message Edited by t.dowe on&lt;/SPAN&gt; &lt;SPAN class="local-date"&gt;2009-10-21&lt;/SPAN&gt; &lt;SPAN class="local-time"&gt;12:46 AM&lt;/SPAN&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 10:40:57 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135938#M2332</guid>
      <dc:creator>MaxY</dc:creator>
      <dc:date>2007-06-06T10:40:57Z</dc:date>
    </item>
    <item>
      <title>Re: A batch of Flash writing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135939#M2333</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;It looks like flash programming time is too short (some bits fail to programm).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I see one bug that could explain why it happens. In normal mode FCLKDIV is a write once register. And you have this&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;FCLKDIV_PRDIV8 = 0;&amp;nbsp; // this write is granted&lt;BR /&gt;&amp;nbsp;FCLKDIV_FDIV = 21;&amp;nbsp;&amp;nbsp;&amp;nbsp; //&amp;nbsp; this is ignored in normal mode&lt;BR /&gt;&lt;/DIV&gt;&lt;DIV&gt;So, effective diveder locked in FCLKDIV should be 0. Wrong value indeed.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Also I'm curious what from did you get following&amp;nbsp;figures. Did you take them from the map file?:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;#define FLASH_RAM_FUNC_START&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFEE0&lt;BR /&gt;#define FLASH_RAM_FUNC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;BR /&gt;#define FLASH_COPY_START&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4FE0&lt;BR /&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 14:16:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135939#M2333</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2007-06-06T14:16:32Z</dc:date>
    </item>
    <item>
      <title>Re: A batch of Flash writing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135940#M2334</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi kef,&lt;BR /&gt;I have to say you're really an expert.&lt;BR /&gt;After I modify configuration of Flash speed, it works. &lt;SPAN&gt;&lt;IMG alt=":smileyhappy:" class="emoticon emoticon-smileyhappy" id="smileyhappy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-happy.gif" title="Smiley Happy" /&gt;&lt;/SPAN&gt;&lt;BR /&gt;&lt;FONT color="#CC0066" size="2"&gt;&lt;/FONT&gt;&lt;FONT color="#CC0066" size="2"&gt;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#CC0066" size="2"&gt;1.&lt;BR /&gt;#define FLASH_COPY_START&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 0x4FE0&lt;/FONT&gt;&lt;BR /&gt;@ test project, there's a target named, "Flash RAM Function", and the relative prm file is flash_RamFunc.prm. I defined the address as following.&lt;BR /&gt;&lt;FONT color="#0000ff"&gt;SECTIONS&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; DUMMY_RAM = READ_WRITE 0xF000 TO 0xF002&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ROM = READ_ONLY 0x4FE0 TO 0X4FFF&lt;BR /&gt;END&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#CC0066" size="2"&gt;&lt;BR /&gt;2.&lt;BR /&gt;#define FLASH_RAM_FUNC_START&amp;nbsp;&amp;nbsp;&amp;nbsp; 0xFEE0&lt;/FONT&gt;&lt;FONT color="#CC0066" size="2"&gt;&lt;/FONT&gt;&lt;BR /&gt;@ P&amp;amp;E_ICD_linker.prm, I reserved a RAM space for Flash driver.&lt;BR /&gt;The reserved space is for Flash RAM function. After you launch one of the Flash command you have to wait for flag, CCIF to be set. This is the mission of Flash FAM function.&lt;BR /&gt;&lt;BR /&gt;&lt;FONT color="#CC0066" size="2"&gt;3.&lt;BR /&gt;#define FLASH_RAM_FUNC_SIZE&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 21&lt;BR /&gt;&lt;/FONT&gt;In the Metrowerks IDE, there's a list shows code size of every c-file.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 06 Jun 2007 19:22:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135940#M2334</guid>
      <dc:creator>MaxY</dc:creator>
      <dc:date>2007-06-06T19:22:42Z</dc:date>
    </item>
    <item>
      <title>Re: A batch of Flash writing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135941#M2335</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks for compliment :smileyhappy: and for reply. Good to know it was indeed fclkdiv. I believed that flash programm/erase just can't success with fclkdiv set to zero.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I asked about fixed RamFunc addresses because I found it weird to use defines instead of address of (&amp;amp;) operator. Subproject with its own prm explains why you did so. Thanks.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Regards&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 07 Jun 2007 00:29:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135941#M2335</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2007-06-07T00:29:27Z</dc:date>
    </item>
    <item>
      <title>Re: A batch of Flash writing</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135942#M2336</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Maxy, can you post where did you correct the bug? I'm working with NE64 with xtal = 25MHz, PLL factor 2/10, with bus clock at 5 MHz. What is your xtal and pll configuration. Thanks.&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jun 2007 05:46:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/A-batch-of-Flash-writing/m-p/135942#M2336</guid>
      <dc:creator>DiegoNunes</dc:creator>
      <dc:date>2007-06-19T05:46:44Z</dc:date>
    </item>
  </channel>
</rss>

