2017-04-18 01:04 PM
My understanding of the UID is it's plopped into the device by ST and not touchable write-wise (read only) .
Makes it good for use in SERIAL number application like USB descriptor serial number string.
For the STM32L476 which address is correct for the UID register location ? 1FFF7A10 or 1FFF7590?And is the EVAL CDC demo fouled for this?
-------------------------------------------------------------------------------------------------
STM32L476 manual RM0351 (REV 5 March 2017) says49.1 Unique device ID register (96 bits)The unique device identifier is ideally suited:
• for use as serial numbers (for example USB string serial numbers or other end
applications)
• for use as part of the security keys in order to increase the security of code in Flash
memory while using and combining this unique ID with software cryptographic
primitives and protocols before programming the internal Flash memory
• to activate secure boot processes, etc.
The 96-bit unique device identifier provides a reference number which is unique for any
device and in any context. These bits cannot be altered by the user.
Base address: 0x1FFF 7590 (DING DING DING !!!)
----------------------------------------------------------------------------------------------
----------------------------------------------------------------------------------------------
EVAL USB CDC demo code file usbd_desc.h says :/* Exported constants --------------------------------------------------------*/#define DEVICE_ID1 (0x1FFF7A10)
#define DEVICE_ID2 (0x1FFF7A14)
#define DEVICE_ID3 (0x1FFF7A18)
-----------------------------------------------------------------------------------------------
------------------------------------------------------------------------------------------------EVAL USB CDC demo code that USES that stuff. usbd_desc.c says:
/*** @brief Create the serial number string descriptor
* @param None
* @retval None
*/
static void Get_SerialNum(void)
{
uint32_t deviceserial0, deviceserial1, deviceserial2;
deviceserial0 = *(uint32_t*)DEVICE_ID1; (0x1FFF7A10) ???????deviceserial1 = *(uint32_t*)DEVICE_ID2; (0x1FFF7A14) ???????
deviceserial2 = *(uint32_t*)DEVICE_ID3; (0x1FFF7A18) ???????
deviceserial0 += deviceserial2;if (deviceserial0 != 0){
IntToUnicode (deviceserial0, &USBD_StringSerial[2] ,8);
IntToUnicode (deviceserial1, &USBD_StringSerial[18] ,4);
}
}
------------------------------------------------------------------------------------------------
Nobbling all that together and programming the device with it, then snooping gets me THIS!:Device Descriptor:bcdUSB: 0x0200bDeviceClass: 0x00bDeviceSubClass: 0x00bDeviceProtocol: 0x00bMaxPacketSize0: 0x40 (64)idVendor: 0x0483 (STMicroelectronics)idProduct: 0x5740bcdDevice: 0x0200iManufacturer: 0x010x0409: 'STMicroelectronics'iProduct: 0x020x0409: 'STM32 Virtual ComPort in FS Mode'iSerialNumber: 0x030x0409: 'FFFFFFFEFFFF' <------------------------- !bNumConfigurations: 0x01And it gets me THIS 'FFFFFFFEFFFF' on EVERY device I program.Oh... And COM 6 is very prevalent... On EVERY DEVICE I PLUG IN.So in the EVAL DEMO - It looks like maybe the '1FFF7A10' register address is maybe okay for F devices. Right ?Looks like the L476 family it might need to be 1FFF7590. Right ?
What I sort of expected was -Every device I plug in has the same VID
Every device I plug in has the same PIDEvery device I plug in has a DIFFERENT USB SERIAL NUMBER STRINGIf I have 3 devices for example ( 3 separate micros on separate PCB's) Every device I plug in gets a NEW VCP com port number thefirst time. (Different serial number - or SUPPOSED to be anyway)From THEN ONWARD - unless someone clears the allocated com port numbers from the Windows box
Device 1 - Gets that SAME COM PORT NUMBER (com3 for example) tied to it, no matter what hole I plug it in to on that PC. (SERIAL NUMBER remembered by WINDOWS).
Device 2 - Gets that SAME COM PORT NUMBER (com4 for example) tied to it, no matter what hole I plug it in to on that PC. (SERIAL NUMBER remembered by WINDOWS).Device 3 - Gets that SAME COM PORT NUMBER (com5 for example) tied to it, no matter what hole I plug it in to on that PC. (SERIAL NUMBER remembered by WINDOWS).Please correct me where I went off track?
Solved! Go to Solution.
2017-04-18 01:59 PM
I did...
#if
0
/*** 'F' devices' ****/
#define
DEVICE_ID1 (0x1FFF7A10)
#define
DEVICE_ID2 (0x1FFF7A14)
#define
DEVICE_ID3 (0x1FFF7A18)
#endif
// #if 0
/*** 'L' devices ***/
#define
DEVICE_ID1 (0x1FFF7590)
#define
DEVICE_ID2 (0x1FFF7594)
#define
DEVICE_ID3 (0x1FFF7598)
// #endif
Works like I expected...
Device Descriptor:
bcdUSB: 0x0200bDeviceClass: 0x00bDeviceSubClass: 0x00bDeviceProtocol: 0x00bMaxPacketSize0: 0x40 (64)idVendor: 0x0483 (STMicroelectronics)idProduct: 0x5740bcdDevice: 0x0200iManufacturer: 0x010x0409: 'STMicroelectronics'iProduct: 0x020x0409: 'STM32 Virtual ComPort in FARTS Mode'iSerialNumber: 0x030x0409: '207032954834' < ------------------------ !! bNumConfigurations: 0x01Each working with a DIFFERENT / REMEMBERED com port !
No matter what USB hole.
So -
For the STM32L476 which address is correct for the UID register location ? 1FFF7A10 or 1FFF7590? ( 1FFF7590 / 1FFF7594 / 1FFF7598 for L476 )
And is the EVAL CDC demo fouled for this? (Yes.... )
Thanks!
2017-04-18 01:53 PM
Well why don't you just code that up and see what happens ?
2017-04-18 01:59 PM
I did...
#if
0
/*** 'F' devices' ****/
#define
DEVICE_ID1 (0x1FFF7A10)
#define
DEVICE_ID2 (0x1FFF7A14)
#define
DEVICE_ID3 (0x1FFF7A18)
#endif
// #if 0
/*** 'L' devices ***/
#define
DEVICE_ID1 (0x1FFF7590)
#define
DEVICE_ID2 (0x1FFF7594)
#define
DEVICE_ID3 (0x1FFF7598)
// #endif
Works like I expected...
Device Descriptor:
bcdUSB: 0x0200bDeviceClass: 0x00bDeviceSubClass: 0x00bDeviceProtocol: 0x00bMaxPacketSize0: 0x40 (64)idVendor: 0x0483 (STMicroelectronics)idProduct: 0x5740bcdDevice: 0x0200iManufacturer: 0x010x0409: 'STMicroelectronics'iProduct: 0x020x0409: 'STM32 Virtual ComPort in FARTS Mode'iSerialNumber: 0x030x0409: '207032954834' < ------------------------ !! bNumConfigurations: 0x01Each working with a DIFFERENT / REMEMBERED com port !
No matter what USB hole.
So -
For the STM32L476 which address is correct for the UID register location ? 1FFF7A10 or 1FFF7590? ( 1FFF7590 / 1FFF7594 / 1FFF7598 for L476 )
And is the EVAL CDC demo fouled for this? (Yes.... )
Thanks!
2017-04-18 03:41 PM
Did you use the UID_BASE values given in the STM32L4??xx.h header files?
2017-04-18 11:22 PM
Hi Uwe
At first I used the values as shown in the EVAL USB CDC device demo.I got that from the CubeL4 example cdc code for
EVAL. I was surprised each time I plugged in a different board and got the same com port. Knowing that was wrong, when I got time to look into it and saw the difference in the manual RM0351.and the usbd_desc.h file. I changed that .h file and it seems to work fine now.
2017-05-10 03:17 AM
Hello
Palmer.Randall
,I have checked and confirmed thisissue.
This is reported internally to take the necessary action.
Thank you for your contribution.
Imen
2017-05-10 09:24 AM
Glad to help. Thanks Imen