<?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: Write Flash in 8-bit Microcontrollers</title>
    <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598323#M22166</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are erasing interrupt vectors table... Look in your SH4 manual for flash sector (page)&amp;nbsp;size. It is as 512 bytes.&amp;nbsp;Erasing sector at 0xFFB0 you erase everything between 0xFE00 and 0xFFFF&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 23 Sep 2016 12:35:02 GMT</pubDate>
    <dc:creator>kef2</dc:creator>
    <dc:date>2016-09-23T12:35:02Z</dc:date>
    <item>
      <title>Write Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598319#M22162</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Hello; &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;I program a microcontroller mc9s08sh4 . &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;I used the various discussing how to read and write to the flash . I use the example given on the forum:&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;&lt;A _jive_internal="true" data-containerid="2016" data-containertype="14" data-objectid="319984" data-objecttype="1" href="https://community.nxp.com/thread/319984"&gt;Unable to write S08 flash in run mode&lt;/A&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;I manage to save one time a character, but I can not do it after. &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Here is my example code : &lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;void main(void) &lt;BR /&gt;{&lt;BR /&gt; &lt;BR /&gt; unsigned char Byte_To_Be_Programmed = 'D';&lt;BR /&gt; &lt;BR /&gt; /* Start by copying the Flash Routine to RAM */&lt;BR /&gt; CopyInRAM();&lt;BR /&gt; &lt;BR /&gt; /* Init Flash Clock Divider */&lt;BR /&gt; FlashInit();&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; if (Flash_Program(0xFFB0, Byte_To_Be_Programmed))&lt;BR /&gt; {&lt;BR /&gt; /* Error while programming a Byte, write your error handling here */&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; Byte_To_Be_Programmed = 'B'; &lt;BR /&gt; &lt;BR /&gt; if (Flash_Program(0xFFB0, Byte_To_Be_Programmed))&lt;BR /&gt; {&lt;BR /&gt; /* Error while programming a Byte, write your error handling here */&lt;BR /&gt; }&lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; &lt;BR /&gt; EnableInterrupts;&lt;/P&gt;&lt;P&gt;for(;;) &lt;BR /&gt; {&lt;BR /&gt; &lt;BR /&gt; __RESET_WATCHDOG();&lt;BR /&gt; }&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;The first time , the variable 'D' ( 0x44 ) is stored in memory . &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;As against the variable 'B' does not register properly ( 0x40 ) &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Whatever the second variable , it is always 0x40 . &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Do you have an idea of the problem? &lt;/SPAN&gt;&lt;/P&gt;&lt;P style="min-height: 8pt; padding: 0px;"&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Thank you for your help. DSL for my English&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 07 Sep 2016 15:27:06 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598319#M22162</guid>
      <dc:creator>gregoryclement</dc:creator>
      <dc:date>2016-09-07T15:27:06Z</dc:date>
    </item>
    <item>
      <title>Re: Write Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598320#M22163</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;It is because you need to erase flash sector before doing second write to the same byte. First write 'D' == 0x44 clears bits so that 2 bits are left unprogrammed, bits 6 and 2, resulting byte is 0x44. 2nd write 'B' = 0x42 additionally clears bit 2 and&amp;nbsp;in the end&amp;nbsp;only bit 6 is left unprogrammed (=1), and you see 0x40.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Thu, 08 Sep 2016 13:09:04 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598320#M22163</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2016-09-08T13:09:04Z</dc:date>
    </item>
    <item>
      <title>Re: Write Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598321#M22164</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;Super thank you for the reply , I understand now , I'll watch it this week . &lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt;I have another question for the same microcontroller . It seems that I can put a pull-up or pull-down on my entries.&lt;/SPAN&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;When enabled, the IRQ pin, defaults to use an internal pull device (IRQPDD = 0). The device is a pullup or pulldown depending on the polarity chosen. If the user uses an external pullup or pulldown, the IRQPDD can be written to a 1 to turn off the internal device.&lt;/P&gt;&lt;/BLOCKQUOTE&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN style="color: #212121; background-color: #ffffff; font-size: 16px;"&gt; By cons , I can only put a pull-up . How to put a pull-down ?&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 12 Sep 2016 13:28:49 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598321#M22164</guid>
      <dc:creator>gregoryclement</dc:creator>
      <dc:date>2016-09-12T13:28:49Z</dc:date>
    </item>
    <item>
      <title>Re: Write Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598322#M22165</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;PRE data-fulltext="" data-placeholder="Translation" dir="ltr"&gt;&lt;P&gt;&lt;SPAN lang="en"&gt;&lt;SPAN lang="en"&gt;Hello;&amp;nbsp; I finally have another problem to record in the flash memory. Using Processor exprert, I am able to register in the flash several times. By cons, by modifying the code to have interrupt every 15 ms,I&lt;/SPAN&gt;&lt;/SPAN&gt;&lt;SPAN lang="en"&gt; can not save a block &lt;/SPAN&gt;and 
everything seems to hang. 

Here are some of the code: 

&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;BLOCKQUOTE class="jive_macro_quote jive-quote jive_text_macro"&gt;&lt;P&gt;for(;;) // main
 { 
 
 if(Seconde%5 == 0) // every 5 seconds
 {
 IFsh1_EraseSector(0xFFB0); //Erase
 Data = Seconde;
 IFsh1_SetLongFlash(0xFFB0, Data); &amp;nbsp;//Record
 }
 
 }&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;void TI1_OnInterrupt(void) // Event.c
{
 DifTimer++;
 
 if(DifTimer == 64)
 {
 DifTimer = 0;
 Seconde++;
 }
 
}&lt;/P&gt;&lt;/BLOCKQUOTE&gt;
I have tried disabling TI1_OnInterrupt (void) and disable interrupts, but it did not work

Which solution I have to direct me to have a intetturption every 15 ms and to record? 

Thank you for your help&lt;/PRE&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 12:15:09 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598322#M22165</guid>
      <dc:creator>gregoryclement</dc:creator>
      <dc:date>2016-09-23T12:15:09Z</dc:date>
    </item>
    <item>
      <title>Re: Write Flash</title>
      <link>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598323#M22166</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;You are erasing interrupt vectors table... Look in your SH4 manual for flash sector (page)&amp;nbsp;size. It is as 512 bytes.&amp;nbsp;Erasing sector at 0xFFB0 you erase everything between 0xFE00 and 0xFFFF&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 23 Sep 2016 12:35:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/8-bit-Microcontrollers/Write-Flash/m-p/598323#M22166</guid>
      <dc:creator>kef2</dc:creator>
      <dc:date>2016-09-23T12:35:02Z</dc:date>
    </item>
  </channel>
</rss>

