cancel
Showing results for 
Search instead for 
Did you mean: 

Lot # from UID - am I doing it right?

john doe
Lead
Posted on July 04, 2017 at 21:11

    uint32_t word0 = *(uint32_t *)(UID_BASE);

    uint32_t word1 = *(uint32_t *)(UID_BASE + 0x04); // offsets taken from reference manual

    uint32_t word2 = *(uint32_t *)(UID_BASE + 0x08);

    uint64_t lotNum;

bits 8:31 on word 1 are bits 23 through bit 0 of the batch number

word2 is bit 55 through bit 24 of the batch number

lotNum is the batch number, I think...

lotNum = ((uint64_t)word2 << 24 ) | (word1 >> 8);

1 REPLY 1
john doe
Lead
Posted on July 04, 2017 at 21:23

also, the reference manual says word0 is X and Y coordinates. which is high and which is low?

Device Unique ID: 002B0036 33355111 36303934

Wafer 17 of Lot Q534906

Location on wafer: X:54, Y:43

    len = 0;

    char idString[128] = {0};

    char lotNumString[32] = {0};

    uint32_t word0 = *(uint32_t *)(UID_BASE);

    uint32_t word1 = *(uint32_t *)(UID_BASE + 0x04); // offsets as per reference manual

    uint32_t word2 = *(uint32_t *)(UID_BASE + 0x08);

    uint32_t x = word0 & 0xFFFF;

    uint32_t y = (word0 & 0xFFFF0000) >> 16;

    uint32_t wafer = word1 & 0xFF;

    uint64_t lotNum;

    lotNum = (((uint64_t)word2 << 24 ) & 0xFFFFFFFFFFFFFFFF) | ((word1 >> 8) & 0xFFFFFFFF);

    len += sprintf(idString, 'Device Unique ID: ');

    len += sprintf(idString+len, '%08lX %08lX %08lX\r\n', word0, word1, word2);

    sprintf(lotNumString, '%s', (char *)&lotNum); // ASCII coded lot number

    len += sprintf(idString+len, 'Wafer %ld of Lot %s\r\n', wafer, lotNumString);

    len += sprintf(idString+len, 'Location on wafer: X:%ld, Y:%ld\r\n', x,y);

    printf('%s', idString);