This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Firmware detect NRF51/NRF52 at runtime

Greetings,

We've got a product which has a NRF51 device on it, which has since updated the design to NRF52. Both variants have a DFU feature.

For the NRF52 I can positively identify it at runtime by reading NRF_FICR->INFO.PART (which is 0x52832 for the NRF52832). Is there a way for the NRF51 (at runtime) to positively identify it from the NRF52? Ideally this would use registers that are common between the NRF52 and the NRF51.

Note: I've got two different targets for the NRF51 and NRF52. When I'm producing a binary, I know whether it is a NRF51 or NRF52 and set the a value in the firmware appropriately. I'm just curious if there is a "full-proof way" in determining at run time whether the CPU is a NRF51 or a NRF52.

  • There is indeed such identification on nRF51 family devices as well;) However it's not as nice as on nRF52:

    • See nRF51 Reference Manual on Infocenter and specifically CONFIGID register within FICR region.
    • There is 16-bit HWID which identifies every silicon + packaging combination Nordic've ever released.
    • Unfortunately it's not human readable value like on nRF52 FICR and also Nordic doesn't release public list/database of these HWIDs.
    • Solution is to either use information from nrF51deviceids.xml file which used to be distributed with nRFgo Studio installation - but Nordic has deprecated this method and now they hardcode and obfuscate this list directly into binaries of that tool (as far as I know).
    • Alternatively you can also simply read this from every device you produce (I believe you get chips only from certain badges so each production batch has the same nRF5x HW ID) and build your own DB.
    • You can also CODESIZE and CODEPAGESIZE registers from FICR region as indication.
    • In the end the information that it's nRF51 can be simply added by your FW because it will be always known to it that it's nRF51 (simply because I don't think you could build "dual boot" FW image which would be able to run on both nRF51 and nRF52. Based on that information you again process DFU with specific FW image which can run only on one family. The only cosmetic drawback is that "HW identification" code snippet will differ for nRF51 and nRF52 but even if you want to have almost identical code (and you run on S13x SDs which are as close as possible on both platforms - which is S13x V2) there will be much more #if defined(NRF51) - #elseif defined(NRF52) constructions...

    Cheers Jan

  • nrF51deviceids.xml will be available in %LOCALAPPDATA%\Nordic Semiconductor\nRFgo Studio\nrF51deviceids.xml after you have run nRFgo Studio.

  • Thanks Jørgen, I've missed the condition that I need to run the tool at least once;) However last update seems to be from 20160831, wouldn't it be really possible to support actual list on Infocenter or GitHub?

  • I think this has been requested internally before. I will forward your request, but at least the information is still available in the nRFgo studio file.

Related