<?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>S32KのトピックRe: S32K144: Read 1s All Blocks command</title>
    <link>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991996#M5833</link>
    <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Read 1s Block command checks to see if an entire program flash or data flash block has been erased to the specified margin level.&lt;BR /&gt;That is whole PFlash block 0x00000000 – 0x0007FFFF in this case.&lt;BR /&gt;Are you sure that the whole block is erased?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to read just a part of the PFlash block, use the Read 1s Section command instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
    <pubDate>Fri, 24 Jan 2020 15:33:12 GMT</pubDate>
    <dc:creator>danielmartynek</dc:creator>
    <dc:date>2020-01-24T15:33:12Z</dc:date>
    <item>
      <title>S32K144: Read 1s All Blocks command</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991995#M5832</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;I run the "&lt;STRONG&gt;Read 1s All Blocks&lt;/STRONG&gt;" command over a S32K144 block (0x800B) which I know it's all erased (I checked it with a customized function as depicted below).&lt;BR /&gt;When I issued the command (see below) the return MGSTAT0 bit in register FSTAT is set, suggesting that Read-1s fails.&lt;/P&gt;&lt;P&gt;I run this command with all 3 Margin levels which return the same result.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;int&amp;nbsp; chk_block_earesed(u32 addr, int Margin_level)&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;{&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; int rc;&lt;/EM&gt;&lt;BR /&gt; &lt;BR /&gt;&lt;EM&gt; addr &amp;amp;= ~(PROG_SEC_SIZE-1);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FSTAT= 0x70;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FCCOB[3]= 0x00; /* (RD1BLK) Read 1s Block command */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FCCOB[2]= (addr&amp;gt;&amp;gt;16)&amp;amp;0xff ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FCCOB[1]= (addr&amp;gt;&amp;gt; 8)&amp;amp;0xff ;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FCCOB[0]= 0x00 ; /* address [2:0] = 000 */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; FTFC-&amp;gt;FCCOB[7]= Margin_level ;&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;rc= (int)FlashCommandSequence();&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; rc= (int)(FTFC-&amp;gt;FSTAT &amp;amp; 0x7f);&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; return rc;&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;}&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The stand alone-function (assembler, to speed-up the loop) is:&lt;/P&gt;&lt;P&gt;/***************************************&lt;BR /&gt; check if a given block is all-one&lt;BR /&gt; int DG_isAll_One(uint32_t addr, int16_t byte_size);&lt;BR /&gt; note: byte_size must be N*4&lt;BR /&gt; note: addr must be aligned to 4&lt;BR /&gt; r2= cur loop fetch addr&lt;BR /&gt; r3= loop-cnt&lt;BR /&gt; r4= temp fetch&lt;BR /&gt; r5= result&lt;/P&gt;&lt;P&gt;Author: David Gabbay&lt;BR /&gt;***************************************/&lt;BR /&gt; &lt;EM&gt;.thumb_func&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; .align 2&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; .globl DG_isAll_One&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; .weak DG_isAll_One&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; .type DG_isAll_One, %function&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt;/*------------------------------------*/&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;DG_isAll_One:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; lsrs r3, r1, #2 /* div by 4 */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; bgt all_1s_cont /* do the job if valid size */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; blx lr /* return if not valid size */&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;all_1s_cont:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; push {r4-r5,lr} /* save non-volatile reg */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; orr r2,r0,r0 /* make r2 loop_addr */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; ldr r5,[r2] /* get 1st operand */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; b all_1s_lp&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;all_1s_lp:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; add r2,0x4&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; ldr r4,[r2]&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; and r5,r5,r4&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;all_1s_chk:&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; subs r3,r3,1 /* chk loop-cnt */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; bgt all_1s_lp /* continue if */&lt;/EM&gt;&lt;BR /&gt;&lt;EM&gt; mvns r0,r5 /* set result */&lt;/EM&gt;&lt;/P&gt;&lt;P&gt;&lt;EM&gt;pop {r4-r5,pc} /* restore reg + return to caller */&lt;/EM&gt;&lt;BR /&gt;/*------------------------------------*/&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;I decided to use this command because I had encountered issues (always the same address out of many) when I tried to program the p-flash.&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 22 Jan 2020 22:59:07 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991995#M5832</guid>
      <dc:creator>MPC8313ERDB_h</dc:creator>
      <dc:date>2020-01-22T22:59:07Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144: Read 1s All Blocks command</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991996#M5833</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hello David,&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;The Read 1s Block command checks to see if an entire program flash or data flash block has been erased to the specified margin level.&lt;BR /&gt;That is whole PFlash block 0x00000000 – 0x0007FFFF in this case.&lt;BR /&gt;Are you sure that the whole block is erased?&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;If you want to read just a part of the PFlash block, use the Read 1s Section command instead.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;BR /&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Fri, 24 Jan 2020 15:33:12 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991996#M5833</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-01-24T15:33:12Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144: Read 1s All Blocks command</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991997#M5834</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi Daniel,&lt;BR /&gt;Thank you for your clarification.&lt;/P&gt;&lt;P&gt;In my case the program-flash was not fully erased, so the returned value is actually &lt;EM&gt;correct&lt;/EM&gt;.&lt;BR /&gt;However, I would like to comment&amp;nbsp;that the definitions of&amp;nbsp;&amp;nbsp;"&lt;STRONG&gt;section&lt;/STRONG&gt;" and "&lt;STRONG&gt;block&lt;/STRONG&gt;" in the RM are not that clear. My recommendation (for next RM revision) is to include these items in paragraph&amp;nbsp; &lt;SPAN class=""&gt;36.1.2 (Flash memory sizes)&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;&amp;nbsp;&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;Many thanks&lt;/SPAN&gt;&lt;/P&gt;&lt;P&gt;&lt;SPAN class=""&gt;David&lt;/SPAN&gt;&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Sat, 25 Jan 2020 02:02:02 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991997#M5834</guid>
      <dc:creator>MPC8313ERDB_h</dc:creator>
      <dc:date>2020-01-25T02:02:02Z</dc:date>
    </item>
    <item>
      <title>Re: S32K144: Read 1s All Blocks command</title>
      <link>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991998#M5835</link>
      <description>&lt;HTML&gt;&lt;HEAD&gt;&lt;/HEAD&gt;&lt;BODY&gt;&lt;P&gt;Hi David,&lt;/P&gt;&lt;P&gt;The Flash memory sizes section in the RM will be updated.&lt;/P&gt;&lt;P&gt;It should contain the number of PFlash blocks and their size (for&amp;nbsp;each derivative).&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;"Section" is explained in the description of the commands (Read 1s Section, Program Section) that use it, for example:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper" image-alt="pastedImage_1.png"&gt;&lt;img src="https://community.nxp.com/t5/image/serverpage/image-id/99030i07F01BE9912B3FB1/image-size/large?v=v2&amp;amp;px=999" role="button" title="pastedImage_1.png" alt="pastedImage_1.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;In other words, the commands take the starting address of&amp;nbsp;a PFlash section and the number of double-phrases in the section.&lt;/P&gt;&lt;P&gt;&lt;/P&gt;&lt;P&gt;Regards,&lt;/P&gt;&lt;P&gt;Daniel&lt;/P&gt;&lt;/BODY&gt;&lt;/HTML&gt;</description>
      <pubDate>Wed, 26 Feb 2020 11:54:31 GMT</pubDate>
      <guid>https://community.nxp.com/t5/S32K/S32K144-Read-1s-All-Blocks-command/m-p/991998#M5835</guid>
      <dc:creator>danielmartynek</dc:creator>
      <dc:date>2020-02-26T11:54:31Z</dc:date>
    </item>
  </channel>
</rss>

