<?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: Writing to Flash with LAP on S08DZ128 in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216193#M18784</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it's possible to use LAP, although I have been doing it with pages until now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't have a thorough look at your code, just one obvious mistake that caught my eye.&amp;nbsp; Shouldn't you be right shifting?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set LAP ( Linear Address Pointer ) to desired location */&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LAP0 = 0xFF &amp;amp; Address;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP1 = 0XFF &amp;amp; ( Address &lt;FONT color="#ff0000"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; 8 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP2 = 0xFF &amp;amp; ( Address &lt;FONT color="#ff0000"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; 16 );&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&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>Tue, 03 Aug 2010 13:45:17 GMT</pubDate>
    <dc:creator>tonyp</dc:creator>
    <dc:date>2010-08-03T13:45:17Z</dc:date>
    <item>
      <title>Writing to Flash with LAP on S08DZ128</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216192#M18783</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;HI there,&lt;/P&gt;&lt;P&gt;&amp;nbsp;I´m writing a Flashdriver to be able to write data to the flash memory from a bootloader application. I read a lot about that and searched though the forum but unfortunately didn´t gest the desired results. So my question is, if I can read / write to the complete flash memory by using the LAP register ? The documentation says yes, but it seems to be inconsitent sometimes.&lt;/P&gt;&lt;P&gt;What about the PPAGE method ? Are there pro´s and con´s between both methods ? Anyway, I placed my code below, so maybe anyone can help me. Thank you very much in advance for helping !&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;void RAM_Routine( tUI16 Address, tUI8 Value, tUI8 Command )&lt;BR /&gt;{&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* clear FACCERR flag */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= FSTAT_FACCERR_MASK_UI8;&lt;BR /&gt;&lt;BR /&gt;#ifdef MMU_USAGE == LAP_ADDRESSING&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set LAP ( Linear Address Pointer ) to desired location */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LAP0 = 0xFF &amp;amp; Address;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP1 = 0XFF &amp;amp; ( Address &amp;lt;&amp;lt; 8 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP2 = 0xFF &amp;amp; ( Address &amp;lt;&amp;lt; 16 );&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /*&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("PSHA");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("LDA @Address:LINEAR_HIGH");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("STA LAP2");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("LDA @Address:LINEAR_MID");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("STA LAP1");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("LDA @Address:LINEAR_LOW");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("STA LAP0");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;_asm("PULA");&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* increment LAP register value / step to next byte in the flash */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LB = Value;&lt;BR /&gt;&lt;BR /&gt;#elif MMU_USAGE == PAGED&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* TODO incrementing of data pointer */&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* step to next byte in the flash */&lt;BR /&gt;#else&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* write data to the block to erase */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; *(tUI8*)Address = Value;&lt;BR /&gt;#endif /*MMU_USAGE*/&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* load command */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FCMD |= Command;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* set FCBEF to start the command */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;FSTAT |= FSTAT_FCBEF_MASK_UI8;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/* wait for four cycles before checking FSTAT register */&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;(void)FCDIV;&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;/*was the operation succesful?*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;if( !( FSTAT &amp;amp; FSTAT_ERROR_MASK_UI8 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;{&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; /*wait for FCCF flag*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; while( !( FSTAT &amp;amp; FSTAT_FCCF_MASK_UI8 ) )&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; {&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; /*change this to the system used function to reset the watchdog*/&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; SERVICE_WATCHDOG();&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;&amp;nbsp; }&lt;BR /&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;}&lt;BR /&gt;&lt;BR /&gt;&amp;nbsp; return;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; &amp;nbsp;&lt;BR /&gt;}&lt;BR /&gt;&lt;BR /&gt;/*** end of RAM_Routine() ***/&lt;/EM&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 04:15:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216192#M18783</guid>
      <dc:creator>lc_hc</dc:creator>
      <dc:date>2010-08-03T04:15:49Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Flash with LAP on S08DZ128</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216193#M18784</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Yes, it's possible to use LAP, although I have been doing it with pages until now.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I didn't have a thorough look at your code, just one obvious mistake that caught my eye.&amp;nbsp; Shouldn't you be right shifting?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;BLOCKQUOTE&gt;&lt;HR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; /* set LAP ( Linear Address Pointer ) to desired location */&lt;P&gt;&lt;EM&gt;&amp;nbsp;&amp;nbsp; &amp;nbsp;LAP0 = 0xFF &amp;amp; Address;&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP1 = 0XFF &amp;amp; ( Address &lt;FONT color="#ff0000"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; 8 );&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; LAP2 = 0xFF &amp;amp; ( Address &lt;FONT color="#ff0000"&gt;&amp;lt;&amp;lt;&lt;/FONT&gt; 16 );&lt;BR /&gt;&lt;/EM&gt;&lt;/P&gt;&lt;HR /&gt;&lt;/BLOCKQUOTE&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>Tue, 03 Aug 2010 13:45:17 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216193#M18784</guid>
      <dc:creator>tonyp</dc:creator>
      <dc:date>2010-08-03T13:45:17Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Flash with LAP on S08DZ128</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216194#M18785</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp; /* clear FACCERR flag */&lt;BR /&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT |= FSTAT_FACCERR_MASK_UI8;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Above is wrong.&amp;nbsp;Oring FSTAT with anything will write '1' to FCBEF bit if FCBEF is already set. Effectively it is attempt to launch flash command. Since flash erase/write sequence is most likely violated,&amp;nbsp;error flag will be reset back to '1'...&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;For DZ128 Address should be wider than 16 bits integer.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 15:19:33 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216194#M18785</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-08-03T15:19:33Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Flash with LAP on S08DZ128</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216195#M18786</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;&lt;/P&gt;&lt;P&gt;thank you for helping. Ok so I was wrong with shifting, that shouldn´t happen. Do you agree with my code fundamentally ?&lt;/P&gt;&lt;P&gt;I mean should the code work regarding your suggested changes ?&lt;/P&gt;&lt;P&gt;I feel it´s pretty hard to get into this stuff when you never did flash programming routines before &lt;IMG alt=":smileysad:" class="emoticon emoticon-smileysad" id="smileysad" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-sad.gif" title="Smiley Sad" /&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you guys,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Best regards,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Simon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 03 Aug 2010 16:50:14 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216195#M18786</guid>
      <dc:creator>lc_hc</dc:creator>
      <dc:date>2010-08-03T16:50:14Z</dc:date>
    </item>
    <item>
      <title>Re: Writing to Flash with LAP on S08DZ128</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216196#M18787</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;DZ128.&lt;/P&gt;&lt;P&gt;What is the best and correct way to set up a 24 bit&lt;/P&gt;&lt;P&gt;pointer to a flash array in adress 0x48000,&lt;/P&gt;&lt;P&gt;and then write a byte to the adress to start a sector erase.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thanks,&lt;/P&gt;&lt;P&gt;Anders&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>Fri, 23 Dec 2011 20:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Writing-to-Flash-with-LAP-on-S08DZ128/m-p/216196#M18787</guid>
      <dc:creator>AndersJ</dc:creator>
      <dc:date>2011-12-23T20:52:59Z</dc:date>
    </item>
  </channel>
</rss>

