Skip to content

Commit 66335f1

Browse files
Clarify that RP2350 gets its unique id from OTP (#1942)
* Clarify that RP2350 gets its unique id from OTP Fixes #1915 * Wrap rp2040_specific and rp2350_specific bits
1 parent 8c08f2b commit 66335f1

File tree

1 file changed

+36
-10
lines changed

1 file changed

+36
-10
lines changed

src/rp2_common/pico_unique_id/include/pico/unique_id.h

Lines changed: 36 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@ extern "C" {
1818
*
1919
* \brief Unique device ID access API
2020
*
21+
* \if rp2040_specific
2122
* RP2040 does not have an on-board unique identifier (all instances of RP2040
2223
* silicon are identical and have no persistent state). However, RP2040 boots
2324
* from serial NOR flash devices which have at least a 64-bit unique ID as a standard
@@ -31,6 +32,11 @@ extern "C" {
3132
*
3233
* This avoids some pitfalls of the hardware_flash API, which requires any
3334
* flash-resident interrupt routines to be disabled when called into.
35+
* \endif
36+
*
37+
* \if rp2350_specific
38+
* On boards using RP2350, the unique identifier is read from OTP memory on boot.
39+
* \endif
3440
*/
3541

3642
#define PICO_UNIQUE_BOARD_ID_SIZE_BYTES 8
@@ -39,9 +45,18 @@ extern "C" {
3945
* \brief Unique board identifier
4046
* \ingroup pico_unique_id
4147
*
42-
* This struct is suitable for holding the unique identifier of a NOR flash
43-
* device on an RP2040-based board. It contains an array of
44-
* PICO_UNIQUE_BOARD_ID_SIZE_BYTES identifier bytes.
48+
* This structure contains an array of PICO_UNIQUE_BOARD_ID_SIZE_BYTES identifier bytes suitable for
49+
* holding the unique identifier for the device.
50+
*
51+
* \if rp2040_specific
52+
* On an RP2040-based board, the unique identifier is retrieved from the external NOR flash device at boot,
53+
* or for PICO_NO_FLASH builds the unique identifier is set to all 0xEE.
54+
* \endif
55+
*
56+
* \if rp2350_specific
57+
* On an RP2350-based board, the unique identifier is retrieved from OTP memory at boot.
58+
* \endif
59+
*
4560
*/
4661
typedef struct {
4762
uint8_t id[PICO_UNIQUE_BOARD_ID_SIZE_BYTES];
@@ -50,10 +65,16 @@ typedef struct {
5065
/*! \brief Get unique ID
5166
* \ingroup pico_unique_id
5267
*
53-
* Get the unique 64-bit device identifier which was retrieved from the
54-
* external NOR flash device at boot.
68+
* Get the unique 64-bit device identifier.
69+
*
70+
* \if rp2040_specific
71+
* On an RP2040-based board, the unique identifier is retrieved from the external NOR flash device at boot,
72+
* or for PICO_NO_FLASH builds the unique identifier is set to all 0xEE.
73+
* \endif
5574
*
56-
* On PICO_NO_FLASH builds the unique identifier is set to all 0xEE.
75+
* \if rp2350_specific
76+
* On an RP2350-based board, the unique identifier is retrieved from OTP memory at boot.
77+
* \endif
5778
*
5879
* \param id_out a pointer to a pico_unique_board_id_t struct, to which the identifier will be written
5980
*/
@@ -62,11 +83,16 @@ void pico_get_unique_board_id(pico_unique_board_id_t *id_out);
6283
/*! \brief Get unique ID in string format
6384
* \ingroup pico_unique_id
6485
*
65-
* Get the unique 64-bit device identifier which was retrieved from the
66-
* external NOR flash device at boot, formatted as an ASCII hex string.
67-
* Will always 0-terminate.
86+
* Get the unique 64-bit device identifier formatted as a 0-terminated ASCII hex string.
87+
*
88+
* \if rp2040_specific
89+
* On an RP2040-based board, the unique identifier is retrieved from the external NOR flash device at boot,
90+
* or for PICO_NO_FLASH builds the unique identifier is set to all 0xEE.
91+
* \endif
6892
*
69-
* On PICO_NO_FLASH builds the unique identifier is set to all 0xEE.
93+
* \if rp2350_specific
94+
* On an RP2350-based board, the unique identifier is retrieved from OTP memory at boot.
95+
* \endif
7096
*
7197
* \param id_out a pointer to a char buffer of size len, to which the identifier will be written
7298
* \param len the size of id_out. For full serial, len >= 2 * PICO_UNIQUE_BOARD_ID_SIZE_BYTES + 1

0 commit comments

Comments
 (0)