Flash Magic Forum

Archive => Old Topics => Topic started by: lambros sirivlis on June 29, 2004, 08:41:08 AM

Title: p89v51rd2 security
Post by: lambros sirivlis on June 29, 2004, 08:41:08 AM
hello,
I am little confused with P89V51RD2.
if I program (with flash magic) security bit I can't erase or program again the memory flash (via ISP).
The question is:
If I program serial number and leave the security bit
unprogrammed (to update program in the future),code can be recovered via parallel programmer?

You can erase anything but not
security bit (if it is set)via isp.
And if security bit is set then you have no more access to flash if you want to update your program.
So if you want to work with ISP you must leave security bit unset and your code open to a paraller programmer.
It looks strange.


(sory for my bad english)
Thanks
Lambros
Title: Re: p89v51rd2 security
Post by: Andy Ayre on June 29, 2004, 02:40:31 PM
If you have only set the security bit then you can erase block 0.

If you have set a serial number then you cannot erase block 0. Instead you must either verify the serial number to unlock the device, or reset the serial number, which will erase block 0 and the current serial number.

That is my understanding of how it works.

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on June 30, 2004, 12:31:55 AM
Hello  Andy.
I've tried this but it doesn't work.
I found in datasheet  the support  e-mail of phillips
and send them the same question.
The answer (they answer extremely fast) was:
"Philips Semiconductors answer:
Your assumtions are correct. I think you can get around the security bit for re-programming if you do your own bootloader using the IAP calls. Otherwise, ISP is not possible with the security bit set."

If does not exist some special reason (in hardware)
that it prohibits us to unset the security bit via ISP
 then ...it is strange.

Regards
Lambros Sirivlis
Title: Re: p89v51rd2 security
Post by: Andy Ayre on June 30, 2004, 08:09:49 AM
Can you please Email me the name of the Philips person who gave you that advice? Or better still forward me that Email? It will help me find out what is going on with this from Philips. Thanks!

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on June 30, 2004, 08:37:10 AM
hello andy
#######################
*** Please do not reply to this message ***

If you have a follow up to this question or want to view the status of your question(s) please go to :
http://www.semiconductors.philips.com/cgi-bin/support/support.pl?command=status&QuestionID=4499&User=sirivlis@otenet.gr

========================================
|| Answer to Question 4499 from Philips Semiconductors
|| 06/29/04 (18:00:15)
||
|| http://www.semiconductors.philips.com/support/
========================================
lambros sirivlis
On above date you submitted question with ID 4499
---------------------------------------------------------------------------
Question:
hello,

I am little confused with P89V51RD2.

if I program (with flash magic) security bit I can't erase or program again the memory flash (via ISP).

The question is:

If I program serial number and leave the security bit

unprogrammed (to update program in the future),code can be recovered via parallel programmer?



You can erase anything but not

security bit (if it is set)via isp.

And if security bit is set then you have no more access to flash if you want to update your program.

So if you want to work with ISP you must leave security bit unset and your code open to a paraller programmer.

It looks strange.





(sory for my bad english)

Thank you

Lambros sirivlis
---------------------------------------------------------------------------
Philips Semiconductors answer:
Your assumtions are correct. I think you can get around the security bit for re-programming if you do your own bootloader using the IAP calls. Otherwise, ISP is not possible with the security bit set.

Jim E.

---------------------------------------------------------------------------
This e-mail is sent to you from the website of Philips Semiconductors
Please do not reply to this message.
###########################

thank you for help.

regards
lambros sirivlis.
Title: Re: p89v51rd2 security
Post by: Andy Ayre on June 30, 2004, 10:13:57 AM
I'm currently trying to get some more devices so I can test it myself. Will let you know.

Title: Re: p89v51rd2 security
Post by: erikm on June 30, 2004, 10:25:37 AM
cross posted (since this thread is) at www.8052

the support e-mail of phillips and send them the same question
I do not think Philips support is fluent in FlashMagic

From the datasheet
"If the serial number is in use, reading, programming, or erasing of the user code memory or the serial number is blocked until the user transmits a
Title: Re: p89v51rd2 security
Post by: Andy Ayre on June 30, 2004, 10:34:44 AM
Yes, you can verify a serial number using Flash Magic. Select the device then choose "Serial Number..." from the ISP menu. Enter the serial number into the "Unlock device" section.

Title: Re: p89v51rd2 security
Post by: erikm on July 01, 2004, 04:58:35 AM
>>Enter the serial number into the "Unlock device" section<<

This is, indeed a 'cute' feature, but I, for one, would not dare to use it without a label on the chip with the serial number.

without the label:
A techie replaces a (good) chip and does not record it - two chips lost.
You forget the serial number - one chip lost.

In all cases:
you mistype the serial number - one chip lost.

I can see this being used in big time production, but for amateurs and small manual scale mfg it is a trap.

Erik
Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 01, 2004, 10:58:03 AM
You can always use the Reset serial number option to clear the serial number. This also erases the device as well. So there is a way to recover the device if you forget the serial number.

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 02, 2004, 06:34:13 AM
If i set the security bit AND the serial number, i block isp AND paraller programing or reading.
But in this case the chip is no more accesible via ISP (even if i try to RESET serial number).

The chip accepts the "RESET" option(and erases the devise and serial number) but you can't programing it via ISP.
And in this case you can't reset security bit via isp.
So you lose isp functionality.
Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 02, 2004, 08:59:42 AM
If you have no ISP functionality, how do you know the serial number and device were erased?

Giving step by step reproduction steps would be useful so I can try them here when I get some devices.

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 02, 2004, 12:01:27 PM
sorry Andy, you are right.
I don't know, i "suppose".
I select  "reset serial number"  and  i don't get any
fail message .
-----------------------------------------------------------
1)   i select :

verify after programming,
fill unused flash,
and  6 clocks/cycle.
when ends i get the message:
operation failed.(programming security bit).
----
but the chip is ok and works fine.

2) i select  "set serial number"
after "reset device in isp mode now"
no message.

The chip is ok and works fine.
now i have no access via isp.

3) i select  "reset serial number"
after "reset device in isp mode now"
no message.
The chip is ok and isp works again.
I can reprogram the chip.
4)   i select :

verify after programming,
fill unused flash,
set security bit 1,
and  6 clocks/cycle.

first message"you have selected at least one security bit which once programmed it cannot be erased via isp,a paraller programmer is required.do you want to program security bit?"
i select yes.
second  message"you have selected to program clocks bit which once programmed it cannot be erased via isp,a paraller programmer is required.do you want to program clocks bit?"
i select yes.

when ends i get the message:
operation failed.(programming clock bit).
propably because clock bit is already programmed.
----
The chip is ok and my program runs fine.

5) I open again magic flash .
after "reset device in isp mode now"
chip goes to isp mode.
Now i can read device signature(BF,91), read security bits(security bit 1 is set) but when i press "start" i get the message  Programming is disabled due to security bit 1 being set.

6) i select  "reset serial number"
after "reset device in isp mode now"
no message.

7) I open again magic flash .
after "reset device in isp mode now"
chip goes to isp mode.
Now i can read device signature(BF,91), read security bits(security bit 1 is set) but when i press "start" i get the message  Programming is disabled due to security bit 1 being set.

chip label:
P89V51RD2BN
CM5155.02
kz0413  AC


regards
Lambros sirivlis
Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 02, 2004, 12:25:02 PM
after  6th step, my program does not run.
 i suppose block 0  of flash  erased.
Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 06, 2004, 01:19:37 PM
Ah ha. Now this makes sense. The device IS entering ISP mode, but Flash Magic is stopped you from programming the device.

I'll look into it.

Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 07, 2004, 10:18:40 AM
Version 2.01 is now available that allows you to program the device even though security bit 1 is set. Thanks for pointing this out!

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 07, 2004, 12:38:54 PM
Thank you Andy.
it sounds great!!!
many thanks to you and to Eric for help.
Regards
Lambros
Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 08, 2004, 01:16:57 AM
hi andy.
2.01 works fine.

A small observation:

IF  clock bit was previously set and security bit unset

and you select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and 6 clocks/cycle
then  flash magic does not  set security bit.

You have to select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and "uncheck" 6 clocks/cycle.
Then  flash magic   sets security bit.

Can flash magic "first read" and then write  if a bit is not set?

Regards
Lambros Sirivlis
Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 08, 2004, 09:25:44 AM
I tried this and I cannot reproduce it. When you choose "Read Security Bits..." from the ISP menu, does it show security bit 1 as being set?

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 08, 2004, 10:06:20 AM
1) select in step 4 of flash magic
verify after programming,
fill unused flash,
6 clocks/cycle
After reset magic flash shows correctly that
security bit is unset and clock bit set(6 cycles)

2) select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and 6 clocks/cycle
then flash magic does not set security bit.
(security bit is "unset")

3) select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and "uncheck" 6 clocks/cycle.
Then flash magic sets security bit.
Now security bit is set and clock bit is set.


Andy i'm not very shure about this cause i done this 3 steps only
one time with a single chip.
I'll try it again tomorrow.



regards
Lambros Sirivlis
Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 09, 2004, 02:25:40 AM
1) select in step 4 of flash magic
verify after programming,
fill unused flash,
6 clocks/cycle
After reset magic flash shows correctly that
 clock bit set (6 cycles)
security bit 1 is "unset" (correct)
my program runs ok

2) select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and 6 clocks/cycle
Message: Operation failed(programming security bit )

I read :
 clock bit set (6 cycles)
security bit 1 is "unset"  (wrong)
my program runs ok


3) select in step 4 of flash magic
verify after programming,
fill unused flash,
set security bit 1,
and "uncheck" 6 clocks/cycle.

I read :
 clock bit set (6 cycles)
security bit 1 is set  (correct)
my program runs ok

Maybe  flash magic (in my 2nd step) quits because has to set
an already programmed bit (clock bit)
Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 09, 2004, 03:10:12 AM
Andy,
if i'm not asking too much
can you add an  option to serial number window?

A box to check that says:
"Always use the same serial number".
And if you check this box flash magic after programming
automatically sets this serial number.
Serial number works like password so you can use the same
number  always.
(it's easier to remember it  if you want to unlock the device later)

Regards
Lambros Sirivlis
Title: Re: p89v51rd2 security
Post by: Andy Ayre on July 09, 2004, 09:38:36 AM
It appears the device is switching baud rate, so I've sent the problem to Philips for analysis.

I'll add your suggestion to our to do list. Thanks.

Title: Re: p89v51rd2 security
Post by: lambros sirivlis on July 10, 2004, 02:24:25 AM
thank you Andy.