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

Generation of a serialized ID code at load time.

Hello Nordic Pros,

I am a retired old school hardware guy doing some firmware for an NRF51822 product using the Kiel IDE.  In my prior life, doing similar work, I recollect adding some lines to a linker script in the load section that increments a variable each time a load is performed to a new board, and then using the variable from with the c code as (part of) a unique ID field for the device.  Does anyone have an example or any ideas of how to such a thing these days?  

Thanks in advance,

RobIn@TL

  • Hello Einar,

    I understand this, but it is not the same as the "target" ID that the central shows when connecting.  Please explain the difference and whether the "target" ID is unique enough to use as a product serial number, and if so, how to access it other than this central message?

    Thank you kindly,

    Robin@TL

  • Hi Robin,

    Can you elaborate on what you mean by "target" ID? Is it the BLE MAC address, or something else? This is the address that is seen by the BLE peer device. If it is the BLE MAC address, then this comes from the DEVICEADDR registers in FICR (if using the default random static BLE address), and is randomly generated for each device. Given the size (48 bit) you can consider it unique for most practical purposes.

    If you want an incrementing serial number (as it seems from your original question), then it makes sense to do as RK suggested: put this in the UICR, and make sure that you increment the number for each device in your production programming.

  • Hello Einar,

    When we test we use a Nordic 10028 usb dongle running the ble uart central code as the uart interface for command/resopnse.  When the central connects, it print an ID number reference as the "target" it is connected to.  What is this number and is it unique for a product serial number?

    Thank you

  • You have all the code, take a look and see what it's printing out. The only reference to 'target' I can see in the ble central uart code is 

    // Scan is automatically stopped by the connection.
    141              NRF_LOG_INFO("Connecting to target %02x%02x%02x%02x%02x%02x",
    142                       p_connected->peer_addr.addr[0],
    143                       p_connected->peer_addr.addr[1],
    144                       p_connected->peer_addr.addr[2],
    145                       p_connected->peer_addr.addr[3],
    146                       p_connected->peer_addr.addr[4],
    147                       p_connected->peer_addr.addr[5]
    

    is this what you're talking about? If so then it is the peer address. If not, what 'target ID' do you mean

  • Hello RK,

    Yes I have the code, and yes this is the "target" ID I am interested in possibly using as our board Serial#.  But this only tells me where it is in the central, not where it comes from in the peripheral.  Nor do I know if it is unique to each board (ie nordic chip). 

    Thanks again,

    Robin

Related