<?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>Kinetis MicrocontrollersのトピックRe: What is the address of the Program Once Field in the program flash IFR?</title>
    <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496607#M30888</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marlon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't be mislead by the address of the program once field. It is not a memory mapped address such as program Flash.&lt;/P&gt;&lt;P&gt;The K60 has 8 "record Indexes" which are 8 byte phrases than can be written or read. This gives 8 x 8 bytes (64 bytes) in these indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When reading or writing, the FCMD_PROGRAM_ONCE or FCMD_READ_ONCE commands are issued to the Flash controller, along with the record index in question and the flash controller either programs the record or returns its content.&lt;/P&gt;&lt;P&gt;The program once area cannot be addresses by a physical address so is not readable by using a pointer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get program once interface code from the uTasker project which gives the following general program once interface:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;extern int fnProgramOnce(int iCommand, unsigned long *ptrBuffer, unsigned char ucBlockNumber, unsigned char ucLength);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It supports programming and retrieving the MAC address from this area using the routines (showing how the interface is used):&lt;/P&gt;&lt;P&gt;Retrieval:&lt;/P&gt;&lt;PRE&gt;static void fnGetUserMAC(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long ulTestBuffer[2];&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;&amp;nbsp;&amp;nbsp; // the MAC address is saved in two long words
&amp;nbsp;&amp;nbsp;&amp;nbsp; fnProgramOnce(PROGRAM_ONCE_READ, ulTestBuffer, 0, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // read 2 long words from the start of the program-once area
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (uMemcmp(ulTestBuffer, cucBroadcast, MAC_LENGTH) != 0) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // if programmed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(network[DEFAULT_NETWORK].ucOurMAC, ulTestBuffer, MAC_LENGTH); // use the stored value as MAC address
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;Programming:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long ulTestBuffer[2];
&amp;nbsp;&amp;nbsp;&amp;nbsp; ulTestBuffer[1] = 0xffffffff;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(ulTestBuffer, temp_pars-&amp;gt;temp_network[DEFAULT_NETWORK].ucOurMAC, MAC_LENGTH); // retrieve first MAC address from storage
&amp;nbsp;&amp;nbsp;&amp;nbsp; fnProgramOnce(PROGRAM_ONCE_WRITE, ulTestBuffer, 0, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // save to the first 2 long words in the program once area&lt;/PRE&gt;&lt;P&gt;Note that all operations use an 8 byte phrase (buffer) and unused bytes are set to 0xff. The MAC thus occupies a single phrase (organised as 2 long words in the passing buffer). In the uTasker projet the first phrase is used as MAC address as convention when the option is enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The uTasker Kinetis simulator also simulates the Program Once Memory (as well as all other Flash operation) to allow experimenting with code to ensure correct usage before moving to the HW (where any mistakes can't be deleted).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Tue, 19 Jan 2016 02:27:24 GMT</pubDate>
    <dc:creator>mjbcswitzerland</dc:creator>
    <dc:date>2016-01-19T02:27:24Z</dc:date>
    <item>
      <title>What is the address of the Program Once Field in the program flash IFR?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496605#M30886</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi everyone,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;We're using the MK60DN512VLL10 in a product, and we plan to use the program once field to store a permanent MAC address.&amp;nbsp; We need to write this value in production using JTAG.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;In the user guide, the address range for the program once field is 0xC0-0xFF, but I can't seem to find the base address.&amp;nbsp; Program flash starts at address 0 as far as I can tell, but the program once field can't be at address 0xC0 as that's in the middle of the initial vector table.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Does anyone know the actual address of the field?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Thanks!&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Marlon&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Mon, 18 Jan 2016 04:12:45 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496605#M30886</guid>
      <dc:creator>marlonsmith</dc:creator>
      <dc:date>2016-01-18T04:12:45Z</dc:date>
    </item>
    <item>
      <title>Re: What is the address of the Program Once Field in the program flash IFR?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496606#M30887</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Marlon,&lt;/P&gt;&lt;P&gt;You can find the IFR's definition in the reference manual.&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-01-19_9-13-33.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/33635i411749B653F7B086/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-01-19_9-13-33.jpg" alt="2016-01-19_9-13-33.jpg" /&gt;&lt;/span&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="2016-01-19_9-25-11.jpg"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/33707iFFB67A364FCBCB90/image-size/large?v=v2&amp;amp;px=999" role="button" title="2016-01-19_9-25-11.jpg" alt="2016-01-19_9-25-11.jpg" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&lt;BR /&gt;Have a great day,&lt;BR /&gt;Ping&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;-----------------------------------------------------------------------------------------------------------------------&lt;BR /&gt;Note: If this post answers your question, please click the Correct Answer button. Thank you!&lt;BR /&gt;-----------------------------------------------------------------------------------------------------------------------&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 01:27:44 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496606#M30887</guid>
      <dc:creator>jeremyzhou</dc:creator>
      <dc:date>2016-01-19T01:27:44Z</dc:date>
    </item>
    <item>
      <title>Re: What is the address of the Program Once Field in the program flash IFR?</title>
      <link>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496607#M30888</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Marlon&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Don't be mislead by the address of the program once field. It is not a memory mapped address such as program Flash.&lt;/P&gt;&lt;P&gt;The K60 has 8 "record Indexes" which are 8 byte phrases than can be written or read. This gives 8 x 8 bytes (64 bytes) in these indexes.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;When reading or writing, the FCMD_PROGRAM_ONCE or FCMD_READ_ONCE commands are issued to the Flash controller, along with the record index in question and the flash controller either programs the record or returns its content.&lt;/P&gt;&lt;P&gt;The program once area cannot be addresses by a physical address so is not readable by using a pointer.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;You can get program once interface code from the uTasker project which gives the following general program once interface:&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;STRONG&gt;extern int fnProgramOnce(int iCommand, unsigned long *ptrBuffer, unsigned char ucBlockNumber, unsigned char ucLength);&lt;/STRONG&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;It supports programming and retrieving the MAC address from this area using the routines (showing how the interface is used):&lt;/P&gt;&lt;P&gt;Retrieval:&lt;/P&gt;&lt;PRE&gt;static void fnGetUserMAC(void)
{
&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long ulTestBuffer[2];&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;&amp;nbsp;&amp;nbsp; // the MAC address is saved in two long words
&amp;nbsp;&amp;nbsp;&amp;nbsp; fnProgramOnce(PROGRAM_ONCE_READ, ulTestBuffer, 0, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // read 2 long words from the start of the program-once area
&amp;nbsp;&amp;nbsp;&amp;nbsp; if (uMemcmp(ulTestBuffer, cucBroadcast, MAC_LENGTH) != 0) {&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // if programmed
&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(network[DEFAULT_NETWORK].ucOurMAC, ulTestBuffer, MAC_LENGTH); // use the stored value as MAC address
&amp;nbsp;&amp;nbsp;&amp;nbsp; }
}&lt;/PRE&gt;&lt;P&gt;Programming:&lt;/P&gt;&lt;PRE&gt;&amp;nbsp;&amp;nbsp;&amp;nbsp; unsigned long ulTestBuffer[2];
&amp;nbsp;&amp;nbsp;&amp;nbsp; ulTestBuffer[1] = 0xffffffff;
&amp;nbsp;&amp;nbsp;&amp;nbsp; uMemcpy(ulTestBuffer, temp_pars-&amp;gt;temp_network[DEFAULT_NETWORK].ucOurMAC, MAC_LENGTH); // retrieve first MAC address from storage
&amp;nbsp;&amp;nbsp;&amp;nbsp; fnProgramOnce(PROGRAM_ONCE_WRITE, ulTestBuffer, 0, 2);&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp;&amp;nbsp; // save to the first 2 long words in the program once area&lt;/PRE&gt;&lt;P&gt;Note that all operations use an 8 byte phrase (buffer) and unused bytes are set to 0xff. The MAC thus occupies a single phrase (organised as 2 long words in the passing buffer). In the uTasker projet the first phrase is used as MAC address as convention when the option is enabled.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The uTasker Kinetis simulator also simulates the Program Once Memory (as well as all other Flash operation) to allow experimenting with code to ensure correct usage before moving to the HW (where any mistakes can't be deleted).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Mark&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Tue, 19 Jan 2016 02:27:24 GMT</pubDate>
      <guid>https://community.nxp.com/t5/Kinetis-Microcontrollers/What-is-the-address-of-the-Program-Once-Field-in-the-program/m-p/496607#M30888</guid>
      <dc:creator>mjbcswitzerland</dc:creator>
      <dc:date>2016-01-19T02:27:24Z</dc:date>
    </item>
  </channel>
</rss>

