Skip to main content
martin2399
Associate II
January 19, 2017
Solved

How to report issues on LL HAL driver for STM32L0 (Incorrect unique device ID flash location)

  • January 19, 2017
  • 2 replies
  • 1995 views
Posted on January 19, 2017 at 15:15

I need to read the unique device ID from a STM32L0.

The Low Level hal driver source (

stm32l0xx_ll_utils.h, 

V1.7.0, 31-May-2016) uses:

__STATIC_INLINE uint32_t LL_GetUID_Word0(void)

{

return (uint32_t)(READ_REG(*((uint32_t *)UID_BASE_ADDRESS)));

}

__STATIC_INLINE uint32_t LL_GetUID_Word1(void)

{

return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 4U))));

}

__STATIC_INLINE uint32_t LL_GetUID_Word2(void)

{

return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U))));

}

The reference manual says:

Base address: 0x1FF8 0050

Address offset: 0x00 => Bits 31:0

Address offset: 0x04 => Bits 63:32

Address offset: 0x14 => Bits 95:64

#uid #unique-id #unique-device-id-register""
    This topic has been closed for replies.
    Best answer by Imen.D
    Posted on February 23, 2018 at 17:40

    Hello

    ,

    The correct values are defined in the reference manual:

    Base address: 0x1FF8 0050

    Address offset: 0x00 => Bits 31:0

    Address offset: 0x04 => Bits 63:32

    Address offset: 0x14 => Bits 95:64

    The fix in the HAL should be included in the next release of STM32CubeL0, but I don't have the exact release date.

    So, this wrong line:

    __STATIC_INLINE uint32_t LL_GetUID_Word2(void) { return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U)))); }�?�?�?�?

    must be corrected to

    __STATIC_INLINE uint32_t LL_GetUID_Word2(void) { return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 0x14U)))); }�?�?�?�?

    Best Regards,

    Imen

    2 replies

    Technical Moderator
    January 19, 2017
    Posted on January 19, 2017 at 16:57

    Hello @

    Jorgensen.Martin

    ,

    Thanks for sharingthis issue and bringing itto our attention.

    We review your feedbackinternally and working for fixing it.

    Regards

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    Nils Weber
    Associate
    February 22, 2018
    Posted on February 22, 2018 at 13:23

    Hi

    DAHMEN.IMEN

    ‌,

    is there news on the address? I also have the same question and i'm unsure if I should trust the driver implementation or the reference manual.

    Thanks,

    Nils

    Imen.DBest answer
    Technical Moderator
    February 23, 2018
    Posted on February 23, 2018 at 17:40

    Hello

    ,

    The correct values are defined in the reference manual:

    Base address: 0x1FF8 0050

    Address offset: 0x00 => Bits 31:0

    Address offset: 0x04 => Bits 63:32

    Address offset: 0x14 => Bits 95:64

    The fix in the HAL should be included in the next release of STM32CubeL0, but I don't have the exact release date.

    So, this wrong line:

    __STATIC_INLINE uint32_t LL_GetUID_Word2(void) { return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 8U)))); }�?�?�?�?

    must be corrected to

    __STATIC_INLINE uint32_t LL_GetUID_Word2(void) { return (uint32_t)(READ_REG(*((uint32_t *)(UID_BASE_ADDRESS + 0x14U)))); }�?�?�?�?

    Best Regards,

    Imen

    In order to give better visibility on the answered topics, please click on 'Best answer' on the reply which solved your issue or answered your question. Thanks
    henry.dick
    Associate II
    February 22, 2018
    Posted on February 22, 2018 at 14:43

    In your code, if the uid is defined, undefine it and then redefine it to the right address.

    Nils Weber
    Associate
    February 23, 2018
    Posted on February 23, 2018 at 14:59

    what is the right address and what are the correct offsets to the 2nd and 3rd word?

    (That's what this issue is about, because driver and datasheet aren't stating the same thing, so it's unclear what gives the correct UID.)
    Tesla DeLorean
    Guru
    February 23, 2018
    Posted on February 23, 2018 at 15:02

    /*!

    * \brief Unique Devices IDs register set (STM32L0xxx)

    */

    ♯ define ID1 (0x1FF80050)

    ♯ define ID2 (0x1FF80054)

    ♯ define ID3 (0x1FF80064)
    Tips, Buy me a coffee, or three.. PayPal VenmoUp vote any posts that you find helpful, it shows what's working..