Skip to main content
Visitor II
February 1, 2018
Question

how to find MCU serial number/unique id for the MCU

  • February 1, 2018
  • 3 replies
  • 11017 views
Posted on February 01, 2018 at 11:12

how to find MCU serial number/unique id for the MCU?

    This topic has been closed for replies.

    3 replies

    Visitor II
    February 1, 2018
    Posted on February 01, 2018 at 11:37

    If you are using HAL:

    uint32_t HAL_GetREVID (void )

     uint32_t HAL_GetDEVID (void )
    Visitor II
    February 1, 2018
    Posted on February 01, 2018 at 12:15

    alternatively, find where the uid is located and simply point a pointer to it.

    for example, 

    #define U_ID ((const uint16_t *) 0x48CD) //U_ID95..0, referenced via U_ID[0], ..., U_ID[5]

    #define U_ID0 U_ID[0] //X coordinate

    #define U_ID1 U_ID[1] //Y coordinate

    ...

    the starting address, 0x48CD here, can vary from chip family to chip family but the basic idea is the same.

    Visitor II
    February 25, 2018
    Posted on February 25, 2018 at 11:33

    Does the STM8 have a serial number or unique ID?

    Golab.Bogdan

    ‌ and

    henry.****

    ‌ might be thinking of STM

    Visitor II
    February 25, 2018
    Posted on February 25, 2018 at 21:42

    I am sorry for misleading you. Frankly I do not know the STM8 family.

    But I googled the st site () and found for an example MCU:

    http://www.st.com/content/ccc/resource/technical/document/datasheet/e1/a6/12/61/ea/f1/4b/b3/CD00200092.pdf/files/CD00200092.pdf/jcr:content/translations/en.CD00200092.pdf

     

    it seems that there should be 96 unique id embedded in the a device.

    0690X00000608VhQAI.png

    I used this particular query using google to narrow down search results only to the st site:

    ''site:st.com stm8 unique id''

    Visitor II
    February 25, 2018
    Posted on February 25, 2018 at 23:42

    I'm currently using the STM8L052R8 and that does not have a unique ID, as far as I can tell by reading the data sheets and reference manual (and I just read back the data from 0x48CD and it's just zeros). So I looks like some STM8 devices do have a Unique ID, while others don't (or its not documented). The OP does not mention which device or family they are using. They'll need to read the data sheets to check.

    If they do have a device with a unique ID then method mentioned by

    henry.****

    ‌ would work, or could be adapted. To be unique all 12 bytes (96-bits) would be needed.