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

52832 NFC change the serial number

i download the sample code (\examples\nfc\record_text) to pca10040,it can be detected by NFC reader,the serial number is 5f:46:ac:eb:75:a7:ea,if i want to change this number ,what can i do?

  • You probably mean ISO14443 7-byte UID (sometimes called Card Serial Number = CSN in RFID) which Nordic calls NFCID. Read more about it here. As you see it's about setting NFCIDSIZE part of SENSRES register and then and UID itself in NFCID1_LAST, NFCID1_2ND_LAST and NFCID1_3RD_LAST. It is populated by default from FICR NFC.TAGHEADERx registers.

    (In other words I don't see any API function call to manage this so I'd write to NFCID1_xxx after NFC library is initialized.)

  • Looks like nfc_t4t_setup loads the values from the FICR into the NFCID registers, but also caches it in RAM. Setting the NFCID registers after NFC library initialization does not appear to change the actual serial number.

  • The first answer is correct, but it needs clarification where to set up these registers. When running on nRF52832 device, remember that the NFC HAL module (hal_nfc_t2t) needs to implement workarounds for NFCT HW errata. One of the workarounds is re-initialization of the NFCT registers after NFC field is lost. So the right place to update is hal_nfc_common_hw_setup() static function which is called not only when calling nfc_t2t_setup(), but also in the re-intialization procedure. Otherwise your settings may be overwritten.

    By default the UID is fetched from the FICR registers, but it can be changed. As written in the first answer you can change the NFCID1 size in SENSRES register. The NFCID1 naming is taken from the NFC Forum Digital Protocol specification.

    Important: remember that setting the NFCID1 registers just sets up the data used in Automatic Collision Resolution Process (ISO 14443-3 protocol). But the UID bytes are also part of the Type 2 Tag memory - these are set through the T2T library API nfc_t2t_internal_set() and must be consistent with the NFCID1 setting. If you set the internal bytes in hal_nfc_common_hw_setup() (as described above) you will be OK because it sets up both NFCID1 and the T2T memory UID bytes (in nfc_t2t_setup()).

  • And BTW we may consider providing a simpler way to modify the UID bytes. Just a question: would a dynamic runtime update be required, or would static (compile-time) configuration be enough?

Related