Programming and reading OTP

I want to store some board info (serial number etc.) in OTP during board production. I managed to program OTP[189] trough J-Link commander. Now I want to read it back in the application.

My first attempt was to read the address:

This results in a bus fault. Reading trough earlier topics on this subject I suspect the OTP can only be read by secure code? All earlier topics mention the secure partition manager, which is now deprecated (using SDK 2.1.0).

I tried to convert to TF-M, using the following code:

But this always gives the default serial, and the following line in the console:

tfm_..._mem_read failed: plt_err: 0x2, err: 0xffffffff

I guess I need to add the address to some whitelisted addresses that the non-secure code can read?

Parents Reply Children
  • Still working on this. If I understand correctly: Reading UICR is only allowed from secure code. TF-M is now the default in SDK 2.1.0, but it has no way to read the OTP area, so UICR is now useless for storing user data?

    What way does Nordic suggest to store non-changeable data such as a serial number?

  • Hi,

     

    My apologies for the inconvenience. The feature request has not yet been implemented. I will add your comments to the internal task.

    At this moment, since there is no added logic for reading UICR in TFM, it has to be stored in another place, for instance in a settings page (using for instance nvs) in flash.

     

    Kind regards,

    Håkon

  • Hi, 

    Any update on when we can hope to see reading UICR supported in TFM?

  • Hi,

     

    Unfortunately, the task is not yet addressed, but I will address your comment to the team.

     

    Kind regards,

    Håkon

  • I want to bump this as well, I am working on a project where we would like to use the OTP to ensure read-only data. Are there any updates on this fix?