Assigning custom MAC address for DFU & Application (production line)

Hello,

     Is there any special area where I can save custom MAC address for each device ?

Basically I need to assign unique name and MAC address which the DFU and application should be able to share and I need to do it automate it at the time of production.

  • I cannot do it by patching some area in soft device. May be I can add it inside DFU bootloader somewhere on a fixed address and patch it at the time of production and the application can read it coz the location is fixed and is inside bootloader. But if I update bootloader for any reason, it shouldn't change.
  • Another option I am thinking is to keep a small area reserved in between the bootloader and the application.
  • Os is there any better solution for this ? Can I save it somewhere inside UICR registers ?
  • I can see from datasheet that UICR registers from offset 0x80 till 0xFC is reserved for customer. But is there any possibility that softdevice or SDK will use any of these locations ?

    Also if I write a MAC address to those area, what is the possibility that it will get erased to zero or cleared from a faulty application ?

    Can I prevent application writing or clearing bits of any written UICR register to ensure it will not change in future due to a buggy application ?

  • Hi, 

    You could typically write to the MAC address to the UICR register while programming the device. If you make the MAC address in UICR part of the HEX file, you would only have to program once, but it is probably more sensible to use the same hex file for all devices, and use a separate nrfjprog command to write to the UICR. The data written to the UICR cannot be erased without a full chip erase (this is the only difference between UICR and "normal" flash regions.)

    The software will read the UIRC and set the MAC address accordingly at startup. Please refer to this thread for a more detailed example.

    -Amanda

  • Hi Thanks for your comment.

    1. Correct me if I am wrong, what I felt is that we can make bits of UICR register to zero but making it 1 needs complete UICR erase. If I am right, then a UICR register could be corrupted by writing 0x0 to it right ?
    2. Another question is, is all the UICR user reserved registers from offset 0x80 to 0xfc is free for user application ? Or is there any registers in this range used by the softdevice and the sdk code ?
    3. Default value of UICR registers is 0xffffffff, so if we write anything other than that to it say FFFFFFF0 to 0x10001080, does it means further bit clear on this particular address is blocked until a complete erase?
  • Hi, 

    1. Yes. 

    2. For user application. 

    3. Yes. Once you change the UICR to something else, you would need to erase the whole UICR if you want to modify the same location that you modified (You can only write once to a location)

    -Amanda

Related