Main Menu

89V51Security Bit.

Started by Harshadbhai Ukani, August 30, 2004, 08:56:05 PM

Previous topic - Next topic

Harshadbhai Ukani

Dear Annibal,
Sorry as I was out and busy in other matter, have not opened my mail, you can erase a sector by


    mov    20H,#00         ;
    setb    008h              ;

    mov    0B1H,#00
    mov    r1,#8
    mov    dptr,#Sector Address(to be erased)
    call     1ff0h
   
    mov    0b1h,#01h
   
Your programme must be executing above 2000h, while executing above code.

It is recommnaded that you after finishing you IAP call you better start a fresh, as IAP uses some registers form 30H to 35H and 80H.

-Harshadbhai.

Annibal Abreu

Harshadbhai.

Just one more question:

Why these two lines are necessary ?

    mov    20H,#00
    setb    008h

Harshadbhai Ukani



As such for this particular call these lines are not required but for other calls this is required., (Write serial no, Erase Serial no. etc,  For which you have to modify upper 1K block as well.)  


You may ignore for your application.

-Harshadbhai

erikm

I do not recall, but somewhere there is something about erasing the serial no also erases the bootloader.

Erik

Annibal Abreu

What about Software RESET

The manual says:

7.10.2 - The software reset is executed by changing FCF[1](SWF) from '0' to  '1'.

Question:

Is this FCF[1] the same BSEL bit to enter IAP mode ?

So, if I get out from IAP mode, it will cause a software reset ???


Annibal Abreu

Hi.

I had receive information from Philips.

There are two differents BITS. The datasheet don't say it !

SWR = software reset bit => FCF.1 (bit 1)

BSEL = bank select bit => FCF.0 (bit 0)

After REST, the SWR bit will be set. So, in order to use IAP routines, you must clear this bit.


Memory Map;

SWR=0 and BSEL =0
   ==> 0000H - 1FFFH (block 1) and above 1FFFh (block 0)
SWR=0 and BSEL =1
   ==> 0000H - FFFFH all block 0

Other combinations for SWR and BSEL , Philips didn't tell anything.

Harshadbhai Ukani


Dear Annbal

I have not tried to read a byte.
Have you enabled boot block before calling the routine.
(Mov 0B1h,#00)
After reading a byte you have to return to block 0 by setting bsl bit
(Mov    0B1h,#01h
 Your programm should be executing at the address higher then 2000h

There is no third possibility for SWR and BSEL.  If you SET SWR micro does a soft start and clears the  SWR bit. So SWR will always be '0' for normal operation.

-Harshadbhai

Dear Erik,

Erasing of serial no. does not erase Boot loader, It does erase block 0.

-Harshadbhai

Annibal

Hi.

I had made a mistake.

Now I can erase Flash sectors, I can program and read bytes.

Furthermore I need to set Serial Number by IAP, in other to protect my code from copy.

I need to do using IAP.  Isp function don't serve to my application !

Does any body Knows how ?