<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="https://community.arm.com/utility/feedstylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>page_erase() problem</title><link>https://community.arm.com/developer/tools-software/tools/f/keil-forum/42642/page_erase-problem</link><description> I need to store my boards network ID into nonvolatile memory. I have been using the page_erase() and write_flash_chk(): 
 
 

page_erase(PAGE_START, 0xFF, FDM);
write_flash_chk(PAGE_START, NewAddr, FDM);

 
 
where PAGE_START = 0x0400 and my timing is</description><dc:language>en-US</dc:language><generator>Telligent Community 10</generator><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/152542?ContentTypeID=1</link><pubDate>Thu, 01 Sep 2005 07:01:59 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:07e066d6-8958-48a5-8096-cb2d93cc2ff8</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;Turning off those interrupts was a cure of symptoms.   The problem is that you&amp;#39;re erasing a page, which contains not only data, but also &lt;b&gt;code&lt;/b&gt;.  You can&amp;#39;t seriously be surprised that erasing part of the code of your program in mid-operation makes the system somewhat less than reliably.&lt;br /&gt;
&lt;br /&gt;
As I said: the solution is to tell the linker not to put any code in that area, period.  And even then you may have to turn off interrupts for the time being, depending on whether that EEROM is capable of reading from one page while writing/erasing another.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/153883?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 20:26:58 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:60d453a1-aaea-4dab-a302-55ca71b24957</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;I had this board running for months without a problem&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
No: you had that board running for months &lt;i&gt;&lt;b&gt;with&lt;/b&gt;&lt;/i&gt; a problem - you were just lucky enough that the problem never manifested itself!&lt;br /&gt;
&lt;br /&gt;
It&amp;#39;s that &lt;i&gt;&amp;#39;Proven Product&amp;#39; Syndrome&lt;/i&gt; again: &lt;a href="http://www.8052.com/forum/read.phtml?id=78339" target="_blank"&gt;http://www.8052.com/forum/read.phtml?id=78339&lt;/a&gt;&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
Cue: Erik on &amp;quot;Testing&amp;quot; ...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/153241?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 14:55:10 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:7883e7a6-eb1d-4bde-930a-8e27b9f21d84</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;Andy,&lt;br /&gt;
&lt;br /&gt;
Pure luck is right. I had this board running for months without a problem. I changed one thing and it went down.&lt;br /&gt;
&lt;br /&gt;
Thanks for the insight.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/152541?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 14:46:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4475d558-0206-4cf4-b9f2-22367b4d1682</guid><dc:creator>Andy Neil</dc:creator><description>&lt;p&gt;&lt;i&gt;&amp;quot;In the previous veresion I had I wasn&amp;#39;t turning off interrupts but it worked, so I am curious to see why!&amp;quot;&lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
My Theory: &lt;a href="http://www.8052.com/forum/read.phtml?id=100395" target="_blank"&gt;http://www.8052.com/forum/read.phtml?id=100395&lt;/a&gt;&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/151769?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 14:13:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b38c08c5-e7fd-41b2-b1e9-97d1af1e24cc</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;Erik,&lt;br /&gt;
&lt;br /&gt;
On 8052.com Craig suggested I turn of interrupts before doing a page erase. That solved the problem. In the previous veresion I had I wasn&amp;#39;t turning off interrupts but it worked, so I am curious to see why!&lt;br /&gt;
&lt;br /&gt;
Thank you and everyone else for all your help.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/151024?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 14:08:46 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:4a1ac4ee-16c5-4443-a999-6826f8a93ca4</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;i&gt;The documentation I am refering to is the MSC1210 Users Guide...and I have no problem writing to that memory space. The problem is trying to erase it and write to it again..&lt;/i&gt;&lt;br /&gt;
some has been answered at 8052.com, I agree with the poster that suggested you locate your data at the top of memory. Try that and come back&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/145970?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 13:13:19 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ff98267b-3086-4527-a465-5cb32a605584</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;The documentation I am refering to is the MSC1210 Users Guide...and I have no problem writing to that memory space. The problem is trying to erase it and write to it again..&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/144075?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 13:07:53 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:b1cc8b8d-57a1-4d58-984f-167046b7a2ec</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;&lt;i&gt;Well all the documentation I have read said that data flash memory starts at 400h&lt;/i&gt;&lt;br /&gt;
I do not know what &amp;quot;documentation&amp;quot; you refer to but my guess is that a careful reading would lead to the understanding that &amp;quot;&lt;i&gt;dual purpose&lt;/i&gt; flash memory starts at 400h&amp;quot;.  I do not know your chip, but were I to design a chip with &amp;quot;dual purpose flash&amp;quot; I would, by some means, protect page 0 from &amp;quot;wild writes&amp;quot;&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/141549?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 12:53:15 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a42ecb9f-da66-4ba0-8db9-957ab89bd388</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;&lt;i&gt;Are you sure the CODE space memory hole has to be at 0x0400? Can&amp;#39;t you configure it to be at a more sensible place like, say, at the end of those 32 KiB, from 0x7c00 to 0x7fff? &lt;/i&gt;&lt;br /&gt;
&lt;br /&gt;
Well all the documentation I have read said that data flash memory starts at 400h. I tried having my code start at 500h, but my program no longeer detects the interrupts...&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/138092?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 12:47:20 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:96f1183c-c8ab-42fc-8708-872f44f2282d</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;Yes, if there&amp;#39;s a region of CODE memory space that isn&amp;#39;t available for running code out of it, somebody &lt;b&gt;has to&lt;/b&gt; tell the linker about that.  If the tools aren&amp;#39;t doing it by themselves (--&amp;gt; check out the &amp;quot;use memory layout from target dialog button), you have to do it yourself.&lt;br /&gt;
&lt;br /&gt;
Are you sure the CODE space memory hole has to be at 0x0400?  Can&amp;#39;t you configure it to be at a more sensible place like, say, at the end of those 32 KiB, from 0x7c00 to 0x7fff?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/129977?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 12:25:07 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:bf5fe7eb-4cfb-4045-bbfe-be77804bef40</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;I am a little confused about the memory layout, becasue I am new to the 8051 environment. I am using the MSC1210Y5. By configuring HCR0, I have partitioned 1kb for Data flash memory and 31kb for program flash memory. I am assuming the C51 compiler won&amp;#39;t differenciate between the two, so I have to tell it where to start the code?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/122926?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 11:50:18 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:ae7cbbc7-55a1-494a-b548-dddc682a41b1</guid><dc:creator>HansBernhard Broeker</dc:creator><description>&lt;p&gt;Well, if you have data in the middle of the code segment, you&amp;#39;ll have to tell the linker about that, so it can leave that area alone.  In LX51, the relevant directive is RESERVE.&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/111638?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 08:44:11 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:a35aa7ea-79f8-4c6d-9275-3cdb7de9fe8e</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;Erik,&lt;br /&gt;
&lt;br /&gt;
In the map file I noticed the following:&lt;br /&gt;
&lt;br /&gt;
&lt;pre&gt;
CODE    0026H     0529H     UNIT         ?PR?_TUNECHANNEL?AUTOTUNE &lt;/pre&gt; which means it is in the 0x0400 region.&lt;br /&gt;
&lt;br /&gt;
I tried starting the code segment from 500h but after I do that none of my interrupts work.&lt;br /&gt;
&lt;br /&gt;
Any suggestions?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/97436?ContentTypeID=1</link><pubDate>Wed, 31 Aug 2005 07:42:09 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:800d7797-cc32-4196-b3fc-2f3c89c67747</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;right, but remember the &amp;quot;high number&amp;quot; is the START of the last module, I got caught on that one once.&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/73449?ContentTypeID=1</link><pubDate>Tue, 30 Aug 2005 16:04:29 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:cfaec90e-2dd8-4ea0-90ee-9040dbb5ee51</guid><dc:creator>Paul Marley</dc:creator><description>&lt;p&gt;Erik,&lt;br /&gt;
&lt;br /&gt;
I thought I had checked that. The place to look would be the M51 file, right?&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>RE: page_erase() problem</title><link>https://community.arm.com/thread/44608?ContentTypeID=1</link><pubDate>Tue, 30 Aug 2005 15:41:05 GMT</pubDate><guid isPermaLink="false">dd9e70c8-6d3c-4c71-b136-2456382a7b5c:1b10227e-e6f8-4caa-9945-10599789f89e</guid><dc:creator>erik  malund</dc:creator><description>&lt;p&gt;PAGE_START = 0x0400&lt;br /&gt;
&lt;br /&gt;
That worked fine until I changed my Serial ISR&lt;br /&gt;
&lt;br /&gt;
did that make 0x400 - end of page contain code?&lt;br /&gt;
&lt;br /&gt;
Erik&lt;/p&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>