2016-11-13 05:05 PM
Hello everyone,
as I (too) am looking for a way to give my controller a unqie ID, I'm currently trying to decode and understand the built in unique_id register. So according to the refmanual, the Data sits at address 0x1FFFF7AC with offsets 0x00, 0x04 and 0x 0x00 gives: UID[31:0]: X and Y coordinates on the wafer expressed in BCD format 0x04 gives: Bits 31:8 UID[63:40]: LOT_NUM[23:0] - Lot number (ASCII encoded) Bits 7:0 UID[39:32]: WAF_NUM[7:0] - Wafer number (8-bit unsigned number) and 0x08 gives: Bits 31:0 UID[95:64]: LOT_NUM[55:24] Lot number (ASCII encoded) The following code is what I made of that information:#define ADDR_UID 0x1FFFF7AC
typedef
union
longlong_ascii{
long
long
in_long;
char
ascii[7];
}longlong_ascii;
typedef
struct
stm32_uid {
uint16_t x, y;
uint8_t WAF_NUM;
longlong_ascii LOT_NUM;
}stm32_uid;
volatile
stm32_uid device_id = {
.x = (*(uint32_t *) ADDR_UID) & 0xFFFF,
//not sure whether this is x or y
.y = ((*(uint32_t *) ADDR_UID) & 0xFFFF0000) >> 16,
// again x? or y?
.WAF_NUM = (*(uint32_t *) (ADDR_UID + 0x04)) & 0xFF,
.LOT_NUM = {((*(
long
long
*) (ADDR_UID + 0x04)) & 0xFFFFFFFFFFFFFF00)},
};
The results are for my specific chip:
x = 32
y = 12
WAF_NUM = 5
LOT_NUM.ascii = ''042ACC\0''
raw data:
*(uint32_t *) 0x1FFFF7AC = 0xc0020
*(uint32_t *) (0x1FFFF7AC + 0x04) = 0x41434305
*(uint32_t *) (0x1FFFF7AC + 0x08) = 0x20303432
I think this sounds reasonable and I wanted to share this with you guys, also I'd like to know which way round the x and y coordinates are stored? x in lower bytes? or in higher?
Interesting, that the LOT_NUM actually says ''042AAC''. I wonder how the counting is done here. Is 042 constant and refers to the F042 series? Is AAC hex counting? The chip marking is:
7846S
32F042F6T6
PHL 511
Thanks!
#stm32f042-unique-id