<?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>S12 / MagniV MicrocontrollersのトピックRe: MM9Z1J638 erase EEPROM problem</title>
    <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034841#M20326</link>
    <description>&lt;P&gt;Okay, i figured out everything, Now i can erase, read, write eeprom, now i have different kind of problem "speed"&amp;nbsp; can i somehow use more words in a single comand to write? as i can see in datasheet there are option to send 4 words at a timem but also in datasheet we see that FCCOBIX can change only 0-2 so i cant send more than 1 words in single command, how i can deal with it? or any other ways to speed up proccess, now it takes about 30 seconds and its quite a lot (30 seconds to erase+write+verify(read))&lt;/P&gt;</description>
    <pubDate>Tue, 28 Jan 2025 00:04:36 GMT</pubDate>
    <dc:creator>romanarxxy</dc:creator>
    <dc:date>2025-01-28T00:04:36Z</dc:date>
    <item>
      <title>Re: MM9Z1J638 erase EEPROM problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034488#M20321</link>
      <description>&lt;P&gt;I've found adres of registers in demo software for codewarrior, checked it and now all i need is a guide how to erase/program in right way because i think i missed something&lt;/P&gt;&lt;P&gt;I'm setting up FCLKDIV=0x01 for 250kHz it returns me 0x81 so its ok&lt;/P&gt;&lt;P&gt;then i'm checking FSTAT=0x80&lt;/P&gt;&lt;P&gt;then i'm sending command with 2 words 0x1210 -&amp;gt;0x0000&lt;/P&gt;&lt;P&gt;and then nothing happens, what have i done wrong? I also tried to write something in register FSTAT but if i'm doing it it returns me FSTAT=A0 means ACCERR... really need help with it&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 10:39:42 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034488#M20321</guid>
      <dc:creator>romanarxxy</dc:creator>
      <dc:date>2025-01-27T10:39:42Z</dc:date>
    </item>
    <item>
      <title>Re: MM9Z1J638 erase EEPROM problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034641#M20323</link>
      <description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;Please compare this project with yours,&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-Flash-example-code/ta-p/1108954" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-Flash-example-code/ta-p/1108954&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If there is no oscillator on the board the the MCU uses internal oscillator and BUSCLK is set by PLL.&lt;BR /&gt;&lt;BR /&gt;&lt;BR /&gt;FDIV is based on the busclk so it is necessary to know it.&lt;BR /&gt;6.14.3.2.1Flash clock divider register (FCLKDIV)&lt;BR /&gt;&lt;BR /&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lama_0-1737990606327.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/321538iE22BAF07DE5164EC/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lama_0-1737990606327.png" alt="lama_0-1737990606327.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lama_1-1737990630474.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/321539i514B6BF6B5497785/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lama_1-1737990630474.png" alt="lama_1-1737990630474.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Never, show E/W data in the memory window because it reads FLASH during E/W by MCU which causes error. The flash is not allowed to be read while E/W. So, check written data by code or show another address space in the memory window and then, after E/W, you can shift it and check whether there is a correct change.&lt;BR /&gt;&lt;BR /&gt;Best regards,&lt;/P&gt;
&lt;P&gt;Ladislav&lt;/P&gt;</description>
      <pubDate>Mon, 27 Jan 2025 15:14:40 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034641#M20323</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2025-01-27T15:14:40Z</dc:date>
    </item>
    <item>
      <title>Re: MM9Z1J638 erase EEPROM problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034841#M20326</link>
      <description>&lt;P&gt;Okay, i figured out everything, Now i can erase, read, write eeprom, now i have different kind of problem "speed"&amp;nbsp; can i somehow use more words in a single comand to write? as i can see in datasheet there are option to send 4 words at a timem but also in datasheet we see that FCCOBIX can change only 0-2 so i cant send more than 1 words in single command, how i can deal with it? or any other ways to speed up proccess, now it takes about 30 seconds and its quite a lot (30 seconds to erase+write+verify(read))&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 00:04:36 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2034841#M20326</guid>
      <dc:creator>romanarxxy</dc:creator>
      <dc:date>2025-01-28T00:04:36Z</dc:date>
    </item>
    <item>
      <title>Re: MM9Z1J638 erase EEPROM problem</title>
      <link>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2035065#M20328</link>
      <description>&lt;P&gt;1) There are two ways how to program MCU with self made programmer – either via BDM or using bootloader. Of course, bootloader also requires its load via BDM.&lt;/P&gt;
&lt;P&gt;If you use mass erase command then it is suitable immediately unsecure the mcu by rewriting the security byte in the flash. If it is not done then the MCU is secured after next reset.&lt;/P&gt;
&lt;P&gt;You can also erase the flash sector by sector.&lt;/P&gt;
&lt;P&gt;Bootloader is described here:&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-MagniV-Serial-Bootloader-Interface/m-p/1522147" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/S12Z-MagniV-Serial-Bootloader-Interface/m-p/1522147&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&lt;A href="https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Simple-Serial-Bootloader-for-S12Z-AN-draft/ta-p/1126452" target="_blank"&gt;https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Simple-Serial-Bootloader-for-S12Z-AN-draft/ta-p/1126452&lt;/A&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;First of all you should read the data sheet to understand how the programming and erasing memory works.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;2) If you mean you want to program the data into the EEPROM and FLASH by means your application SW, then it is another story.&lt;/P&gt;
&lt;P&gt;In both cases it is necessary to switch off the memory window (or shift to the part which is not EW) because it reads flash and it is not allowed to read the flash while it is E/W.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;My question is. Does the “self made programmer” means bootloader or debug interface or your application SW?&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;To find register values, the best way is to look into a header file.&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I understand your code as a programming algorithm and commands you are sending via BDM to the MCU. Am I right?&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, once more. I ask for confirmation. You communicate with the MCU via your own BDM interface using BDM commands.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Am I right? If yes then it is relatively easy to port SW algorithm for E/W to BDM command flow. Of course this step by step programming algorithm is not fast but it is suitable for first approach to understand procedures. &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;You have been asking about addresses of register. =&amp;gt; The data sheet.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;One good note. After reset the MCU works on defined busclk with internal oscillator until you change it. If you want to use this clock then you do not have to touch PLL oscillator setup.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;So, for example… prepared in one breath without checking…..There BDM COMMANDS are in the data sheet … it is just simply rewrites SW procedure to BDM procedure.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//MASSERASE FLASH&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Send_cmd(ERASE_FLASH);&amp;nbsp; // BDM_cmd=0x95&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16);&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;&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; // d=delay 16 target BDCSI clock cycles (DLY)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//UNSECURE DEVICE AFTER MASS ERASE - WRITE SECURITY SECTOR&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//WRITE_MEM.sz Non-intrusive Yes (0x10+4 x sz)/ad24/wd.sz/dack Write the appropriately-sized (sz) memory value to the location specified by the 24-bit address&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soByte, FSTAT, 0x30)&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear ACCERR and PVIOL: soByte= 0x10, FSTAT (0x386) = 0x380+0x0006, BDM_cmd=0x30&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//Write entire sector, size of flash sector = 512 bytes, write is performed via writing full phrase (must be erased) at once = 8bytes/4words&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soByte, FCCOBIX, 0x05)&amp;nbsp;&amp;nbsp;&amp;nbsp; // clear ACCERR and PVIOL: soByte= 0x10, FCCOBIX (0x382) = 0x380+0x0006, data=0x05 … we will write command up to FCCOB5&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soByte, FCCOB0Hi, 0x06)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soByte= 0x10, FCCOB0Hi (0x38C), flash_cmd=0x06 -&amp;gt; write &lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lama_0-1738063798576.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/321645iB1481299B2449A0F/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lama_0-1738063798576.png" alt="lama_0-1738063798576.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lama_1-1738063798576.png" style="width: 400px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/321644iCB7467F77A88BCDE/image-size/medium?v=v2&amp;amp;px=400" role="button" title="lama_1-1738063798576.png" alt="lama_1-1738063798576.png" /&gt;&lt;/span&gt;&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(SoByte, FCCOB0Lo, AddrHi)&amp;nbsp;&amp;nbsp;&amp;nbsp; // SoByte= 0x10, FCCOB0Lo(0x38D), 2&lt;SUP&gt;nd&lt;/SUP&gt; byte of the address to be written AddrHi =(address &amp;amp; 0x00FF0000)&amp;gt;&amp;gt;16) = 0xFF&amp;nbsp; …. Se table flash configuration field bellow&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soWord, FCCOB1, AddrLo)&amp;nbsp;&amp;nbsp;&amp;nbsp; // Word= 0x14, FCCOB1(0x38E), low word of the address to be written AddrLo=&lt;/SPAN&gt; &lt;SPAN&gt;(address &amp;amp; 0x0000FFFF) = 0xFE08;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;// write flas security field data0=0xFFFF, data1=0xFFFF,&lt;/SPAN&gt; &lt;SPAN&gt;data2=0xFFFF,&lt;/SPAN&gt; &lt;SPAN&gt;data3=0xFFFE (unsecure the MCU after next reset)&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;// if you do not unsecure it then after next reset it will be secured again&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soWord, FCCOB2, data0)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soWord = 0x14, FCCOBIX (0x390), data0=zeroth data word from phrase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(Word, FCCOB3, data1)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soWord= 0x14, FCCOBIX (0x392), data1=1st data word from phrase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soWord, FCCOB4, data2)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soWord = 0x14, FCCOBIX (0x394), data2=2nd data word from phrase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soWord, FCCOB5, data3)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soWord = 0x14, FCCOBIX (0x396), data3=3rd data word from phrase&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Wait(16 or 32); //based on protocol&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//Launch command&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;Write_Mem(soByte, FSTAT, 0x80)&amp;nbsp;&amp;nbsp;&amp;nbsp; // soByte= 0x10, FSTAT (0x386), cmd=cler CCIF, start command&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;/*Waiting for CCIF …You can either load this code to RAM and execute waiting code or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;You can read the FSTAT by BDM and chceck CCIF or&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;wait for given defined number of milliseconds defined in the flash data for write cycle&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;I am not going to do it here but it is suitable to be sure the operation has finished&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;As well as I am not going to check error messages for ACCER and PVIOL.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;*/&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;ResetMCU(); // your own procedure to reset the MCU, after reset it will be in unsecured state&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;//now the device is prepared for loading entire memory except security “phrase” and its sector which should be erased individually and rewritten to the required value based on S19 record.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;// of course you procedure can be different but is is up to your ideas and design.&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;/*** FCCOBIX - Flash CCOB Index Register; 0x00000382 ***/&lt;/P&gt;
&lt;P&gt;/*** FSTAT - Flash Status Register; 0x00000386 ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB0 - Flash Common Command Object Register; 0x0000038C ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB0HI - Flash Common Command Object Register High; 0x0000038C ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB0LO - Flash Common Command Object Register Low; 0x0000038D ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB1 - Flash Common Command Object Register; 0x0000038E ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB2 - Flash Common Command Object Register; 0x00000390 ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB3 - Flash Common Command Object Register; 0x00000392 ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB4 - Flash Common Command Object Register; 0x00000394 ***/&lt;/P&gt;
&lt;P&gt;/*** FCCOB5 - Flash Common Command Object Register; 0x00000396 ***/&lt;/P&gt;
&lt;P&gt;&lt;SPAN&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;
&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="lama_2-1738063798596.png" style="width: 629px;"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/321646iFFB179897A82466D/image-dimensions/629x205?v=v2" width="629" height="205" role="button" title="lama_2-1738063798596.png" alt="lama_2-1738063798596.png" /&gt;&lt;/span&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;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 28 Jan 2025 11:30:25 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S12-MagniV-Microcontrollers/Re-MM9Z1J638-erase-EEPROM-problem/m-p/2035065#M20328</guid>
      <dc:creator>lama</dc:creator>
      <dc:date>2025-01-28T11:30:25Z</dc:date>
    </item>
  </channel>
</rss>

