cancel
Showing results for 
Search instead for 
Did you mean: 

SWIM DeviceID Read & ROP check-method?

at1
Associate II
Posted on February 23, 2014 at 21:47

Hi,

I am developing a standalone programming board for stm8 devices with SWIM interface.

Development is quite far but I am still facing some questions I see nowhere answered:

1: in Flash Programming Manual it says there is a ''DeviceID'' that can/should be read. Can someone give me more information how/where to read that ID and which ID represents which device?

2: How to clean detect that a device has active readout protection set? The SWIM_CSR NO_ACCESS bit seems to be always 0 to me (using STM8S003 device). When I try to read memory of a protected device it always reads 0x71 and writing to memory fails with the data-bytes not being ACKed be the target. Are these the only indications for an active ROP or is there a clean way to detect the ROP?

Thank you!

Best regards,

Alex

#swim-interface-stm8-rop-deviceid
8 REPLIES 8
chen
Associate II
Posted on February 28, 2014 at 12:11

Hi

Im using a different part to you but

''The readout protection is enabled by writing 0xAA in the ROP option byte. It is disabled by reprogramming the ROP option byte with any value except for 0xAA and resetting the

device.''

in response to ''2: How to clean detect that a device has active readout protection set?''

In addition,are you sure your read is working?

Check with oscilloscope or logic analyser.

Use ST-Link (or something that does write OK) to write a known value to a known location.

Read beck using your implementation - does it read back correctly?

Does the waveform look correct?

at1
Associate II
Posted on February 28, 2014 at 14:31

Hi,

I can successfully read and write from and to the device. I tried flash, eeprom and opt.

I also read back flash and opt after writing and it seems to be written ok. I did not check every last detail but most of the development was done with the DSO connected. I do not remember checking especially the 0x71 reading when protected but I have seen this value in another thread here in the same context. So I am quite sure all is done right.

Best regards,

Alex

at1
Associate II
Posted on March 03, 2014 at 18:23

So, nobody as a clue?

Looks like I have to try to contact our FAE again?

chen
Associate II
Posted on March 06, 2014 at 12:25

Hi Alex

I thought I had given you the reason why the ROP was always set?

I had a look through the SWIM manual (UM0470) and the programming manual for STM8 (PM0051) and could not find any reference to DeviceID. Sorry

at1
Associate II
Posted on March 07, 2014 at 01:00

Hi,

Sorry, but I know the ROP has been set because I have set it. But that was not the question.

I know the device itself can always read the ROP internally and my programmer can read it within the same debug-session but I need to know how to read it with my programmer when a protected device is reconnected to it. Then my programmer has no access to the option bytes at all and only reads 0x71.

The DeviceID is mentioned in PM0047 (STM8 Flash programming) on page 15 where it says ''ICP using the SWIM protocol'' ... ''Step 6:  Verify the DeviceID by reading it using ROTF command'' ...

chen
Associate II
Posted on March 07, 2014 at 12:16

Hi Alex

''but I need to know how to read it with my programmer when a protected device is reconnected to it. Then my programmer has no access to the option bytes at all and only reads 0x71.''

Unfortunately, it looks like that is a problem!

The option bytes are near the Flash and EEPROM address range - so I guess turning on ROP disables read access to the option bytes as well.

The only way to read them back is to disable ROP.

That is the point of Read Out Protection - disable reading the stuff inside the device!

A quick google of ''STM8 DeviceID'' produced some vague reference to the 'Unique ID' on a raisonance forum.

It sounds like the Deivce ID is the Die Number

http://forum.raisonance.com/viewtopic.php?id=3008

FYI

For the SWIM driver I wrote, I did not bother with the device ID because we are manufacturing the boards and know what STM8 is populated.

at1
Associate II
Posted on March 07, 2014 at 19:36

Hi,

I don't want to remove or bypass the read out protection. I would simply like to know ''the recommended rop-checking method''. I do not want my rop-checking algorithm to base just on empirical tests or guesses.

I am quite sure there is this information somewhere and someone from ST should be able to tell...

For the DeviceID or DieID I was also thinking if maybe the UniqueID is meant but for several reasons I think this cannot be the same.

1.: e.g. the STM8S003 does not have a UniqueID but I guess there still is a DeviceID.

2.: UniqueID consists of lot & waver number information but not of a DieID.

3.: in Ride7 file STM8_SWIM_ProductInfo.txt you can find a ''DieCheckAddress'' for several devices and ''DieCheckExpectedValue'' but it looks like this is not available for all devices. For a few devices I checked (e.g. STM8L151) the DieCheckAddress points into reserved memory space and not into the UniqueID.

So finally this all seems confusing to me and I would also like to get information from ST on this topic too. Just like with the ROP - I would like to use information from ST and do not want to base my programming device on empirically tested values or values copied from other programmers like RLink. This information is surely documented at ST.

best regards,

Alex

at1
Associate II
Posted on July 31, 2014 at 21:16

Hi,

Just for completeness:

''At address 0x4FFC we must read 67671000 in hex, check 767 only'' is what I have been told about the Device ID.

For ROP-checking is no universal method known...