PDA

View Full Version : problem with changing a password to ibutton1977



reggie
11-17-2009, 07:01 PM
i am writing and reading to ibutton1977 (from dallas) ..and it is being done ok.
if i try to write the same password again and again to the ibutton it is being done ok..

but when i try to write a diffrent password to the ibutton (from the first password ) i get error..
so i cant change passwords to my ibutton 1977...

what is the reason for that ?
does anybody know ?


now i am stuck with that http://forums.parallax.com/images/smilies/confused.gif

skylight
11-17-2009, 08:30 PM
there are several considerations to be had with the passwords functions, for one have you disabled passwords before trying to change them?

this datasheet may help?

http://www.digchip.com/datasheets/parts/datasheet/280/DS1977-pdf.php

reggie
11-17-2009, 08:44 PM
i am working with this datasheet http://forums.parallax.com/images/smilies/smile.gif

how can i disable the password· after i make one ?

where is it written how to disable a password ?

i cant understand that from the datasheethttp://forums.parallax.com/images/smilies/sad.gif

do you have an idea ?.


thanks.

reggie
11-17-2009, 09:39 PM
if i want to enable i put 0xaa in the password control register...(EPW)

what value do i need to put in the password control register in order to disable ??


thanks

http://forums.parallax.com/images/smilies/roll.gif
·

skylight
11-18-2009, 03:42 AM
Password Control Register
The data pattern stored in the Password Control Register determines whether password checking is enabled. If
password checking is enabled, the password transmitted is compared to the passwords stored in the device.
Reading from or writing to the scratchpad does not require a password.
Password Control Register Bitmap
ADDR b7 b6 b5 b4 b3 b2 b1 b0
7FD0h EPW
Register Details
BIT DESCRIPTION BIT(S) DEFINITION
EPW: Enable Passwords b0 to b7 This byte enables or disables the password protection, which applies
to reading from and writing to the memory except for the scratchpad.
If the EPW bits form a pattern of 10101010 (AAh), the device will
execute these commands only if the correct password is transmitted.
The default pattern of EPW is different from AAh.
To enable password checking, the EPW bits need to form a binary pattern of 10101010 (AAh). If the EPW pattern
is different from AAh, any password will be accepted, as long as it has a length of exactly 64 bits.

So it sounds like if you dont have AAh (10101010) in the address 7FDoh then password checking IS disabled and will accept any 64bit password otherwise when enabled you have to place the correct password

reggie
11-18-2009, 10:04 PM
well,i try to disable the password by puting another value then AAh . i put 0x11h ,and it doesnot work.
where can i find a code for C language which i can see how to disable a password and by that to change password ?
here is my code to make a password :
i can make a password , but if i try again to make another password its fails, like i wrote above..

the code :


int Set1977Password(char *pass)
{
int i,j,CompErrorFlag,ver1,ver2;
char databuf[16],treg,dpass[8],ans,enpatt,str,xpass[16];

CompErrorFlag=0;
enpatt=0xaa;
ans=0;
ver1=ver2=0;

for(i=0;i<8;i++) // copy the 8 byte password
{
xpass=pass;
xpass=pass;
}

for(i=0;i<8;i++) // set dummy password to be the sent password.
dpass=pass;

Write1977Scratch(xpass,16, 0x7fc0); // write the password on the scratch.
Read1977Scratch(treg, databuf, 16 ); // read the password from the scratch back.

for(i=0;i<16;i++) // compare the passwords to what was written.
{
if(databuf != xpass[i])
CompErrorFlag=1;
}

if(CompErrorFlag==1)
return 0 ; // compare failed
if(CompErrorFlag!=1)
{
Copy1977ScratchPass(treg[0], treg, treg, dpass); // copy scratch with dummy password.

StrongPullUp();

ans=OWReadByte3(); // read answer.
// make string
if( ans == 0xaa ) // check if password was saved.
{
OW_Reset3(); // reset line.

ver1=Verify1977Pass(8, 0x7fc0, pass); // verify 1st password.
ver2=Verify1977Pass(8, 0x7fc8, pass); // verify 2nd password.

if( (ver1 == 1) && (ver2 == 1) ) // if both passwords verified ok continue.
{
Write1977Scratch(&enpatt, 1, 0x7fd0 ); // write enable pattern.
Read1977Scratch(treg, databuf, 1 ); // read the password from the scratch back.

ans=0; // zero ans for next copyscratch check.
CompErrorFlag=0; // zero error flag

if(databuf[0] != enpatt)
CompErrorFlag=1;

if(CompErrorFlag==1)
return 0; //compare was failed
if(CompErrorFlag!=1)
{
Copy1977ScratchPass(treg[0], treg, treg, dpass); // copy scratch with dummy password. because password are not yet enabled!
StrongPullUp();

ans=OWReadByte3(); // read answer.
if( ans != 0xaa )
return 0; //answer failed
OW_Reset3();
}
}
else
{
return 0; //verify wrong
}
}
else
{
return 0; //password wasnt saved
}
}
return 1; //sucess
}


using the code :

Set1977Password(password); //works
Set1977Password(password2); //does not work ! so i cant change my password

skylight
11-19-2009, 05:11 AM
The manual states:

The default pattern of EPW is different from AAh.
To enable password checking, the EPW bits need to form a binary pattern of 10101010 (AAh). If the EPW pattern
is different from AAh, any password will be accepted, as long as it has a length of exactly 64 bits.

I can only assume then that there is an error in your programming?

reggie
11-23-2009, 03:11 PM
well ,
i tried to disable the password and it does not work .

i wonder if i can find a code example in "C" of disabling a password on ibutton 1977...

do you have any idea ?

thanks .

avinash.ahg
02-13-2014, 04:03 AM
Hello,
I am facing problem with reading/writing scratchpad for DS1977. Can any one send me the working code for DS1977 writing/reading scratchpad. I am facing problem to interface with pic30f.

Regards
Avinash