cancel
Showing results for 
Search instead for 
Did you mean: 

Unique ID Returning Zeros

davidbleakley9
Associate II
Posted on September 29, 2011 at 12:41

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:

  1. I have not set up something correctly.
  2. I have managed to erase this location.
  3. I have got a dodgy device.
Any Ideas?

#stm8-stm8s105-unique-id-96-bit
10 REPLIES 10
brazov22
Associate II
Posted on September 30, 2011 at 15:19

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.

brazov2

davidbleakley9
Associate II
Posted on September 30, 2011 at 16:47

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 ROP

According 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-out

protection

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=false
brazov22
Associate II
Posted on September 30, 2011 at 20:54

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.

brazov

davidbleakley9
Associate II
Posted on September 30, 2011 at 23:16

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.

davidbleakley9
Associate II
Posted on October 03, 2011 at 11:52

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 1A

6F 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 1A

78 87 71 8E 76 89 6B 94 1A E5 E5 1A

They do look like they could be the Unique Ids

davidbleakley9
Associate II
Posted on October 03, 2011 at 13:12

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:

http://translate.google.com/translate?hl=en&sl=zh-CN&u=http://bbs.eeworld.com.cn/thread-254362-1-3.html&ei=Ro-JTpqrBMm90QX837DUDw&sa=X&oi=translate&ct=result&resnum=1&ved=0CCUQ7gEwADgU&prev=/search?q%3DSTM8%2Bunique%2Bid%26start%3D20%26hl%3Den%26safe%3Dactive%26client%3Dfirefox-a%26sa%3DN%26rls%3Dor...

I wonder if I have older devices and if this is true.

davidbleakley9
Associate II
Posted on October 07, 2011 at 18:02

My supplier has confirmed one of the batches was missing the unique id.

I will confirm if my devices are part of this batch.

davidbleakley9
Associate II
Posted on October 14, 2011 at 19:04

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?

mighel84
Associate II
Posted on October 18, 2011 at 18:18

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&currentviews=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&currentviews=70