This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

CC2541: Create Serial Number from MAC address?

Part Number: CC2541


I want to create a 2 byte ID from the MAC address at XDATA 0x780E in the CC2541.  I'd like for it to be as unique as possible.  The MAC address for these parts looks like this:

54:4a:16:xx:yy:zz .  I believe the 3 high order bytes (mac_id[5], mac_id[4], mac_id[3]) are TI specific and constant, and the lower order 3 bytes (mac_id[2], mac_id[1], mac_id[0]) form unique CC2541 addresses.  Is this correct?

Assuming that is the case, I could use the lower order two bytes only, but then if, say, zz is constant for a run of parts and xx is changing the uniqueness is really poor.

So, I need an algorithm to best combine xx:yy:zz.  I propose the following but I'm wondering if flawed:

ID = (mac_id[0]   |  ( mac_id[1] << 8)) + mac_id[2];

Thanks,

GiGi

  • Hi Gi Gi,

    This seems like one way to get unique serial numbers. Are you constraint to 2**24 numbers (16,777,215) for your serial numbers at all? It would be nice to sell 16 million devices I suppose. I don't know the algorithm on how TI generates hardware addresses. On a side note, you can use your own secondary MAC address, if flashed in the .ccfg (Customer Configuration) table as documented in the TRM.

    You might want to try this in case mac[n] are of type uint8_t:
    uint32_t sn = mac[2]
    sn = (sn << 16) | (mac[1] << 8) | mac[0]
  • I am constrained to a 16 bit serial number (which will allow 65536 devices) due to adv packet space. 

    Thx

    G