1 <!-- HTML header for doxygen 1.8.20-->
2 <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "https://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
3 <html xmlns="http://www.w3.org/1999/xhtml">
5 <meta http-equiv="Content-Type" content="text/xhtml;charset=UTF-8"/>
6 <meta http-equiv="X-UA-Compatible" content="IE=9"/>
7 <meta name="generator" content="Doxygen 1.9.4"/>
8 <meta name="viewport" content="width=device-width, initial-scale=1"/>
9 <title>Raspberry Pi Pico SDK: pico_unique_id</title>
10 <!-- <link href="tabs.css" rel="stylesheet" type="text/css"/> -->
11 <script type="text/javascript" src="jquery.js"></script>
12 <script type="text/javascript" src="dynsections.js"></script>
13 <link href="navtree.css" rel="stylesheet" type="text/css"/>
14 <script type="text/javascript" src="resize.js"></script>
15 <script type="text/javascript" src="navtreedata.js"></script>
16 <script type="text/javascript" src="navtree.js"></script>
17 <link href="search/search.css" rel="stylesheet" type="text/css"/>
18 <script type="text/javascript" src="search/searchdata.js"></script>
19 <script type="text/javascript" src="search/search.js"></script>
20 <link href="https://fonts.googleapis.com/css2?family=Roboto:wght@300;400;500&display=swap" rel="stylesheet">
21 <link href="doxygen.css" rel="stylesheet" type="text/css" />
22 <link href="normalise.css" rel="stylesheet" type="text/css"/>
23 <link href="main.css" rel="stylesheet" type="text/css"/>
24 <link href="styles.css" rel="stylesheet" type="text/css"/>
27 <div class="navigation-mobile">
28 <div class="logo--mobile">
29 <a href="/"><img src="logo-mobile.svg" alt="Raspberry Pi"></a>
31 <div class="navigation-toggle">
32 <span class="line-1"></span>
36 <span class="line-3"></span>
39 <div id="top"><!-- do not remove this div, it is closed by doxygen! -->
41 <a href="index.html"> <img src="logo.svg" alt="Raspberry Pi"></a>
42 <span style="display: inline-block; margin-top: 10px;">
46 <div class="navigation-footer">
47 <img src="logo-mobile.svg" alt="Raspberry Pi">
48 <a href="https://www.raspberrypi.com/" target="_blank">By Raspberry Pi Ltd</a>
50 <!-- <div class="search">
52 <input type="search" name="search" id="search" placeholder="Search">
53 <input type="submit" value="Search">
56 <!-- Generated by Doxygen 1.9.4 -->
57 <script type="text/javascript">
58 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
59 var searchBox = new SearchBox("searchBox", "search",'Search','.html');
62 <script type="text/javascript" src="menudata.js"></script>
63 <script type="text/javascript" src="menu.js"></script>
64 <script type="text/javascript">
65 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
67 initMenu('',true,false,'search.php','Search');
68 $(document).ready(function() { init_search(); });
72 <div id="main-nav"></div>
74 <div id="side-nav" class="ui-resizable side-nav-resizable">
76 <div id="nav-tree-contents">
77 <div id="nav-sync" class="sync"></div>
80 <div id="splitbar" style="-moz-user-select:none;"
81 class="ui-resizable-handle">
84 <script type="text/javascript">
85 /* @license magnet:?xt=urn:btih:d3d9a9a6595521f9666a5e94cc830dab83b65699&dn=expat.txt MIT */
86 $(document).ready(function(){initNavTree('group__pico__unique__id.html',''); initResizable(); });
89 <div id="doc-content">
90 <!-- window showing the filter options -->
91 <div id="MSearchSelectWindow"
92 onmouseover="return searchBox.OnSearchSelectShow()"
93 onmouseout="return searchBox.OnSearchSelectHide()"
94 onkeydown="return searchBox.OnSearchSelectKey(event)">
97 <!-- iframe showing the search results (closed by default) -->
98 <div id="MSearchResultsWindow">
99 <iframe src="javascript:void(0)" frameborder="0"
100 name="MSearchResults" id="MSearchResults">
105 <div class="summary">
106 <a href="#nested-classes">Data Structures</a> |
107 <a href="#func-members">Functions</a> </div>
108 <div class="headertitle"><div class="title">pico_unique_id<div class="ingroups"><a class="el" href="group__high__level.html">High Level APIs</a></div></div></div>
110 <div class="contents">
112 <p>Unique device ID access API.
113 <a href="#details">More...</a></p>
114 <table class="memberdecls">
115 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="nested-classes" name="nested-classes"></a>
116 Data Structures</h2></td></tr>
117 <tr class="memitem:"><td class="memItemLeft" align="right" valign="top">struct  </td><td class="memItemRight" valign="bottom"><a class="el" href="structpico__unique__board__id__t.html">pico_unique_board_id_t</a></td></tr>
118 <tr class="memdesc:"><td class="mdescLeft"> </td><td class="mdescRight">Unique board identifier. <a href="structpico__unique__board__id__t.html#details">More...</a><br /></td></tr>
119 <tr class="separator:"><td class="memSeparator" colspan="2"> </td></tr>
120 </table><table class="memberdecls">
121 <tr class="heading"><td colspan="2"><h2 class="groupheader"><a id="func-members" name="func-members"></a>
122 Functions</h2></td></tr>
123 <tr class="memitem:gaf87ef8a55d8dc2520776e427a605b6fb"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__unique__id.html#gaf87ef8a55d8dc2520776e427a605b6fb">pico_get_unique_board_id</a> (<a class="el" href="structpico__unique__board__id__t.html">pico_unique_board_id_t</a> *id_out)</td></tr>
124 <tr class="memdesc:gaf87ef8a55d8dc2520776e427a605b6fb"><td class="mdescLeft"> </td><td class="mdescRight">Get unique ID. <a href="group__pico__unique__id.html#gaf87ef8a55d8dc2520776e427a605b6fb">More...</a><br /></td></tr>
125 <tr class="separator:gaf87ef8a55d8dc2520776e427a605b6fb"><td class="memSeparator" colspan="2"> </td></tr>
126 <tr class="memitem:ga14fc6ab3ef89570b7dddff13e1b49634"><td class="memItemLeft" align="right" valign="top">void </td><td class="memItemRight" valign="bottom"><a class="el" href="group__pico__unique__id.html#ga14fc6ab3ef89570b7dddff13e1b49634">pico_get_unique_board_id_string</a> (char *id_out, uint len)</td></tr>
127 <tr class="memdesc:ga14fc6ab3ef89570b7dddff13e1b49634"><td class="mdescLeft"> </td><td class="mdescRight">Get unique ID in string format. <a href="group__pico__unique__id.html#ga14fc6ab3ef89570b7dddff13e1b49634">More...</a><br /></td></tr>
128 <tr class="separator:ga14fc6ab3ef89570b7dddff13e1b49634"><td class="memSeparator" colspan="2"> </td></tr>
130 <a name="details" id="details"></a><h2 class="groupheader">Detailed Description</h2>
131 <p >Unique device ID access API. </p>
132 <p >RP2040 does not have an on-board unique identifier (all instances of RP2040 silicon are identical and have no persistent state). However, RP2040 boots from serial NOR flash devices which have a 64-bit unique ID as a standard feature, and there is a 1:1 association between RP2040 and flash, so this is suitable for use as a unique identifier for an RP2040-based board.</p>
133 <p >This library injects a call to the flash_get_unique_id function from the hardware_flash library, to run before main, and stores the result in a static location which can safely be accessed at any time via pico_get_unique_id().</p>
134 <p >This avoids some pitfalls of the hardware_flash API, which requires any flash-resident interrupt routines to be disabled when called into. </p>
135 <h2 class="groupheader">Function Documentation</h2>
136 <a id="gaf87ef8a55d8dc2520776e427a605b6fb" name="gaf87ef8a55d8dc2520776e427a605b6fb"></a>
137 <h2 class="memtitle"><span class="permalink"><a href="#gaf87ef8a55d8dc2520776e427a605b6fb">◆ </a></span>pico_get_unique_board_id()</h2>
139 <div class="memitem">
140 <div class="memproto">
141 <table class="memname">
143 <td class="memname">void pico_get_unique_board_id </td>
145 <td class="paramtype"><a class="el" href="structpico__unique__board__id__t.html">pico_unique_board_id_t</a> * </td>
146 <td class="paramname"><em>id_out</em></td><td>)</td>
150 </div><div class="memdoc">
152 <p>Get unique ID. </p>
153 <p >Get the unique 64-bit device identifier which was retrieved from the external NOR flash device at boot.</p>
154 <p >On PICO_NO_FLASH builds the unique identifier is set to all 0xEE.</p>
155 <dl class="params"><dt>Parameters</dt><dd>
156 <table class="params">
157 <tr><td class="paramname">id_out</td><td>a pointer to a <a class="el" href="structpico__unique__board__id__t.html" title="Unique board identifier.">pico_unique_board_id_t</a> struct, to which the identifier will be written </td></tr>
164 <a id="ga14fc6ab3ef89570b7dddff13e1b49634" name="ga14fc6ab3ef89570b7dddff13e1b49634"></a>
165 <h2 class="memtitle"><span class="permalink"><a href="#ga14fc6ab3ef89570b7dddff13e1b49634">◆ </a></span>pico_get_unique_board_id_string()</h2>
167 <div class="memitem">
168 <div class="memproto">
169 <table class="memname">
171 <td class="memname">void pico_get_unique_board_id_string </td>
173 <td class="paramtype">char * </td>
174 <td class="paramname"><em>id_out</em>, </td>
177 <td class="paramkey"></td>
179 <td class="paramtype">uint </td>
180 <td class="paramname"><em>len</em> </td>
188 </div><div class="memdoc">
190 <p>Get unique ID in string format. </p>
191 <p >Get the unique 64-bit device identifier which was retrieved from the external NOR flash device at boot, formatted as an ASCII hex string. Will always 0-terminate.</p>
192 <p >On PICO_NO_FLASH builds the unique identifier is set to all 0xEE.</p>
193 <dl class="params"><dt>Parameters</dt><dd>
194 <table class="params">
195 <tr><td class="paramname">id_out</td><td>a pointer to a char buffer of size len, to which the identifier will be written </td></tr>
196 <tr><td class="paramname">len</td><td>the size of id_out. For full serial, len >= 2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1 </td></tr>
203 </div><!-- contents -->
204 </div><!-- doc-content -->
206 <script src="main.js"></script>