freeelectron 发表于 2022-5-23 17:25

【AT-START-F425测评】+获取MCU96位唯一ID、FLASH大小

<p><font face="-apple-system, &amp;quot;"><font style="overflow-wrap:break-word; word-break:break-all; color:#444444; font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun; font-size:16px; font-style:normal; font-variant-ligatures:normal; font-weight:400; text-align:start; white-space:normal; background-color:#f2f9fd; text-decoration-thickness:initial; text-decoration-style:initial; text-decoration-color:initial"><font style="overflow-wrap:break-word; word-break:break-all; font-size:15px"><strong style="overflow-wrap:break-word; word-break:break-all; font-weight:700">1、关于电子签名</strong></font></font></font></p>

<p style="padding:0px; text-align:left"><span style="overflow-wrap:break-word"><span style="word-break:break-all"><span style="26px"><font face="-apple-system, &amp;quot;"><font style="overflow-wrap:break-word; word-break:break-all; color:#444444; font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun; font-size:16px; font-style:normal; font-variant-ligatures:normal; font-weight:400; text-align:start; white-space:normal; background-color:#f2f9fd; text-decoration-thickness:initial; text-decoration-style:initial; text-decoration-color:initial"><font style="overflow-wrap:break-word; word-break:break-all; font-size:15px"><font style="overflow-wrap:break-word; word-break:break-all; color:#4d4d4d"><font style="overflow-wrap:break-word; word-break:break-all; font-size:16px">设备的电子签名中包含的存储容量信息和96位的唯一设备ID。它被存储在片上闪存的信息模块 中。96位唯一设备ID对于每颗芯片而言都是唯一的。它可以用作序列号,或安全密钥的一部分, 等等。</font></font></font></font></font></span></span></span></p>

<p style="padding:0px; text-align:left">&nbsp;</p>

<p style="padding:0px; text-align:left"><strong>2、96位唯一ID和Flash大小</strong></p>

<p style="padding:0px; text-align:left"></p>

<p style="padding:0px; text-align:left"><font style="overflow-wrap:break-word; word-break:break-all; font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun; font-size:16px; font-style:normal; font-variant-ligatures:normal; font-weight:400; text-align:start; white-space:normal; background-color:#f2f9fd; text-decoration-thickness:initial; text-decoration-style:initial; text-decoration-color:initial; color:#4d4d4d"><font style="overflow-wrap:break-word; word-break:break-all; font-size:16px">96位ID信息,地址依次为0x1FFFF7E8、0x1FFFF7EC、0x1FFFF7F0;</font></font></p>

<p style="padding:0px; text-align:left"><span style="font-size:16px"><span style="overflow-wrap:break-word"><span style="word-break:break-all"><span style="color:#444444"><span style="font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun"><span style="font-style:normal"><span style="font-variant-ligatures:normal"><span style="font-weight:400"><span style="white-space:normal"><span style="background-color:#f2f9fd"><span style="text-decoration-thickness:initial"><span style="text-decoration-style:initial"><span style="text-decoration-color:initial"><span style="26px"><font style="overflow-wrap:break-word; word-break:break-all; color:#4d4d4d"><font size="3"><font style="overflow-wrap:break-word; word-break:break-all">flash大小信息,地址依次0x1FFF F7E0;</font></font></font></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>

<p style="padding:0px; text-align:left"><span style="font-size:16px"><span style="overflow-wrap:break-word"><span style="word-break:break-all"><span style="color:#444444"><span style="font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun"><span style="font-style:normal"><span style="font-variant-ligatures:normal"><span style="font-weight:400"><span style="white-space:normal"><span style="background-color:#f2f9fd"><span style="text-decoration-thickness:initial"><span style="text-decoration-style:initial"><span style="text-decoration-color:initial"><span style="26px"><font style="overflow-wrap:break-word; word-break:break-all; color:#4d4d4d"><font style="overflow-wrap:break-word; word-break:break-all; font-size:16px">设备出厂的时候,已经固化在mcu内部的,用户不可更改。</font></font></span></span></span></span></span></span></span></span></span></span></span></span></span></span></p>

<p style="padding:0px; text-align:left">&nbsp;</p>

<p style="padding:0px; text-align:left"><strong>3、程序读取</strong></p>

<pre>
<code>#define   STORAGE_INFO       0x1FFFF7E0
#define   STORAGE_INFO_SRAM
#define   STORAGE_INFO_FLASH

#define   UNIQUE_ID   0x1FFFF7E8

#define   UNIQUE_ID_0_31   0x1FFFF7E8
#define   UNIQUE_ID_32_63    0x1FFFF7EC
#define   UNIQUE_ID_64_95    0x1FFFF7F0


struct McuInfo_t
{
      uint32_t Size;
      uint8_t UniqueId;
}McuInfo;



void GetMcuInfo(void)
{
      McuInfo.Size=*(uint32_t*)STORAGE_INFO;
      
      printf("flash size=%dk\r\n\r\n",McuInfo.Size);
      printf("unique id:[");

      for(uint8_t i=0;i&lt;12;i++)
      {
                McuInfo.UniqueId=*(uint8_t*)(UNIQUE_ID+i);
                printf(" %02x",McuInfo.UniqueId);
      }
      printf("]\r\n");

}</code></pre>

<p style="padding:0px; text-align:left">&nbsp;</p>

<p style="padding:0px; text-align:left"><font face="-apple-system, &amp;quot;"><font style="overflow-wrap:break-word; word-break:break-all; color:#444444; font-family:Tahoma, &quot;Microsoft Yahei&quot;, Simsun; font-size:16px; font-style:normal; font-variant-ligatures:normal; font-weight:400; text-align:start; white-space:normal; background-color:#f2f9fd; text-decoration-thickness:initial; text-decoration-style:initial; text-decoration-color:initial"><font style="overflow-wrap:break-word; word-break:break-all; font-size:15px"><strong style="overflow-wrap:break-word; word-break:break-all; font-weight:700">4、实验现象</strong></font></font></font></p>

<p style="padding:0px; text-align:left"> &nbsp;</p>

<p style="padding:0px; text-align:left">&nbsp;</p>

<p style="padding:0px; text-align:left">&nbsp;</p>

<p style="padding:0px; text-align:left">可以看出,程序读取的和调试器调试读取的一致。 &nbsp;</p>

lugl4313820 发表于 2022-5-23 19:43

这几天测试的频率很高呀,还有什么精彩作品呀。
页: [1]
查看完整版本: 【AT-START-F425测评】+获取MCU96位唯一ID、FLASH大小