<?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>8-bit Microcontrollersのトピック9S08QG8 EEprom/Flash</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183707#M13567</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi all, ive just joined the freescale site.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am using a 9S08QG8 micro on a freescale dev&amp;nbsp;board. I have been trying to use the Flash to store some calibration values with some&amp;nbsp; great difficulty as i cant get it to work. I have followed the data sheet and all seems fine.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I&amp;nbsp;have tried the QG8 Flash 6.zip example that is was suggested here, but still no success.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Does anyone have some working demo code or a library for doing this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Wes&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 29 Jan 2008 18:33:44 GMT</pubDate>
    <dc:creator>wb79</dc:creator>
    <dc:date>2008-01-29T18:33:44Z</dc:date>
    <item>
      <title>9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183707#M13567</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi all, ive just joined the freescale site.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I am using a 9S08QG8 micro on a freescale dev&amp;nbsp;board. I have been trying to use the Flash to store some calibration values with some&amp;nbsp; great difficulty as i cant get it to work. I have followed the data sheet and all seems fine.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I&amp;nbsp;have tried the QG8 Flash 6.zip example that is was suggested here, but still no success.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Does anyone have some working demo code or a library for doing this?&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Thanks in advance.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Wes&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 29 Jan 2008 18:33:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183707#M13567</guid>
      <dc:creator>wb79</dc:creator>
      <dc:date>2008-01-29T18:33:44Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183708#M13568</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Hi Wes,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; There is a Processor Expert Bean called intFlash that works great for this purpose.&amp;nbsp; Unfortunately the intFlash bean is not included with the Special Edition of CodeWarrior for MCU v6.1.&amp;nbsp;&amp;nbsp; You can go to the &lt;A href="http://www.freescale.com/cwregister" rel="nofollow" target="_blank"&gt;www.freescale.com/cwregister&lt;/A&gt; site and request an evaluation license.&amp;nbsp; I'm pretty sure this will give you access to the intFlash bean in Processor Expert.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; Programming Flash on the QG8 is a bit tricky because you have to run code out of internal RAM when doing the program or erase operations.&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp; Let me know if using Processor Expert works for you.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp; Thanks,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Rick&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 09:20:29 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183708#M13568</guid>
      <dc:creator>RickN</dc:creator>
      <dc:date>2008-01-30T09:20:29Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183709#M13569</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Hello Wes,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;The method that is commonly used for 9S08 devices, is to load a portion of the erase or programming code to the stack, and then execute the code from the stack.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;This issue has been raised quite often within this forum.&amp;nbsp; Perhaps use the search engine at the bottom of this page - a search for "doonstack" should achieve some relevant matches.&amp;nbsp; Most of the code examples seem to use assembler for their low level routines (the code size is more predictable), however, it is also&amp;nbsp;possible to call the assembly routines from within a C program.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;There seems to be two versions - one version uses the same code within the stack for both erase and programming operations.&amp;nbsp; The other version has different stack based routines for erase and programming.&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Regards,&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;Mac&lt;/FONT&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;FONT size="2"&gt;&lt;/FONT&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 13:09:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183709#M13569</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2008-01-30T13:09:09Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183710#M13570</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Hi Wes,&lt;BR /&gt;&lt;BR /&gt;How about &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=8121&amp;amp;query.id=363163#M8121" target="_blank"&gt;this&lt;/A&gt;?&lt;BR /&gt;&lt;BR /&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 15:41:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183710#M13570</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2008-01-30T15:41:42Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183711#M13571</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Thanks for the tips guys, i didnt realize it was that tricky to emulate EEprom &lt;IMG alt=":smileymad:" class="emoticon emoticon-smileymad" id="smileymad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-mad.gif" title="Smiley Mad" /&gt;&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I managed to get it working after your insights, i used the QG8 Flash 6 demo code, and brought my code into it. So i can confirm it does work. Just have to reallocate the eeprom address from E000 to somewhere further up such as F000&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;&lt;IMG alt=":smileyvery-happy:" class="emoticon emoticon-smileyvery-happy" id="smileyvery-happy" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-very-happy.gif" title="Smiley Very Happy" /&gt; chuffed as chips&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 30 Jan 2008 21:30:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183711#M13571</guid>
      <dc:creator>wb79</dc:creator>
      <dc:date>2008-01-30T21:30:24Z</dc:date>
    </item>
    <item>
      <title>Re: 9S08QG8 EEprom/Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183712#M13572</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;&amp;nbsp; &amp;nbsp; where I can look the 6.zip example because I have a problem of write a 256bit data in the flash for the offset/gain regulation.&lt;/P&gt;&lt;P&gt;I write this code but dont work&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;InitFlash:&lt;BR /&gt;lda FCDIV&lt;BR /&gt;and mFCDIV_DIVLD ;check if DIV bits have been set&lt;BR /&gt;bne InitFlash1 ;skip if yes&lt;BR /&gt;&lt;BR /&gt;lda #Div&lt;BR /&gt;&amp;nbsp;sta FCDIV &amp;nbsp; &amp;nbsp; ;load divisor value&lt;BR /&gt;&lt;BR /&gt;InitFlash1:&lt;BR /&gt;rts&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;;***********************************************************&lt;BR /&gt;;======memorizzazione parametri in FLASH====================&lt;BR /&gt;;***********************************************************&lt;BR /&gt;&lt;BR /&gt;MemPar&lt;BR /&gt;ldhx #$f080 ; blank pagina FLASH&lt;BR /&gt;jsr FlashErase&lt;BR /&gt;&lt;BR /&gt;ldhx #ProcsDat ; indirizzo del primo dato&lt;BR /&gt;lda RegSerie ; contenuto del dato&lt;BR /&gt;jsr FlashProg1 ; scrittura del dato&lt;BR /&gt;&lt;BR /&gt;aix #1&lt;BR /&gt;lda RegSerie+1&lt;BR /&gt;jsr FlashProg1&lt;BR /&gt;aix #1&lt;BR /&gt;lda RegSerie+2&lt;BR /&gt;jsr FlashProg1&lt;BR /&gt;aix #1&lt;BR /&gt;lda RegSerie+3&lt;BR /&gt;jsr FlashProg1&lt;BR /&gt;aix #1&lt;BR /&gt;&lt;BR /&gt;lda RegFW&lt;BR /&gt;jsr FlashProg1&lt;BR /&gt;aix #1&lt;BR /&gt;lda RegFW&lt;BR /&gt;jsr FlashProg1&lt;BR /&gt;aix #1&lt;BR /&gt;rts&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FlashProg1:&lt;BR /&gt;psha ;temporarily save entry data&lt;BR /&gt;lda #(mFSTAT_FPVIOL+mFSTAT_FACCERR) ;mask&lt;BR /&gt;&amp;nbsp; sta FSTAT ;abort any command and clear err&lt;/P&gt;&lt;P&gt;&amp;nbsp;lda #mByteProg ;mask pattern for byte prog comm&lt;BR /&gt;bsr DoOnStack ;execute prog code from stack RAM&lt;BR /&gt;ais #1 ;deallocate data location from stack&lt;BR /&gt;rts ;Z = 0 means there was an error&lt;BR /&gt;FlashProg1End:&lt;BR /&gt;&lt;BR /&gt;FlashProg1Size equ FlashProg1End - FlashProg1&lt;BR /&gt;&lt;BR /&gt;FlashErase:&lt;BR /&gt;psha ;temporarily save entry data&lt;BR /&gt;lda #(mFSTAT_FPVIOL+mFSTAT_FACCERR) ;mask&lt;BR /&gt;sta FSTAT ;abort any command and clear errors&lt;BR /&gt;lda #mSectorErase ;mask pattern for sector erase&lt;BR /&gt;bsr DoOnStack ;execute prog code from stack RAM&lt;BR /&gt;ais #1 ;deallocate data location from stack&lt;BR /&gt;rts ;Z = 0 means there was an error&lt;BR /&gt;FlashEraseEnd:&lt;BR /&gt;&lt;BR /&gt;FlashEraseSize equ FlashEraseEnd - FlashErase&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;DoOnStack:&lt;BR /&gt;pshx&lt;BR /&gt;pshh ;save pointer to flash&lt;BR /&gt;psha ;save command on stack&lt;BR /&gt;ldhx #SpSubEnd ;point at last byte to move to stack&lt;BR /&gt;;----------------------------------------------------------------&lt;BR /&gt;;Move the routine to the stack&lt;BR /&gt;SpMoveLoop:&lt;BR /&gt;lda ,x ;read from flash&lt;BR /&gt;psha ;move onto stack&lt;BR /&gt;aix #-1 ;next byte to move&lt;BR /&gt;cphx #SpSub-1 ;past end?&lt;BR /&gt;bne SpMoveLoop ;loop till whole sub on stack&lt;BR /&gt;;----------------------------------------------------------------&lt;BR /&gt;tsx ;point to sub on stack&lt;BR /&gt;tpa ;move CCR to A for testing&lt;BR /&gt;and #$08 ;check the I mask&lt;BR /&gt;bne I_set ;skip if I already set&lt;BR /&gt;;----------------------------------------------------------------&lt;BR /&gt;sei ;block interrupts while FLASH busy&lt;BR /&gt;lda SpSubSize+6,sp ;preload data for command&lt;BR /&gt;jsr ,x ;execute the sub on the stack&lt;BR /&gt;cli ;ok to clear I mask now&lt;BR /&gt;bra I_cont ;continue to stack de-allocation&lt;BR /&gt;;================================================================&lt;BR /&gt;I_set:&lt;BR /&gt;lda SpSubSize+6,sp ;preload data for command&lt;BR /&gt;jsr ,x ;execute the sub on the stack&lt;BR /&gt;I_cont:&lt;BR /&gt;ais #SpSubSize+3 ;deallocate sub body + H:X + command&lt;BR /&gt;;H:X flash pointer OK from SpSub&lt;BR /&gt;lsla ;A=00 &amp;amp; Z=1 unless PVIOL or ACCERR&lt;BR /&gt;&amp;nbsp; rts ;to flash where DoOnStack was called&amp;nbsp;&lt;BR /&gt;&lt;BR /&gt;SpSub:&lt;BR /&gt;ldhx SpSubSize+4,sp ;get flash address from stack&lt;BR /&gt;sta 0,x ;write to flash; latch addr and data&lt;BR /&gt;lda SpSubSize+3,sp ;get flash command&lt;BR /&gt;sta FCMD ;write the flash command&lt;BR /&gt;lda #mFSTAT_FCBEF ;mask to initiate command&lt;BR /&gt;sta FSTAT ;[pwpp] register command&lt;BR /&gt;nop ;[p] want min 4~ from w cycle to r&lt;BR /&gt;ChkDone:&lt;BR /&gt;lda FSTAT ;[prpp] so FCCF is valid&lt;BR /&gt;lsla ;FCCF now in MSB&lt;BR /&gt;bpl ChkDone ;loop if FCCF = 0&lt;BR /&gt;SpSubEnd:&lt;BR /&gt;rts&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Where is a mistake?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Tanks in advance&lt;/P&gt;&lt;P&gt;fuma&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 04 Feb 2012 18:09:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/9S08QG8-EEprom-Flash/m-p/183712#M13572</guid>
      <dc:creator>fuma</dc:creator>
      <dc:date>2012-02-04T18:09:47Z</dc:date>
    </item>
  </channel>
</rss>

