cancel
Showing results for 
Search instead for 
Did you mean: 

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

martin2399
Associate II
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""
1 ACCEPTED SOLUTION

Accepted Solutions
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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen

View solution in original post

8 REPLIES 8
Imen.D
ST Employee
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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen
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

henry.dick
Senior II
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.

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.)
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 Venmo
Up vote any posts that you find helpful, it shows what's working..
Posted on February 23, 2018 at 15:31

thanks Clive! Just out of curiousity: where did you find that the reference manual is correct and the drivers are wrong?

I have two STM32L073RZ and read the UUID on both like this:

myProperties.UUID1 = (uint32_t) ((uint32_t*) 0x1FF80050);

myProperties.UUID2 = (uint32_t) ((uint32_t*) 0x1FF80054);

myProperties.UUID3 = (uint32_t) ((uint32_t*) 0x1FF80064);

When I then print the

myProperties.UUID1 etc the first o

ne gives me:

UUID 536346704 536346708 536346724

and the other gives me:

UUID 536346704 536346708 536346724

and that's not good when it should be a unique ID i figured

🙂

 

I guess it's a pretty stupid mistake i'm making, but I can't figure out where?!

Posted on February 23, 2018 at 15:51

chehck the reference manual: they are not consistently at the same place.

the chance of ST making a mistake in the reference manual is much smaller than the chance of ST making a mistake in the code.

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

When your question is answered, please close this topic by clicking "Accept as Solution".
Thanks
Imen