<?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: Saving Data In Flash on GT32 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134594#M3743</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;Well I just took what you posted and added just enough to make it a full programme.&lt;BR /&gt;Then I put it in my demo GB board and it works!&lt;/P&gt;&lt;P&gt;Rhinoceroshead is correct about the delay but it seems to work without it!&lt;/P&gt;&lt;P&gt;I wouldn't be relying on this though for the sake of a few bytes.&lt;/P&gt;&lt;P&gt;I have included my programme here with the extra delay commented out along with additional error checking that you may want to include escpecially if you are still having problems.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;.NOLIST$Include "9S08GB60v1rdp.inc".LIST* Additional initialisation by pegPROGFLASH EQU $0300 ORG RamStartfilterontime RMB 2fltdisp  RMB 2setpoint RMB 2 ORG $D000flashbuf RMB 8 ORG RomStart MOV #$11,filterontime MOV #$22,filterontime+1 MOV #$33,fltdisp MOV #$44,fltdisp+1 MOV #$55,setpoint MOV #$66,setpoint+1  LDA #mBKGDPE STA SOPT *Hello All.*I'm using the 9s08gt32 in an application that requires that I save a small amount of semi-perm. data in internal flash. I've followed the Freescale guidelines pretty carefully with these results:*my routines work correctly if I single-step thru them*if I use them while running at full speed they don't work*This is how I set the main clock:CLOCK_INIT: mov #$28,icgc1 mov #$31,icgc2 lda icgs1 ; dummy read mov #01,icgs1; rts;which sets FEI mode with a bus clock of approx. 5.4MHz (which I've verified independantly).;I set the flash clock thusly: lda #$1f sta fcdiv which should yield a flash clock of approx. 174KHz. lda #$1f sta fcdiv* copy routine to RAM by peg ldx #WFLEND-PROGFLASHF+1WRRAM: lda PROGFLASHF-1,x sta $02FF,x dbnzx wrram* now actually do it by peg jsr saveflash bra *FAILED: bra *;Then I have a small routine if flash which gets copied down to ram at $0300 by the startup routine. This routine does the actual writing of flash, and is called by the main routine which runs out of flash. Here is what that looks like:PROGFLASHF:*write the command sta fcmd lda #$80 sta fstat nop* additional delay and error checking by peg* brn ** lda fstat* and #mFPVIOL|mFACCERR* bne failedWFLOOP: lda fstat lsla bpl wfloopWFLEND: rts;Finally, here is the main flashing routine:SAVEFLASH:; check for errors lda fstat and #$30 beq asfbt1; had error(s), try to clr lda #$30 sta fstat; then we have to erase; our flash buffer @ $d000; min erase is 512 bytes;ASFBT1: sta flashbuf+3 ; any data lda #$40 ; page erase jsr progflash; then write the marker lda #$a5 sta flashbuf lda #$20 ; write byte jsr progflash lda #$5a sta flashbuf+1 lda #$20 jsr progflash; then filterontime lda filterontime sta flashbuf+2 lda #$20 jsr progflash lda filterontime+1 sta flashbuf+3 lda #$20 jsr progflash; then filter display lda fltdisp sta flashbuf+4 lda #$20 jsr progflash lda fltdisp+1 sta flashbuf+5 lda #$20 jsr progflash; then temp lda setpoint sta flashbuf+$6 lda #$20 jsr progflash lda setpoint+1 sta flashbuf+$7 lda #$20 jsr progflash rts;Its probably something simple, but I just don't see it yet. Any help would be appreciated.;ron* reset vector by peg org $fffe DW RomStart&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Don't forget to let us know what you find...&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Thu, 04 May 2006 18:02:23 GMT</pubDate>
    <dc:creator>peg</dc:creator>
    <dc:date>2006-05-04T18:02:23Z</dc:date>
    <item>
      <title>Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134592#M3741</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;SPAN&gt;Hello All.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;I'm using the 9s08gt32 in an application that requires that I save a small amount of semi-perm. data in internal flash. I've followed the Freescale guidelines pretty carefully with these results:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;my routines work correctly if I single-step thru them&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;if I use them while running at full speed they don't work&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;This is how I set the main clock:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLOCK_INIT:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mov #$28,icgc1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mov #$31,icgc2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda icgs1 ; dummy read&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;mov #01,icgs1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;which sets FEI mode with a bus clock of approx. 5.4MHz (which I've verified independantly).&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;I set the flash clock thusly: lda #$1f sta fcdiv which should yield a flash clock of approx. 174KHz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then I have a small routine if flash which gets copied down to ram at $0300 by the startup routine. This routine does the actual writing of flash, and is called by the main routine which runs out of flash. Here is what that looks like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;PROGFLASH:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; write the command&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta fcmd&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$80&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta fstat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;nop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;WFLOOP:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda fstat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lsla&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;bpl wfloop&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Finally, here is the main flashing routine:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SAVEFLASH:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; check for errors&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda fstat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;and #$30&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;beq asfbt1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; had error(s), try to clr&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$30&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta fstat&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; then we have to erase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; our flash buffer @ $d000&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; min erase is 512 bytes&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;;&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ASFBT1:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+3 ; any data&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$40 ; page erase&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; then write the marker&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$a5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20 ; write byte&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$5a&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; then filterontime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda filterontime&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+2&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda filterontime+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+3&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; then filter display&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda fltdisp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+4&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda fltdisp+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+5&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;; then temp&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda setpoint&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+$6&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda setpoint+1&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;sta flashbuf+$7&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;lda #$20&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;jsr progflash&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;rts&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Its probably something simple, but I just don't see it yet. Any help would be appreciated.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;ron&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2006 07:51:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134592#M3741</guid>
      <dc:creator>glork</dc:creator>
      <dc:date>2006-05-04T07:51:32Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134593#M3742</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Here is one thing I see that may cause the problem you describe.&amp;nbsp; The flow chart on page 49 of the datasheet says that you should wait a minimum of 4 bus cycles between setting the FCBEF and then reading FSTAT.&amp;nbsp; You have one NOP there, which only uses 1 bus cycle.&amp;nbsp; You could try throwing a few more NOPs in there to see if that helps.&amp;nbsp;&amp;nbsp;Or if you want to keep the programming routine in RAM as short as possible, you could replace the NOP with a MUL (only 1 byte opcode but 5 cycles) as long as you aren't holding anything important in the index register.&lt;/P&gt;&lt;P&gt;I'm still looking, but that's one thing&amp;nbsp;you can&amp;nbsp;check.&amp;nbsp; It would explain the fact that it works when stepped.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2006 11:04:46 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134593#M3742</guid>
      <dc:creator>rhinoceroshead</dc:creator>
      <dc:date>2006-05-04T11:04:46Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134594#M3743</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;Well I just took what you posted and added just enough to make it a full programme.&lt;BR /&gt;Then I put it in my demo GB board and it works!&lt;/P&gt;&lt;P&gt;Rhinoceroshead is correct about the delay but it seems to work without it!&lt;/P&gt;&lt;P&gt;I wouldn't be relying on this though for the sake of a few bytes.&lt;/P&gt;&lt;P&gt;I have included my programme here with the extra delay commented out along with additional error checking that you may want to include escpecially if you are still having problems.&lt;/P&gt;&lt;P&gt;&lt;SPAN class="msg_source_code"&gt;&lt;SPAN class="text_smallest"&gt;Code:&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;/P&gt;&lt;PRE&gt;.NOLIST$Include "9S08GB60v1rdp.inc".LIST* Additional initialisation by pegPROGFLASH EQU $0300 ORG RamStartfilterontime RMB 2fltdisp  RMB 2setpoint RMB 2 ORG $D000flashbuf RMB 8 ORG RomStart MOV #$11,filterontime MOV #$22,filterontime+1 MOV #$33,fltdisp MOV #$44,fltdisp+1 MOV #$55,setpoint MOV #$66,setpoint+1  LDA #mBKGDPE STA SOPT *Hello All.*I'm using the 9s08gt32 in an application that requires that I save a small amount of semi-perm. data in internal flash. I've followed the Freescale guidelines pretty carefully with these results:*my routines work correctly if I single-step thru them*if I use them while running at full speed they don't work*This is how I set the main clock:CLOCK_INIT: mov #$28,icgc1 mov #$31,icgc2 lda icgs1 ; dummy read mov #01,icgs1; rts;which sets FEI mode with a bus clock of approx. 5.4MHz (which I've verified independantly).;I set the flash clock thusly: lda #$1f sta fcdiv which should yield a flash clock of approx. 174KHz. lda #$1f sta fcdiv* copy routine to RAM by peg ldx #WFLEND-PROGFLASHF+1WRRAM: lda PROGFLASHF-1,x sta $02FF,x dbnzx wrram* now actually do it by peg jsr saveflash bra *FAILED: bra *;Then I have a small routine if flash which gets copied down to ram at $0300 by the startup routine. This routine does the actual writing of flash, and is called by the main routine which runs out of flash. Here is what that looks like:PROGFLASHF:*write the command sta fcmd lda #$80 sta fstat nop* additional delay and error checking by peg* brn ** lda fstat* and #mFPVIOL|mFACCERR* bne failedWFLOOP: lda fstat lsla bpl wfloopWFLEND: rts;Finally, here is the main flashing routine:SAVEFLASH:; check for errors lda fstat and #$30 beq asfbt1; had error(s), try to clr lda #$30 sta fstat; then we have to erase; our flash buffer @ $d000; min erase is 512 bytes;ASFBT1: sta flashbuf+3 ; any data lda #$40 ; page erase jsr progflash; then write the marker lda #$a5 sta flashbuf lda #$20 ; write byte jsr progflash lda #$5a sta flashbuf+1 lda #$20 jsr progflash; then filterontime lda filterontime sta flashbuf+2 lda #$20 jsr progflash lda filterontime+1 sta flashbuf+3 lda #$20 jsr progflash; then filter display lda fltdisp sta flashbuf+4 lda #$20 jsr progflash lda fltdisp+1 sta flashbuf+5 lda #$20 jsr progflash; then temp lda setpoint sta flashbuf+$6 lda #$20 jsr progflash lda setpoint+1 sta flashbuf+$7 lda #$20 jsr progflash rts;Its probably something simple, but I just don't see it yet. Any help would be appreciated.;ron* reset vector by peg org $fffe DW RomStart&lt;/PRE&gt;&lt;P&gt;&lt;BR /&gt;&amp;nbsp;&lt;BR /&gt;&lt;/P&gt;&lt;P&gt;Don't forget to let us know what you find...&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2006 18:02:23 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134594#M3743</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-04T18:02:23Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134595#M3744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;I just read the Flash section of the S08GT32 datasheet very carefully and I didn't notice it&amp;nbsp;ever mentioning anything about having to program the flash from code executing in RAM.&amp;nbsp; The HC08GP32, however,&amp;nbsp;clearly states that it must program from RAM.&amp;nbsp; Are we blindly assuming that it is like the HC08 in this respect or does it in fact have to be executed from RAM?&amp;nbsp; It seems like a few days ago there was a similar post that seemed to get resolved by executing from RAM, but I know sometimes when debugging, it's easy to apply two solutions to one problem and then misinterpret which solution it was that really solved the problem.&amp;nbsp; Peg, could you by any chance, try changing the address of the Flash programming code that you just posted to a Flash location and see if it works?&amp;nbsp; I'm just curious&amp;nbsp; It's&amp;nbsp;not a big deal if you don't have time.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 04 May 2006 22:59:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134595#M3744</guid>
      <dc:creator>rhinoceroshead</dc:creator>
      <dc:date>2006-05-04T22:59:40Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134596#M3745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi rhinoseroshead,&lt;/P&gt;&lt;P&gt;It might not say there but it does refer you to the HCS08RM where it definately does say the flash doesn't work while erase/prog.&lt;/P&gt;&lt;B&gt;&lt;FONT face="Arial"&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;P align="left"&gt;&lt;B&gt;&lt;FONT face="Arial"&gt;&lt;EM&gt;4.8.2 Erase One 512-Byte Page in FLASH&lt;/EM&gt;&lt;/FONT&gt;&lt;/B&gt;&lt;/P&gt;&lt;FONT face="Arial"&gt;&lt;/FONT&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;&lt;EM&gt;Program and erase operations for the FLASH memory are a little more&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;&lt;EM&gt;complicated compared to many application programs because it is not&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;&lt;EM&gt;possible to execute a program out of FLASH during FLASH program and&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;&lt;EM&gt;erase operations.&lt;/EM&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;Also after I turned the computer off last night I realised that I put a relative branch into the error check which is in the code the moves to RAM. So it will blow up if it branches. Woops! No time to fix it now.&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;Regards Peg&lt;/FONT&gt;&lt;/P&gt;&lt;P align="left"&gt;&lt;FONT face="Arial"&gt;&amp;nbsp;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 04:40:16 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134596#M3745</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-05T04:40:16Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134597#M3746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;BR /&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;rhinoceroshead wrote:&lt;BR /&gt;&lt;DIV&gt;I just read the Flash section of the S08GT32 datasheet very carefully and I didn't notice it ever mentioning anything about having to program the flash from code executing in RAM. The HC08GP32, however, clearly states that it must program from RAM. Are we blindly assuming that it is like the HC08 in this respect or does it in fact have to be executed from RAM? It seems like a few days ago there was a similar post that seemed to get resolved by executing from RAM, but I know sometimes when debugging, it's easy to apply two solutions to one problem and then misinterpret which solution it was that really solved the problem. Peg, could you by any chance, try changing the address of the Flash programming code that you just posted to a Flash location and see if it works? I'm just curious It's not a big deal if you don't have time.&lt;/DIV&gt;&lt;BR /&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;Hi Rhinoceroshead and Peg.&lt;BR /&gt;It is strictly prohibited to run out of flash whilst trying to erase/program it. I suppose this is because the flash gets disabled when the high voltage gets keyed on.&lt;BR /&gt;&lt;BR /&gt;I tried putting in more cycles in the place recommended by Peg (added 5 nops to the 1 already there for a total of 6). This appeared to make no difference at all; it still works in single-step but not at full speed. I'm still missing something.&lt;BR /&gt;ron&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 05:26:51 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134597#M3746</guid>
      <dc:creator>glork</dc:creator>
      <dc:date>2006-05-05T05:26:51Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134598#M3747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi Ron,&lt;/P&gt;&lt;P&gt;What if you assemble and run my code as is.&lt;BR /&gt;The error check may throw some light on it, though you will have do fix my faulty error branch.&lt;/P&gt;&lt;P&gt;Anyway I'm of to do some stuff that i will get paid for now....&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 05:41:00 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134598#M3747</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-05T05:41:00Z</dc:date>
    </item>
    <item>
      <title>Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134599#M3748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;Hi Rhino &amp;amp; Peg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I haven't had my coffee yet, but I think I won't tell too many rubbish here &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;. Well at least I'll try.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;The topic is quite similar to a &lt;A href="http://forums.freescale.com/freescale/board/message?board.id=8BITCOMM&amp;amp;message.id=1084" target="_blank"&gt;new one&lt;/A&gt;... Still, let me clarifiy a few things, if I may.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;It is not physically possible to execute from a Flash block being programmed because to program a block the charge pump is applying the high voltage on the array.&lt;BR /&gt;But there is nothing preventing you from executing code from another block while one is under the high voltage programming voltage.&lt;BR /&gt;This also applies to all HC9S12 and S12X.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Actually, there is only one thing forcing you to execute programming routine from RAM is when:&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - You only have one Flash Block,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; - You want to reprogram all Flash.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;So, that's why a small HC08 datasheet might lead you to the RAM.&lt;BR /&gt;Also, some of these having very small RAM on top of very small Flash, the programming routines were implemented in ROM (generally all HC(S)08 devices below 8-16KB Flash size).&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Now, I'll go and have this famous coffee....&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;Alban.&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 14:56:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134599#M3748</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-05-05T14:56:44Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134600#M3749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;OK Alban, I hope you have had that coffee.&lt;/P&gt;&lt;P&gt;I am starting to hate the word 'block' it seems to have too many meanings with reference to FLASH.&lt;BR /&gt;Here's what I understand:&lt;/P&gt;&lt;P&gt;FLASH Array: All of the flash. Sometimes called a block.&lt;/P&gt;&lt;P&gt;FLASH Page: Minimum erase size (512 in a GB/GT) Sometimes called a block&lt;/P&gt;&lt;P&gt;FLASH Block with reference to block protection: Multiples of pages 1,2,4,8,16,32,64 pages.&lt;/P&gt;&lt;P&gt;FLASH row: Rows relate to burst mode programming (8 rows of 64 in GB/GT page).&lt;/P&gt;&lt;P&gt;So what is the block that you are referring to. How many of your blocks are there in a GB/GT60. That is these blocks that you can programme one from the other. Because I can't find any reference to this in HCS08.&lt;/P&gt;&lt;P&gt;Time to grab a beer! (I am 10 hours ahead of Alban).&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;05-05-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;06:53 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 15:49:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134600#M3749</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-05T15:49:52Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134601#M3750</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;My guess is that Alban is referring to the&amp;nbsp;segment which you (Peg) are calling a 'page' when erasing and he is referring to a 'row' when programming.&amp;nbsp; My&amp;nbsp;(probably out of date)&amp;nbsp;understanding from an electrical standpoint is that Flash and EEPROM are the same thing, except EEPROM can distribute the high voltage and erase signals down to the byte level, which requires a lot of extra address decoding logic and Flash can be fabricated much more densely than byte erasable EEPROM for this reason.&amp;nbsp; So using Peg's terminology, which sounds right on to me, the 'page' is the minimum erasable chunk, and this would be defined by how many bits of the address&amp;nbsp;bus are decoded for the erase signal.&amp;nbsp; Then the 'row' is defined by how many bits of the address are decoded for the high-voltage signal, which must be present for programming or erasing -&amp;nbsp;meaning the row size must be smaller&amp;nbsp;or the same size as&amp;nbsp;the page size.&amp;nbsp; The 'block' term also seems poorly defined to me, but I like Peg's interpretation where it means block protection.&amp;nbsp; The only problem with that is that the block protection has nothing to do with Flash technology electrically and just refers to the number of bits used by Freescale to define the available points that divide protected from unprotected Flash.&amp;nbsp; Different Flash manufacturers might use slightly different techniques for manufacturing, and they have a right to call their segments as they please - but then it gets confusing when their definitions overlap.&amp;nbsp; Anyway, I&amp;nbsp;would like to check this out, because it would really be nice to know if you can write into Flash while executing from Flash.&amp;nbsp; It should be physically and electrically possible to do it as long as the&amp;nbsp;segment of Flash you are executing from is not being disturbed by high voltage or erase signals as Alban is pointing out.&amp;nbsp; However, if Freescale engineers are looking at the first few bits of the program counter to determine when the high-voltage is allowed to turn on, it would&amp;nbsp;take fewer logic gates&amp;nbsp;for them to mask out the entire Flash array rather than to mask just the row that is being programmed, so it is also reasonable for them to do that as well.&amp;nbsp; I'm fairly certain that the HC08GP32 can not write to Flash at all without executing from RAM but I will gladly confirm this sometime over the next few days.&amp;nbsp; I have an SX12DP512 board at home that I can test this on too - but on that particular device there are multiple independent Flash modules anyway, so you could just as easily execute from one while writing to another and you would never need to copy code to RAM.&amp;nbsp; I would also gladly mail a bottle of beer to&amp;nbsp;Australia if Peg would be kind enough to test this on the HCS08.&amp;nbsp; :smileyhappy:&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 05 May 2006 22:50:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134601#M3750</guid>
      <dc:creator>rhinoceroshead</dc:creator>
      <dc:date>2006-05-05T22:50:05Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134602#M3751</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;Well I've done some experimenting and this is what I have found:&lt;/P&gt;&lt;P&gt;I fixed the problem with my previously posted code.&lt;/P&gt;&lt;P&gt;I moved the flash buffer to E000. and made two versions (GLORK.asm and GLORKram.asm. the ram one is mostly just the fixed original code and the non ram one tries to write&amp;nbsp;FLASH at E000 from FLASH very near the bottom of the array. They are both actually the same with different bits commented out.&lt;/P&gt;&lt;P&gt;The RAM one works perfectly as expected.&lt;/P&gt;&lt;P&gt;Now if there is several "blocks" (there is that word again!) surely some at the very bottom is in a different block to some very near the top.&lt;/P&gt;&lt;P&gt;What I found is it doesn't work!&lt;/P&gt;&lt;P&gt;I think I found the answer to Glork's problem as well. That is I believe he may be copying his routine down to RAM but actually using the version in FLASH.&lt;/P&gt;&lt;P&gt;This is exactly what I found:&lt;/P&gt;&lt;P&gt;If I single step all the way through it appears to work perfectly, even the bits I added where I read the recently flashed values back and copy them to RAM. But if you power down and back up the FLASH all reads $FF!&lt;/P&gt;&lt;P&gt;If I single step half way through then RUN, I end up in the FLASH failure loop.&lt;/P&gt;&lt;P&gt;If I RUN right from the top it blows up and when I stop it I am anywhere in memory.&lt;/P&gt;&lt;P&gt;So it appears that when you write the values to FLASH to prepare for flashing these values appear to the user programme as the actually flashed data.&lt;/P&gt;&lt;P&gt;So this begs the question. Can you use FLASH as RAM?&lt;/P&gt;&lt;P&gt;I'm off to see if I can find some documents on how this FLASH actually works.&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Message Edited by peg on &lt;SPAN class="date_text"&gt;05-06-2006&lt;/SPAN&gt;&lt;SPAN class="time_text"&gt;01:18 PM&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2006 10:17:10 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134602#M3751</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-06T10:17:10Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134603#M3752</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;After some more testing I found this:&lt;/P&gt;&lt;P&gt;If I start with erased flash at E000 then&amp;nbsp;multistep the programme with the erase command commented out, I can flash the data in and it becomes non-volatile!&lt;/P&gt;&lt;P&gt;I still can't run it at full speed run though.&lt;/P&gt;&lt;P&gt;Anyway, all this proves is that even with the biggest available flash array you still have to execute flash erase/prog from RAM. This applies to ALL 8-bit FLASH based MCU's!&lt;/P&gt;&lt;P&gt;If you try to do it from FLASH you will get all sorts of strange results, none of which I'm sure no one is going to rely on.&lt;/P&gt;&lt;P&gt;BTW, AN1837 explains how the flash works but unfortunately doesn't really shed any light on what is going on here as it tends to look at it on a bit level and does not explain how the actual programming mechanism works at a byte level.&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2006 18:00:32 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134603#M3752</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-06T18:00:32Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134604#M3753</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;Dear Peg,&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I'm not sure I share your point of view on the generalization to all 8Bit MCUs.&lt;/DIV&gt;&lt;DIV&gt;For instance the MC68HC908GZ60 has two so-called blocks with two sets of registers. FLASH-1 and FLASH-2 in de datasheet.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;I haven't deeply read yet the previous posts with all the tests you took time to do.&lt;/DIV&gt;&lt;DIV&gt;I'll come back to these later...&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;DIV&gt;Cheers,&lt;/DIV&gt;&lt;DIV&gt;Alban.&lt;/DIV&gt;&lt;DIV&gt;&amp;nbsp;&lt;/DIV&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2006 21:57:53 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134604#M3753</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-05-06T21:57:53Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134605#M3754</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;To Rhino, Peg &amp;amp; Alban:&lt;BR /&gt;After some testing I can report the following:&lt;BR /&gt;1. As far as I can tell my code is executing correctly (verified by sintle-stepping the debugger which is connected and running the actual target).&lt;BR /&gt;2. I follow the freescale procedure (you can see my code) (yes, I did put in the error check recommended by Peg).&lt;BR /&gt;3. It still works in single-step mode but not running at full speed.&lt;BR /&gt;&lt;BR /&gt;I'm sure that it is possible to program flash because the debugger/pod does it all the time. I suppose there is some deviation to the procedure that freescale knows about but hasn't seen fit to publish, which is absolutely typical of them.&lt;BR /&gt;&lt;BR /&gt;Designing with these micros is what I do for a living; its my only source of income. I never have time to agonize over/piddle with this type of problem. If I can't make something work in a reasonable (read short) amount of time I have to abandon it for a solution that actually works. In this case I will have to patch in an external memory that really does work.&lt;BR /&gt;&lt;BR /&gt;Thanks for your help.&lt;BR /&gt;ron&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 06 May 2006 23:52:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134605#M3754</guid>
      <dc:creator>glork</dc:creator>
      <dc:date>2006-05-06T23:52:40Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134606#M3755</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;Glork,&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;I would think there could be a problem with code or something like this. (I'm thinking initialization of clocking divider of the charge pump or&amp;nbsp;a delay not respected somewhere).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;These Flash are starting to be quite old and are SST licensed (as you can read in footer of quite a few documents). They have been used in zillions of applications everyday for more than 5-7 years.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;I suggest you&lt;/FONT&gt; &lt;A href="https://www.freescale.com/webapp/servicerequest.create_SR.framework?regFlag=fromOpenSR" rel="nofollow" target="_blank"&gt;&lt;FONT face="Comic Sans MS"&gt;Open a Service Request NOW&lt;/FONT&gt;&lt;/A&gt; &lt;FONT face="Comic Sans MS"&gt;so your problem is treated ASAP and you can eat without having to worry. (please&amp;nbsp;private me&amp;nbsp;the SR# and I'll follow). Include CodeWarrior project as an attachment but do NOT select it as a CodeWarrior/Tool problem !&lt;BR /&gt;The page is also accessible from&lt;/FONT&gt; &lt;A href="http://www.freescale.com/techsupport" rel="nofollow" target="_blank"&gt;&lt;FONT face="Comic Sans MS"&gt;&lt;/FONT&gt;&lt;/A&gt;&lt;A href="http://www.freescale.com/techsupport" target="test_blank"&gt;http://www.freescale.com/techsupport&lt;/A&gt;&lt;FONT face="Comic Sans MS"&gt;.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Comic Sans MS"&gt;People behind the Technical Request &lt;STRONG&gt;HAVE&lt;/STRONG&gt; to reply to you quickly.&lt;BR /&gt;Most &lt;EM&gt;Freescalers&lt;/EM&gt; only appear on the Forums on a &lt;U&gt;voluntary&lt;/U&gt; basis only.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Cheers,&lt;BR /&gt;Alban.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2006 00:27:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134606#M3755</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-05-07T00:27:04Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134607#M3756</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Hi,&lt;/P&gt;&lt;P&gt;I was going to say all S08 are like this, then when writing it I got cocky and expanded it to cover everything even though I have probably never even seen more than half of them. Sorry!&lt;/P&gt;&lt;P&gt;Perhaps I am correct if it is qualified with "except where there obviously is distinctly seperate flash arrays".&lt;/P&gt;&lt;P&gt;BTW all of the stuff I have presented in this thread in no way indicates there is any problem with the programming of flash on these devices!&lt;/P&gt;&lt;P&gt;I have been trying to do things that are outside of what the manuals suggest can be done. All of what they say works - DOES WORK!&lt;/P&gt;&lt;P&gt;All that I have found is that you seem to be able to get away with only one cycle delay before checking FSTAT. But this doesn't mean to do this, more that you should be careful that you have the correct delay because just the fact that it works doesn't mean it will do so forever, always. Flash wears out and gets slower to prog/erase.&lt;/P&gt;&lt;P&gt;Also I found that you seem to be able to programme flash from code running in flash if you do it slowly or something. But it doesn't really work.&lt;/P&gt;&lt;P&gt;Ron, your code as presented is WRONG! And I have proven that if you run your code as presented you will get the results you are seeing. You are calling progflash which is the version in flash. Please check you are really executing in RAM before making wild accusations.&lt;/P&gt;&lt;P&gt;Regards Peg&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2006 06:33:47 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134607#M3756</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-07T06:33:47Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134608#M3757</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;Alban, Peg &amp;amp; Rhino.&lt;BR /&gt;Well...ok this is really embarrasing. I'm old enough to know that if you post a rant you will get caught with something stupid.&lt;BR /&gt;&lt;BR /&gt;My code always worked when I single-steped, never worked running full out.&lt;BR /&gt;&lt;BR /&gt;Let me give everyone on the forum a hint: IF YOU NEED TO PROGRAM FLASH BE SURE TO TURN OFF ANY HEART-BEAT OR OTHER INTERRUPTS FIRST!!!!&lt;BR /&gt;&lt;BR /&gt;The fact is that my code (with some suggested enhancements from you guys) works just fine. But of course if an interrupt occurs while the flash is disabled...&lt;BR /&gt;&lt;BR /&gt;Sheesh, I'm never going to rant again.&lt;BR /&gt;ron&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2006 11:37:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134608#M3757</guid>
      <dc:creator>glork</dc:creator>
      <dc:date>2006-05-07T11:37:07Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134609#M3758</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Well.....&lt;/P&gt;&lt;P&gt;Without the banter this thread probably would have stalled, unresolved.&lt;/P&gt;&lt;P&gt;Now at least it should assist people in the future.&lt;/P&gt;&lt;P&gt;Although your promise is also permanently recorded for anyone to quote back at you in the future. &lt;IMG alt=":smileywink:" class="emoticon emoticon-smileywink" id="smileywink" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-wink.gif" title="Smiley Wink" /&gt;&lt;/P&gt;&lt;P&gt;Peg&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2006 17:11:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134609#M3758</guid>
      <dc:creator>peg</dc:creator>
      <dc:date>2006-05-07T17:11:30Z</dc:date>
    </item>
    <item>
      <title>Re: Flash Block Prog and Code Execution from Flash-RAM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134610#M3759</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;Dear Ron,&lt;/P&gt;&lt;P&gt;&lt;U&gt;I am completely with you and I understand you let the pressure out !&lt;/U&gt;&lt;BR /&gt;Actually I suggested a board to the Admins with "Express Yourself" as a title...&lt;BR /&gt;A board where people could just shout their frustration because they can't get it working.&lt;/P&gt;&lt;P&gt;Funnily enough, this board was not approved &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;&lt;/P&gt;&lt;P&gt;I'm also 100% with you with Interrupts during Flash Programming.&lt;BR /&gt;If an interrupt occurs and should execute code from Flash, it will screw the programming.&lt;BR /&gt;On HC08 as the Adress to program/erase is locked by reading it, if you have an interrupt, you could erase the vector page... Except with block protection.&lt;BR /&gt;&lt;STRONG&gt;Even more important on HC08 (and not S08), you have to do the timings 'manually' and if an interrupt occurs it could change the timings and DAMAGE the cells...&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;&lt;EM&gt;But I will only say: I like when things go to plan..........&lt;BR /&gt;&lt;/EM&gt;&lt;/STRONG&gt;Alban. {GT exists both on HC08 and S08&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;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 07 May 2006 21:17:52 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134610#M3759</guid>
      <dc:creator>Alban</dc:creator>
      <dc:date>2006-05-07T21:17:52Z</dc:date>
    </item>
    <item>
      <title>Re: Saving Data In Flash on GT32</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134611#M3760</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;DIV&gt;&lt;/DIV&gt;&lt;P&gt;&lt;FONT size="2"&gt;The application note AN2770 is about a Flash Library&lt;/FONT&gt; (&lt;FONT face="Courier New" size="2"&gt;HCS08_Flash_Lib.Lib)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Do you know where I can download this library?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;I think it seems very useful and easy. Do you use it&lt;/FONT&gt;&lt;FONT face="Courier New" size="2"&gt;?&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Thanks&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="Courier New" size="2"&gt;Stefano&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 09 Jun 2006 20:32:19 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Saving-Data-In-Flash-on-GT32/m-p/134611#M3760</guid>
      <dc:creator>Steolino</dc:creator>
      <dc:date>2006-06-09T20:32:19Z</dc:date>
    </item>
  </channel>
</rss>

