<?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>LPCXpresso IDEのトピックRe: Eeprom not able to write</title>
    <link>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589852#M28823</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Tue Nov 20 03:43:35 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Found the problem, SYSAHBCLKDIV was not initialized properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Like EEprom speed is 375Khz typical. But system runs at 72Mhz. So have to switch b/w two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now when changing SYSAHBCLKDIV_Val b/w 192 for 375Khz &amp;amp; set value to 1 for 72Mhz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How do get indication that clock now gets stable after changing SYSAhbclkdiv.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLKDIV = 192;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // switch for eeprom programming.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/.........Should I wait here for some time for clock gets stable or no need or any flag for it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. eeAddress varies from 0-4031 or 64-4095&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Wed, 15 Jun 2016 22:48:44 GMT</pubDate>
    <dc:creator>lpcware</dc:creator>
    <dc:date>2016-06-15T22:48:44Z</dc:date>
    <item>
      <title>Eeprom not able to write</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589851#M28822</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Tue Nov 20 02:39:03 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi I am not able to write eeprom, what error I am doin here:LPC1317-64pin. Running CPU core at 72Mhz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Is there anyu enable bit also like in for other peripherals in SYSAHBCLKCTRL.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Also any register to set 375Khz-typical freq for eeprom or just write in command[4] = 375; value.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;TABLE border="1"&gt;&lt;TBODY&gt;&lt;TR&gt;&lt;TD bgcolor="#cacaca"&gt; &lt;PRE&gt;

&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t x=100;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t y= 100;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uint8_t z=0;
&amp;nbsp;&amp;nbsp;&amp;nbsp; writeEEPROM( (uint8_t*) x, (uint8_t*)&amp;amp;y, 1 );
&amp;nbsp;&amp;nbsp;&amp;nbsp; 
&amp;nbsp;&amp;nbsp;&amp;nbsp; readEEPROM( (uint8_t*) x,(uint8_t*) &amp;amp;z, 1 );




#define IAP_LOCATION 0x1FFF1FF1
typedef void (*IAP) (unsigned int command[],
unsigned int result[] );
static const IAP iap_entry = (IAP) IAP_LOCATION;
//1) EEprom Write
//
//Command code: 61
//Param0: eeprom address (byte, half-word or word aligned)
//Param1: RAM address (byte, half-word or word aligned)
//Param2: Number of bytes to be written ( Byte, Half-words write are ok)
//Param3: System Clock Frequency (CCLK) in kHz
//
//Return Code CMD_SUCCESS | SRC_ADDR_NOT_MAPPED | DST_ADDR_NOT_MAPPED 
void writeEEPROM( uint8_t* eeAddress, uint8_t* buffAddress, uint32_t byteCount )
{
unsigned int command[5], result[4];

command[0] = 61;&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;&amp;nbsp; 
command[1] = (uint32_t) eeAddress;
command[2] = (uint32_t) buffAddress;
command[3] = byteCount;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
command[4] = 375;

/* Invoke IAP call...*/
iap_entry(command, result);
if (0 != result[0])
{
//Trap error
while(1);
}
return;
}

//2) EEprom Read
//Command code: 62
//Param0: eeprom address (byte, half-word or word aligned)
//Param1: RAM address (byte, half-word or word aligned)
//Param2: Number of bytes to be read ( Byte, Half-words read are ok)
//Param3: System Clock Frequency (CCLK) in kHz
//
//Return Code CMD_SUCCESS | SRC_ADDR_NOT_MAPPED | DST_ADDR_NOT_MAPPED
void readEEPROM( uint8_t* eeAddress, uint8_t* buffAddress, uint32_t byteCount )
{
unsigned int command[5], result[4];

command[0] = 62;&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;&amp;nbsp; 
command[1] = (uint32_t) eeAddress;
command[2] = (uint32_t) buffAddress;
command[3] = byteCount;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; 
command[4] = 375;

/* Invoke IAP call...*/
&amp;nbsp; iap_entry( command, result);
if (0 != result[0])
{
//Trap error
while(1);
}
return;
}
&lt;/PRE&gt; &lt;/TD&gt;&lt;/TR&gt;&lt;/TBODY&gt;&lt;/TABLE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:48:43 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589851#M28822</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:48:43Z</dc:date>
    </item>
    <item>
      <title>Re: Eeprom not able to write</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589852#M28823</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Tue Nov 20 03:43:35 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;Hi,&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Found the problem, SYSAHBCLKDIV was not initialized properly.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;question:&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;1. Like EEprom speed is 375Khz typical. But system runs at 72Mhz. So have to switch b/w two.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;Now when changing SYSAHBCLKDIV_Val b/w 192 for 375Khz &amp;amp; set value to 1 for 72Mhz.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;How do get indication that clock now gets stable after changing SYSAhbclkdiv.&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;like:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;CLKDIV = 192;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // switch for eeprom programming.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;/.........Should I wait here for some time for clock gets stable or no need or any flag for it.&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;2. eeAddress varies from 0-4031 or 64-4095&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:48:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589852#M28823</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:48:44Z</dc:date>
    </item>
    <item>
      <title>Re: Eeprom not able to write</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589853#M28824</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by aamir ali on Fri Nov 23 02:51:28 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;help abt dis.......&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:48:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589853#M28824</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:48:45Z</dc:date>
    </item>
    <item>
      <title>Re: Eeprom not able to write</title>
      <link>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589854#M28825</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;STRONG&gt;Content originally posted in LPCWare by tha on Mon Nov 26 12:56:47 MST 2012&lt;/STRONG&gt;&lt;BR /&gt;&lt;SPAN&gt;The clock frequency for the EEPROM should be in the System Clock Frequency in kHz not an absolute value.&amp;nbsp; If you are using the CMSIS file, you can first get the System Clock by making a call to:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;SystemCoreClockUpdate();&lt;/SPAN&gt;&lt;BR /&gt;&lt;BR /&gt;&lt;SPAN&gt;Then in the read/write function, for command[4], you can do this:&lt;/SPAN&gt;&lt;BR /&gt;&lt;SPAN&gt;command[4] = SystemCoreClock/1000&lt;/SPAN&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 15 Jun 2016 22:48:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/LPCXpresso-IDE/Eeprom-not-able-to-write/m-p/589854#M28825</guid>
      <dc:creator>lpcware</dc:creator>
      <dc:date>2016-06-15T22:48:45Z</dc:date>
    </item>
  </channel>
</rss>

