Unique ID for device detection.



  • I was wondering if I can get a unique ID for the device to register them in the cloud etc.
    Although there is a unique ID for microcontroller and EEPROM but I am thinking if there is any for the device itself.


  • DeveloperWorld

    Hi @heysadboy

    I will have to investigate and comeback to you.
    But would it be a problem for you creating a file in the filesystem with a number that you generate?

    BR



  • That is a nice idea. However, I am looking for something set up at the factory. I am not a security expert but my idea is to identify the device uniquely for initial authentication etc.

    I found that I can have a microcontroller ID to identify the device. I was thinking to put something on the flash memory of the device but it might be tempered...

    If there is any document where I can read more about the security of sony spresense please guide me I will be very grateful to you.



  • Hi @heysadboy

    Chip has Unique ID. And your application can get it by calling board_uniqueid().
    To call that, you need to include "board.h" on your c source file.

    Please try it.

    BR



  • Please make the board Unique ID available from the Arduino support library, or provide a working example showing how to use it from Arduino.
    Thank you


  • DeveloperWorld

    @m-Lewis

    Below is the code that shows how to get board unique ID using Arduino:

    #include <sys/boardctl.h>
    
    void setup() {
      uint8_t raw_id[CONFIG_BOARDCTL_UNIQUEID_SIZE];
      Serial.begin(115200);
    
      boardctl(BOARDIOC_UNIQUEID, (uintptr_t) raw_id);
      for (int i = 0; i < CONFIG_BOARDCTL_UNIQUEID_SIZE; i++) {
        Serial.print(raw_id[i], HEX);
      }
    }
    
    void loop() {
    }
    


  • Kamil,
    Yes, using boardctl() does work and provides the UniqueID from Arduino. Thank you! 👍 I guess <sys/boardctl.h> is included in one of my other includes since I didn't need it.
    M.Lewis


Log in to reply