How to get nRF51822 serial number and HW ID through SEGGER?

Dear Nordic Developer Zone,

At this time, I am able to program nRF51822 chips using the nrfjprog software : great.

I plan to use nrfjprog software driven by a custom C# software in production line to program bunch of nRF51822 chips.

Of course, I would like keep traces of all programmed chips. So here is my question : How can I retrieve the chip serial number and chip hardware ID like NRF51822_QFAA_C0?

Best regards

  • This can be done with the --memrd option. In FICR, there is a CONFIGID and a DEVICEID[0] and DEVICEID[1] register, the first one contain an ID for the hardware in the lower 16 bits, while the DEVICEID registers contain a 64 bit unique ID for the chip. These three registers can for example be read like this:

    C:\temp>nrfjprog --memrd 0x1000005c --n 12
    1000005c  ffff001d 3d31c239  1234c90f           |....9.1=..4.|

    As you can see, the HWID is 0x1d, while the other two words are the DEVICEID. If you instead want to read out the registers used for the Bluetooth address, you should read the DEVICEADDR registers, which are at offset 0xA4 and 0xA8. The offsets are given in table 6 in the nRF51 Reference Manual.

  • This is very useful as we're currently designing our production programming setup! :)

  • Further to this, if I'm looking for a globally unique identifier for an instance of my product, which is the best field to use? Are these others also options?

    ER[0] 0x080 Encryption root, bit 31-0 ER[1] 0x084 Encryption root, bit 63-32 ER[2] 0x088 Encryption root, bit 95-64 ER[3] 0x08C Encryption root, bit 127-96 IR[0] 0x090 Identity root, bit 31-0 IR[1] 0x094 Identity root, bit 63-32 IR[2] 0x098 Identity root, bit 95-64 IR[3] 0x09c Identity root, bit 127-96

    If I use DEVICEID, do I need to concatenate DEVICEID[0] and DEVICEID[1] in order to get something that's guaranteed to be unique?

    I'll be using this in code, not from the Segger, in case that makes any difference.

  • While we're here, what's the best way to access these in code? There's a NRF_FICR_Type struct in nrf51.h, but I don't see any use of it in the SDK.

  • Not sure if this is what you're getting at, but this works as expected:

    uint32_t deviceID[2]; deviceID[0] = NRF_FICR->DEVICEID[0]; deviceID[1] = NRF_FICR->DEVICEID[1];