2011-09-29 03:41 AM
I am using ST Visual Develop
STM8S105xx Datasheet Page 57 details the 96-bit unique device identifier My Device is STM8S105K6 I am using stm8s_flash.c to call the FLASH_ReadByte function as follows: for (i=0; i<12; i++) u_id[i] = FLASH_ReadByte(0x48CD+i); u_id is filled with zeros. I looked in the memory view and this location also appears to be filled with zeros. I can read other locations as expected. The Flash Registers are:
[0x505a] FLASH_CR1 - Flash control register 1
0x00
[0x505b] FLASH_CR2 - Flash control register 2
0x00
[0x505c] FLASH_NCR2 - Flash complementary control register 2
Intrusive read
[0x505d] FLASH_FPR - Flash protection register
0x00
[0x505e] FLASH_NFPR - Flash complementary protection register
0xff
[0x505f] FLASH_IAPSR - Flash in-application programming status register
Intrusive read
[0x5062] FLASH_PUKR - Flash Program memory unprotection register
0xae
[0x5064] FLASH_DUKR - Data EEPROM unprotection register
0x56
The option Bytes are
AFR1
Default
AFR2
Alternate Ative
AFR3
Default
AFR4
Default
AFR5
Default
AFR6
Default
AFR7
Default
CKAWUSEL
Low Speed Internal
EXTCLK
External Oscillator
HSECNT0
0
HSECNT1
0
HSECNT2
0
HSECNT3
0
HSECNT4
0
HSECNT5
0
HSECNT6
0
HSECNT7
0
HSITRIM
3-bit trimming
IWDG HW
Software
LSI_EN
Disabled
PRSC
16MHz to 128kHz
ROP
Read-out protection disabled
UBC
Write protection disabled
WWDG_HALT
No Reset
WWDG_HW
Software
l2C
Frozen when stopped
Timer1
Frozen when stopped
T�mer2
Frozen when stopped
T�mer3
Frozen when stopped
T�mer4
Frozen when stopped
A combination of the following may be true:2011-09-30 06:19 AM
Hi,
you can exclude 2. because this part of memory location is write protected, user can't erase it by accident. Ensure ROP is not enabled. brazov22011-09-30 07:47 AM
Hi brazov2,
Thanks for your response. I agree that I should not be able to erase the UID. I wondered if it may not have been secured on this batch and I might have erased it. I have done a little digging on the ROPAccording to the MCU configuration window, Read-out protection is disabled
.
I can read the option bytes in the memory view, however the unique id remains blank. The first location0x4800 (Read-outprotection
ROP) = 0 From what I understand ROP is enabled by writing 0xAA to 0x4800, this also points to ROP being disabled. I attached s screen shot of the option bytes and the unique id (Red= Option Bytes, Blue=Unique ID) Any further pointers are appreciated. ________________ Attachments : STM8S105K6_Option_UniqueID.jpg : https://st--c.eu10.content.force.com/sfc/dist/version/download/?oid=00Db0000000YtG6&ids=0680X000006HzAL&d=%2Fa%2F0X0000000bKh%2FY6VNF6yJgZe9nZpwJ4Brr2L_y8YOySx7rAfyRkFgpfg&asPdf=false2011-09-30 11:54 AM
I had a look on memory map, ROP it's not enabled. The 96 bit unique id is not present in the locations specified in the datasheet. It seems you have a dodgy device. The strange thing is that in the same area in the row above there are 96 bit. Or the datasheet is wrong or the device is dodgy.
brazov2011-09-30 02:16 PM
Thanks again for your reply.
I had a brief look at another board (with a different stm8), It also returned zeros. On Monday I will look to see if the 96 bits in the reserved area could be the unique id in the wrong place. I will compare a few boards.2011-10-03 02:52 AM
Addresses
0x48B0 to 0x48BC read as follows on the 5 PCBs I have available.
71 8E 6D 92 6E 91 86 97 1A E5 E5 1A6F 90 6E 91 6B 94 6B 94 1A E5 E5 1A
72 8D 6F 90 6F 90 6B 94 1A E5 E5 1A
77 88 73 8C 74 8B 6F 90 1A E5 E5 1A78 87 71 8E 76 89 6B 94 1A E5 E5 1A
They do look like they could be the Unique Ids2011-10-03 04:12 AM
I have done a little research:
STM8S103K3 STM8S103F3 STM8S103F2: 0x4865 STM8S105xx: 0x48CD[Possibly 0x48B0 as the numbers in this location seem plausible]
STM8S207xx, STM8S208xx: 0x48CD STM8S903K3 STM8S903F3: 0x4865 STM8L101xx: 0x4925 STM8L151x2, STM8L151x3: 0x4926 STM8L151xx, STM8L152xx: 0x4926 STM8L15xx8, STM8L15xR6: 0x4926 STM8L162R8, STM8L162M8: 0x4926 I did find a forum thread suggests that devices produced after the end of 2009 have the Unique ID: I wonder if I have older devices and if this is true.2011-10-07 09:02 AM
My supplier has confirmed one of the batches was missing the unique id.
I will confirm if my devices are part of this batch.2011-10-14 10:04 AM
I have replaced the STM8 with a different device (from RS)
I get: Unique ID [0x48CD]= 0x0 Unique ID [0x48CE]= 0x3D Unique ID [0x48CF]= 0x0 Unique ID [0x48D0]= 0x60 Unique ID [0x48D1]= 0x17 Unique ID [0x48D2]= 0x36 Unique ID [0x48D3]= 0x30 Unique ID [0x48D4]= 0x34 Unique ID [0x48D5]= 0x32 Unique ID [0x48D6]= 0x31 Unique ID [0x48D7]= 0x35 Unique ID [0x48D8]= 0x36 This must be a batch problem. The failing devices all had:05K6U6 9YBNG VG MYS 917
written on the top. I have not heard from ST yet?2011-10-18 09:18 AM
It seems ok now, looks at mine:
https://my.st.com/public/STe2ecommunities/mcu/Lists/stm81/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/stm81/STM8S 96 bit Unique ID on Ride7&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580001E3853D9DB932A46A3FE4CD15CAB46FB¤tviews=70
https://my.st.com/public/STe2ecommunities/mcu/Lists/stm81/Flat.aspx?RootFolder=https://my.st.com/public/STe2ecommunities/mcu/Lists/stm81/STM8S 96 bit Unique ID on Ride7&FolderCTID=0x01200200770978C69A1141439FE559EB459D7580001E3853D9DB932A46A3FE4CD15CAB46FB¤tviews=70