c++arduinoraspberry-pi-pico

Arduino RP2040 Pico Unique ID


I am using Raspberry pi pico on Arduino IDE. I am using this library githublink for it. There is 3 examples in this link, ArduinoUniqueID and ArduinoUniqueID8 doesn't print anything. Ide says

WARNING: library ArduinoUniqueID claims to run on avr, esp8266, esp32, sam, samd, stm32 architecture(s) and may be incompatible with your current board which runs on mbed_rp2040 architecture(s).

(but GitHub says we add RP2040)

When I try to use last example ArduinoUniqueIDSerialUSB , It prints something but they are not correct values. It prints these :

UniqueID: 30 00 33 00 39 00 31 00 36 00 30 00 45 00 36 00 32 00 41 00 38 00 32 00 34 00 38 00 43 00 33 00 
UniqueID: 34 00 38 00 43 00 33 00 

The correct unique ID values here : (I printed these with micropython)

hex value of s = e660a4931754432c
type s = <class 'bytes'>
s =  b'\xe6`\xa4\x93\x17TC,'

I don't even know what type 34 00 38 00 43 00 33 00 are, I try to convert hex but it prints same thing.

How can I find pico's Unique ID with Arduino Code ?


Solution

  • Adding this for those looking for the same solution in the future. Earl has added a rp2040.getChipID() function to his pico core which will provide the char * (c string) result. A code snippet is:

      // Print out my unique Id
      Serial.print("Unique Id: "); Serial.println(rp2040.getChipID());
    

    And here is the result:

    Unique Id: E66138528361BB32