<?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: Problem with writing to flash in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180008#M12978</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, here is a thread that discusses &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9500" target="_blank"&gt;EEPROM&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;As for single stepping thru the code, it seems you need to have interrupt disabled, so perhaps that is the issue at hand.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 14 Aug 2008 07:23:46 GMT</pubDate>
    <dc:creator>JimDon</dc:creator>
    <dc:date>2008-08-14T07:23:46Z</dc:date>
    <item>
      <title>Problem with writing to flash MC9S08DZ60.</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180004#M12974</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;SPAN&gt;This question was posed because the code runs correctly in an emulator, and also runs correctly when stepped through via the BDM. Unfortunately, when we run the code without stepping through line by line, the code errors out, with the FACCERR flag being set. I have looked through the documentation and the list of possible causes of the FACCERR flag being set, and none of seem to be occurring (at least in an obvious way). Any help you could offer would be greatly appreciated, and let me know if there are any more files you will need.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Relevent pieces of code:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;DIV class="msg_source_code"&gt;&lt;DIV class="text_smallest"&gt;Code:&lt;/DIV&gt;&lt;PRE&gt;; ### Init_FLASH init code; FSTAT: FCBEF=0,FCCF=0,FPVIOL=1,FACCERR=1,FBLANK=0&amp;nbsp;&amp;nbsp; LDA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #%00110000&amp;nbsp;&amp;nbsp; STA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Clear error flags; FCDIV: DIVLD=0,PRDIV8=0,DIV5=1,DIV4=0,DIV3=1,DIV2=0,DIV1=0,DIV0=1&amp;nbsp;&amp;nbsp; LDA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; #$45&amp;nbsp;&amp;nbsp; STA&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; FCDIV&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Set clock dividerJSR waitForFlashSTA CounterStorage ; set what data address to eraseLDX #mSectorErase&amp;nbsp; ; erase the sectorJSR flashCommand ; run commandflashCommand:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STX FCMD&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Set the command specified in X&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDX #mFSTAT_FCBEF&amp;nbsp;&amp;nbsp; ; loads the flash status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STX FSTAT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Load it back to the status to start the command&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RTSwaitForFlash:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDA FSTAT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Load Flash Status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND #mFSTAT_FCCF ; Check for Flash Command Complete Flag&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEQ waitForFlash ; If bit was 0, Z would now be set&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; LDA FSTAT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Load in the flash status&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; AND #(mFSTAT_FACCERR+mFSTAT_FPVIOL) ; Check for an error&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; BEQ waitForFlash_continue&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; STA FSTAT&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; If one exists, clear it&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; waitForFlash_continue:&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; RTS&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; ; Flash is done and any error was cleared&amp;nbsp;&amp;nbsp;&amp;nbsp; &lt;/PRE&gt;&lt;/DIV&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/DIV&gt;&lt;SPAN&gt;Added p/n to subject. &lt;/SPAN&gt;&lt;BR /&gt;&lt;DIV&gt; &lt;/DIV&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Message Edited by NLFSJ on &lt;/SPAN&gt;&lt;SPAN class="date_text"&gt;2008-08-14&lt;/SPAN&gt;&lt;SPAN&gt; &lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;09:25 AM&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 29 Oct 2020 09:29:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180004#M12974</guid>
      <dc:creator>CBB</dc:creator>
      <dc:date>2020-10-29T09:29:42Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180005#M12975</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;You didn't give a part number, but all require that the flashing code be run from ram.&lt;BR /&gt;&lt;BR /&gt;There have been many threads on this, &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9604" target="_blank"&gt;here is one&lt;/A&gt; that give several methods.&lt;BR /&gt;&lt;BR /&gt;Here is &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=9552" target="_blank"&gt;another one.&lt;/A&gt;&lt;BR /&gt;&lt;BR /&gt;There are many more..&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 04:48:56 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180005#M12975</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-08-14T04:48:56Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180006#M12976</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;We are using the MC9S08DZ60. We were under the inpression that we could program and erase EEPROM while executing flash based on page&amp;nbsp;3 in the On-Chip Memory section of the specs.&lt;/DIV&gt;&lt;DIV&gt;Is this incorrect?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;P&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08DZ60.pdf?fsrch=1&amp;amp;WT_TYPE=Data%20Sheets&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation" rel="nofollow" target="_blank"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08DZ60.pdf?fsrch=1&amp;amp;WT_TYPE=Data%20Sheets&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation" target="test_blank"&gt;http://www.freescale.com/files/microcontrollers/doc/data_sheet/MC9S08DZ60.pdf?fsrch=1&amp;amp;WT_TYPE=Data%20Sheets&amp;amp;WT_VENDOR=FREESCALE&amp;amp;WT_FILE_FORMAT=pdf&amp;amp;WT_ASSET=Documentation&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/P&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;B&gt;&lt;FONT face="Arial" size="3"&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;P align="left"&gt;&lt;FONT color="#000000" face="Times New Roman" size="3"&gt;&lt;B&gt;&lt;FONT face="Arial" size="3"&gt;On-Chip Memory&lt;/FONT&gt;&lt;/B&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;FONT face="Times New Roman" size="2"&gt;&lt;/FONT&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;• Flash read/program/erase over full operating voltage and&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;temperature&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;— MC9S08DZ60 = 60K&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;— MC9S08DZ48 = 48K&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;— MC9S08DZ32 = 32K&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;— MC9S08DZ16 = 16K&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;• Up to 2K EEPROM in-circuit programmable memory;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;8-byte single-page or 4-byte dual-page erase sector;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Times New Roman" size="2"&gt;Program and Erase while executing Flash; Erase abort&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Times New Roman" size="2"&gt;• Up to 4K random-access memory (RAM)&lt;/FONT&gt;&lt;/P&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 05:04:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180006#M12976</guid>
      <dc:creator>CBB</dc:creator>
      <dc:date>2008-08-14T05:04:12Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180007#M12977</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hello CBB,&lt;BR /&gt;&lt;BR /&gt;The subject of your post is "Problem with writing to flash", so it is quite easy to see how Jim assumed this is what you are doing.&lt;BR /&gt;If you are writing to EEPROM then you can do it while executing from flash, like it says on page 3.&lt;BR /&gt;The important thing here is that you cannot write to the same array that you are executing from. Or in other words you can't have the programming voltage applied to the array that you are executing from.&lt;BR /&gt;Again, ther are many many examples in the forums of how to do this.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 05:53:39 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180007#M12977</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2008-08-14T05:53:39Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180008#M12978</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Well, here is a thread that discusses &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;thread.id=9500" target="_blank"&gt;EEPROM&lt;/A&gt;.&lt;BR /&gt;&lt;BR /&gt;As for single stepping thru the code, it seems you need to have interrupt disabled, so perhaps that is the issue at hand.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 07:23:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180008#M12978</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-08-14T07:23:46Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180009#M12979</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;If I single step through the code, no error is generated, but nothing happens.&lt;BR /&gt;If I step over all the functions, an error is generated, so nothing happens.&lt;BR /&gt;If I run the code all at once (by right clicking and selecting run to cursor), it runs successfully.&lt;BR /&gt;Does anyone understand why this happens? (I do have interrupts disabled now.)&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 21:02:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180009#M12979</guid>
      <dc:creator>CBB</dc:creator>
      <dc:date>2008-08-14T21:02:33Z</dc:date>
    </item>
    <item>
      <title>Re: Problem with writing to flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180010#M12980</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;It's because the debugger reads the status registers and tries to read flash while single stepping.&lt;BR /&gt;It is a known issue - you just can't do it.&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 14 Aug 2008 21:39:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-with-writing-to-flash-MC9S08DZ60/m-p/180010#M12980</guid>
      <dc:creator>JimDon</dc:creator>
      <dc:date>2008-08-14T21:39:27Z</dc:date>
    </item>
  </channel>
</rss>

