<?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のトピックProblem of EEPROM Write and read</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164190#M10205</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The MCU is S08EL16, development tool is CW6.3, use "Full chip simulation"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please see the attached project file, the questions:&lt;/P&gt;&lt;P&gt;&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;Q1: In the main.c file, I want to read a data from the eeprom, when I read data from the address 0x1700, the return value is 0x33 but not 0x22, why this happend?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Q2:&amp;nbsp;I also want to wrtie a data(0x55) into the address 0x1700 use the function " write_eeprom_byte", but it's not work, why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Sat, 20 Nov 2010 18:16:05 GMT</pubDate>
    <dc:creator>JalenZ</dc:creator>
    <dc:date>2010-11-20T18:16:05Z</dc:date>
    <item>
      <title>Problem of EEPROM Write and read</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164190#M10205</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi all:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; The MCU is S08EL16, development tool is CW6.3, use "Full chip simulation"&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Please see the attached project file, the questions:&lt;/P&gt;&lt;P&gt;&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;Q1: In the main.c file, I want to read a data from the eeprom, when I read data from the address 0x1700, the return value is 0x33 but not 0x22, why this happend?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; Q2:&amp;nbsp;I also want to wrtie a data(0x55) into the address 0x1700 use the function " write_eeprom_byte", but it's not work, why?&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; Thanks!&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 20 Nov 2010 18:16:05 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164190#M10205</guid>
      <dc:creator>JalenZ</dc:creator>
      <dc:date>2010-11-20T18:16:05Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of EEPROM Write and read</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164191#M10206</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;#define EEPROM_ACCESS(x) *(&lt;FONT color="#ff0000"&gt;word&lt;/FONT&gt; *)(x)&lt;/P&gt;&lt;P&gt;Did you&amp;nbsp;use this macro to read from 0x1700? Assigning EEPROM_ACCESS(0x1700)&amp;nbsp; to char variable will give 0x33.&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;write_eeprom_byte is full of bugs:&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT_FACCERR = 1;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;&amp;nbsp;&amp;nbsp; Is wrong. This will also write one to&amp;nbsp;FCBEF bit and probably will set again some error bit.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;Use FSTAT = FSTAT_FACCERR_MASK;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp; *(word*)(addr) = data;&lt;BR /&gt;&lt;/FONT&gt;&lt;FONT color="#000000"&gt;S08 eeprom is byte programmable, not word programmable.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;In your case EEPROM at 0x1700 is not erased. You should erase it before programming.&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp; FSTAT_FCBEF = 1;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT_FACCERR = 1;&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT_FPVIOL = 1;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;FONT color="#ff0000"&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; FSTAT_FACCERR = 1;&lt;BR /&gt;&lt;/FONT&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp; &lt;FONT color="#ff0000"&gt;EEPROM_ACCESS&lt;/FONT&gt;(addr) = data;&amp;nbsp;&amp;nbsp; // Write the data&lt;BR /&gt;EEPROM_ACCESS should write byte (*(char*)x).&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;&amp;nbsp; FSTAT = 0x80;&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 command buffer empty flag&lt;/FONT&gt;&lt;/P&gt;&lt;P&gt;&lt;FONT color="#000000"&gt;Don't use "magic constants". FSTAT = FSTAT_FCBEF_MASK; is somewhat&amp;nbsp;self documenting.&lt;BR /&gt;&lt;/FONT&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sun, 21 Nov 2010 18:52:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164191#M10206</guid>
      <dc:creator>kef</dc:creator>
      <dc:date>2010-11-21T18:52:59Z</dc:date>
    </item>
    <item>
      <title>Re: Problem of EEPROM Write and read</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164192#M10207</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;Usually FCS does not simulate the programming of flash memory.&amp;nbsp; It would therefore not surprise me if the related EEPROM programming was also not simulated.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I think that you will need to prove this part of your code using the real hardware.&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, 22 Nov 2010 21:15:59 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Problem-of-EEPROM-Write-and-read/m-p/164192#M10207</guid>
      <dc:creator>bigmac</dc:creator>
      <dc:date>2010-11-22T21:15:59Z</dc:date>
    </item>
  </channel>
</rss>

