cancel
Showing results for 
Search instead for 
Did you mean: 

Derivation of 12-character USB serial number in STM32C0's system bootloader

DavidEGrayson
Associate

How does the bootloader in the STM32C071 system memory generate its 12-character USB serial number string descriptor (e.g. "205537C24236")?  I notice some similarities between this serial number and the 96-bit unique device ID at address 0x1FFF7550, but overall they look very different.  I'm asking because I would like my firmware to use the same serial number as the bootloader, and being able to use a compact serial number would be beneficial as well.

Here are some examples of the 96-bit unique ID (hex formatted, with dashes after every 2 bytes) and the corresponding 12-character USB serial number:

1: 7A00-2500-0150-3642-4837-3020, 205537C24236
2: 7B00-5700-0150-3642-4837-3020, 208737C34236
3: 7B00-2700-0150-3642-4837-3020, 205737C34236
4: 7B00-8100-0150-3642-4837-3020, 20B137C34236

I looked at the documentation of the unique ID in RM0490, section 30.1, but that documentation was partially incorrect and did not help.

 

1 ACCEPTED SOLUTION

Accepted Solutions
DavidEGrayson
Associate

I figured it out!  I found a useful thread on this forum and it appears the STM32C0's bootloader is behaving the same was as the STM32F4, so you can generate the 16-bit words needed by doing:

uint16_t * const uid = (uint16_t *)UID_BASE;

uint16_t words[] = { uid[1] + uid[5], uid[0] + uid[4], uid[3] };

I would have just deleted my original post if I could find the option for that.

View solution in original post

1 REPLY 1
DavidEGrayson
Associate

I figured it out!  I found a useful thread on this forum and it appears the STM32C0's bootloader is behaving the same was as the STM32F4, so you can generate the 16-bit words needed by doing:

uint16_t * const uid = (uint16_t *)UID_BASE;

uint16_t words[] = { uid[1] + uid[5], uid[0] + uid[4], uid[3] };

I would have just deleted my original post if I could find the option for that.