<?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 writting FLASH as an EEPROM in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215883#M18745</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code associated with AN3824 is rather complex because it appears to distribute the parameter storage over a number of flash sectors, presumably to increase the total number of erase/write cycles&amp;nbsp;before flash "wearout" occurs.&amp;nbsp; If your application does not require frequent update of the non-volatile data, you can more simply write the data to a single dedicated sector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached code extensively&amp;nbsp;uses inline assembly, but would generally be applicable to most HCS08 devices, with minor variation, mainly to the PRM file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will need to define the bus clock frequency you are using (within the header file) so that the appropriate flash clock frequency is set when FlashInit() function is called.&amp;nbsp; A small RAM based function is used, and the function CopyInRAM() will transfer this code from flash.&amp;nbsp; The RAM block for this code must be defined within the PRM file, as must also the flash block for the non-volatile parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The remaining functions are Flash_Erase() that erases a flash sector, and Flash_Program() that programs a single byte.&amp;nbsp; There is no need for a special read function where variables are allocated within the flash block - simply read the variable in the normal manner.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Mon, 02 Aug 2010 10:25:36 GMT</pubDate>
    <dc:creator>bigmac</dc:creator>
    <dc:date>2010-08-02T10:25:36Z</dc:date>
    <item>
      <title>Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215882#M18744</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, I did this question&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A _jive_internal="true" href="https://community.nxp.com/external-link.jspa?url=https%3A%2F%2Fcommunity.freescale.com%2Fthread%2F68126" rel="nofollow" target="_blank"&gt;https://community.freescale.com/thread/68126&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Then I found AN3824 a library for MC9S08&lt;STRONG&gt;LG&lt;/STRONG&gt;32&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am using MC9S08&lt;STRONG&gt;GT&lt;/STRONG&gt;32 (LG and GT that's first difference)&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;then the code I downloaded have a demo that says : "This demo is designed to run only on MC9S08&lt;STRONG&gt;GB&lt;/STRONG&gt;60 evaluation board. " I couldn't integrate that to my project there are too many files and things to touch like frecuencies.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A little lost back here for some light.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am reading this is a very complex thing to do, it need the code to be executed at RAM?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I really would be glad with something like&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;UL&gt;&lt;LI&gt;writeByte2Flash(u08 byte, int address);&lt;/LI&gt;&lt;LI&gt;u08 readByte2Flash(int address);&lt;/LI&gt;&lt;/UL&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="http://freescale.i.lithium.com/i/smilies/16x16_smiley-indifferent.gif"&gt;&lt;IMG alt=":smileyindifferent:" class="emoticon emoticon-smileyindifferent" src="http://freescale.i.lithium.com/i/smilies/16x16_smiley-indifferent.gif" title="Smiley Indifferent" /&gt;&lt;/A&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 31 Jul 2010 02:14:30 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215882#M18744</guid>
      <dc:creator>hernanEche</dc:creator>
      <dc:date>2010-07-31T02:14:30Z</dc:date>
    </item>
    <item>
      <title>Re: Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215883#M18745</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The code associated with AN3824 is rather complex because it appears to distribute the parameter storage over a number of flash sectors, presumably to increase the total number of erase/write cycles&amp;nbsp;before flash "wearout" occurs.&amp;nbsp; If your application does not require frequent update of the non-volatile data, you can more simply write the data to a single dedicated sector.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The attached code extensively&amp;nbsp;uses inline assembly, but would generally be applicable to most HCS08 devices, with minor variation, mainly to the PRM file.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;You will need to define the bus clock frequency you are using (within the header file) so that the appropriate flash clock frequency is set when FlashInit() function is called.&amp;nbsp; A small RAM based function is used, and the function CopyInRAM() will transfer this code from flash.&amp;nbsp; The RAM block for this code must be defined within the PRM file, as must also the flash block for the non-volatile parameters.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The remaining functions are Flash_Erase() that erases a flash sector, and Flash_Program() that programs a single byte.&amp;nbsp; There is no need for a special read function where variables are allocated within the flash block - simply read the variable in the normal manner.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 02 Aug 2010 10:25:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215883#M18745</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-08-02T10:25:36Z</dc:date>
    </item>
    <item>
      <title>Re: Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215884#M18746</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello, thanks for the answer! , I will try to make it works&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;What I made till now:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;1-Modify project.prm adding this&lt;/P&gt;&lt;PRE&gt;SEGMENTS    ..    FLASH_TO_RAM             =  READ_ONLY    0xE000 TO 0xE00F RELOCATE_TO 0x0200;        ..ENDPLACEMENT    ..    FLASH_ROUTINE                       INTO  FLASH_TO_RAM;    ..END&lt;/PRE&gt;&lt;P&gt;2.Adding .h and .c to project&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;3.Define BUS_CLOCK in S08_Flash.h&lt;/P&gt;&lt;PRE&gt;//(in my project)#define BUS_CLOCK 4195200&lt;/PRE&gt;&lt;P&gt;4. Comment //#include "derivative.h" because this included MC9S08GT32A.h but my project uses MC9S08GT32.h&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;5.Run!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I watched FLASH memory with "True-Time Simulator &amp;amp; Real Time Debugger" connected to an Open Source BDM and to the microcontroller and..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;It works!! I see in FLASH the data I've written..&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Now the question is:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;The Flash_Read function is missing?, How do I Read FLASH Data from source?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you very much again&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>Mon, 02 Aug 2010 20:44:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215884#M18746</guid>
      <dc:creator>hernanEche</dc:creator>
      <dc:date>2010-08-02T20:44:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215885#M18747</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Maybe the following function could be used to read a byte from a specific location in (flash) memory -&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;byte get_mem( const byte *addr)&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;{&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;&amp;nbsp;&amp;nbsp; return (*addr);&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT face="courier new,courier"&gt;}&lt;/FONT&gt;&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;Regards,&lt;/P&gt;&lt;P&gt;Mac&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 04 Aug 2010 02:20:41 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215885#M18747</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-08-04T02:20:41Z</dc:date>
    </item>
    <item>
      <title>Re: Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215886#M18748</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Thank you very much! &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;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 05 Aug 2010 21:35:08 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215886#M18748</guid>
      <dc:creator>hernanEche</dc:creator>
      <dc:date>2010-08-05T21:35:08Z</dc:date>
    </item>
    <item>
      <title>Re: Problem writting FLASH as an EEPROM</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215887#M18749</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;News:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;A related error because data overlap&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;A href="https://community.freescale.com/message/74836#74836" title="https://community.freescale.com/message/74836#74836"&gt;https://community.freescale.com/message/74836#74836&lt;/A&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;could be easily corrected (I hope) I will try it now&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Bye!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 23 Dec 2010 20:33:27 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-writting-FLASH-as-an-EEPROM/m-p/215887#M18749</guid>
      <dc:creator>hernanEche</dc:creator>
      <dc:date>2010-12-23T20:33:27Z</dc:date>
    </item>
  </channel>
</rss>

