Shop OBEX P1 Docs P2 Docs Learn Events
1-Wire issues dealing with DS1991 — Parallax Forums

1-Wire issues dealing with DS1991

ArchiverArchiver Posts: 46,084
edited 2003-06-02 23:43 in General Discussion
Hey,
I have no problem reading the ID's of any 1-wire device, but how
ever, I'm having a problem using the DS1991 MultiKey iButton. I
can't seem to read/write/copy the scratch pad, nor read/write data
block keys properly. I have downloaded the charts for most of the
iButtons, I have the commands, grate, what do I do from there? How
can I make a program to read this 1-wire device (DS1991) using a
Basic Stamp 2P40?

Also this is a minor question but, why does the BS2P40 have a pin
arrangement of MAINIO 0-15, AUXIO 0-15, and not just pin 0-30? I
would be alot easier to control then to always be swaping back and
forth like that. =\

Matt

Comments

  • ArchiverArchiver Posts: 46,084
    edited 2003-05-23 08:08
    Hello,




    The DS1991 is a secure device. Have you set the passwords for the
    subkeys?




    From the data sheet I also see that it has a command structure that is
    a little different than non-secure 1-wire devices. The commands
    require 3 bytes to initiate: the first byte is the command, the second
    byte is specific information for the command, the third byte is a ones
    complement of the second byte (command integrity check). Are you
    sending the DS1991 specific 3-byte commands or using the standard 1-2
    byte commands that other 1-wire devices use?




    Get the DS1991 data sheet. It seems the DS1991 does things a little
    different than other simple 1-wire devices (like thermometers, digital
    pots, switches, etc).




    Chuck Chargin Jr.




    --- In basicstamps@yahoogroups.com, "Matt" <defiletech@y...> wrote:


    > Hey,


    > I have no problem reading the ID's of any 1-wire device, but how


    > ever, I'm having a problem using the DS1991 MultiKey iButton. I


    > can't seem to read/write/copy the scratch pad, nor read/write data


    > block keys properly. I have downloaded the charts for most of the


    > iButtons, I have the commands, grate, what do I do from there? How


    > can I make a program to read this 1-wire device (DS1991) using a


    > Basic Stamp 2P40?


    >


    > Also this is a minor question but, why does the BS2P40 have a pin


    > arrangement of MAINIO 0-15, AUXIO 0-15, and not just pin 0-30? I


    > would be alot easier to control then to always be swaping back and


    > forth like that. =\


    >


    > Matt
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-25 23:13
    Here's the thing, I don't know how to do that, nor anything (besides
    reading the ID's) with the DS1991

    --- In basicstamps@yahoogroups.com, "cchargin" <cchargin@e...> wrote:
    > Hello,
    >
    >
    >
    >
    > The DS1991 is a secure device. Have you set the passwords for the
    > subkeys?
    >
    >
    >
    >
    > From the data sheet I also see that it has a command structure
    that is
    > a little different than non-secure 1-wire devices. The commands
    > require 3 bytes to initiate: the first byte is the command, the
    second
    > byte is specific information for the command, the third byte is a
    ones
    > complement of the second byte (command integrity check). Are you
    > sending the DS1991 specific 3-byte commands or using the standard
    1-2
    > byte commands that other 1-wire devices use?
    >
    >
    >
    >
    > Get the DS1991 data sheet. It seems the DS1991 does things a
    little
    > different than other simple 1-wire devices (like thermometers,
    digital
    > pots, switches, etc).
    >
    >
    >
    >
    > Chuck Chargin Jr.
    >
    >
    >
    >
    > --- In basicstamps@yahoogroups.com, "Matt" <defiletech@y...> wrote:
    >
    >
    > > Hey,
    >
    >
    > > I have no problem reading the ID's of any 1-wire device, but how
    >
    >
    > > ever, I'm having a problem using the DS1991 MultiKey iButton. I
    >
    >
    > > can't seem to read/write/copy the scratch pad, nor read/write
    data
    >
    >
    > > block keys properly. I have downloaded the charts for most of
    the
    >
    >
    > > iButtons, I have the commands, grate, what do I do from there?
    How
    >
    >
    > > can I make a program to read this 1-wire device (DS1991) using a
    >
    >
    > > Basic Stamp 2P40?
    >
    >
    > >
    >
    >
    > > Also this is a minor question but, why does the BS2P40 have a
    pin
    >
    >
    > > arrangement of MAINIO 0-15, AUXIO 0-15, and not just pin 0-30? I
    >
    >
    > > would be alot easier to control then to always be swaping back
    and
    >
    >
    > > forth like that. =\
    >
    >
    > >
    >
    >
    > > Matt
  • ArchiverArchiver Posts: 46,084
    edited 2003-05-26 06:59
    Hi,

    Nab the DS1991 data sheet:

    http://pdfserv.maxim-ic.com/arpdf/DS1991.pdf

    I have not used the DS1991, but I am familiar with other 1-wire devices
    (DS18B20 thermometer, DS2409 microlan switch, etc...). Check out the data
    sheet and look at the command flow charts. You will notice that they are a
    little different than other non-secure 1-wire devices.

    If you are just learning 1-wire stuff on the stamp I would suggest starting
    out with the digital switches and thermometers first. They are easy to
    work with while you learn the 1-wire protocols.

    I put together the steps below just from looking at the data sheet. I do
    not have a DS1991 to try it out with. I must say that compared to other
    1-wire devices this DS1991 makes you jump through a lot of hoops to get
    simple operations done! But I guess that is the price for security.

    From the data sheet it seems that to write data to a the scratch pad, then
    copy it to a subkey you would do the following:

    Please remember that I couldn't actually verify that this will work since I
    don't have a DS1991.

    First you have to set a password for the subkey:

    ' i am not going for efficiency here, I want to show a variety of ways to
    send data.
    romdata VAR byte(8) 'put your DS1991 ROM ID in here
    key0 VAR byte
    ... (key1 to key6 also dimensioned as bytes)
    key7 VAR byte

    'reset the bus, send match rom command, then the ROM (romdata is an array
    of 8 bytes)
    owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]

    'dont reset bus, and send the 3-byte command (write password, subkey %10,
    third byte is 1s complement) the subkey is padded at the end with 6 zeros
    owout 15, 0, [noparse][[/noparse]$5A, %10000000, %01111111]

    'dont reset the bus, read in the 8 subkey ID bytes
    owin 15, 0, [noparse][[/noparse]Key0, Key1, Key2, Key3, Key4, Key5, Key6, Key7]

    'This "read/write back" step is so you look at Key0 to Key7 and verify that
    this is the key you want

    'dont reset the bus, write the subkey ID bytes back to the DS1991
    'this step will erase ALL data in the target subkey!
    owout 15, 0, [noparse][[/noparse]Key0, Key1, Key2, Key3, Key4, Key5, Key6, Key7]

    'dont reset bus, send new identifier for subkey
    owout 15, 0, [noparse][[/noparse]"MyNewID!"]

    'Send the new password (as a sysadmin I have to say that you should NEVER
    actually use this password [noparse]:)[/noparse] ), then rest the bus
    owout 15, 2, [noparse][[/noparse]"Password"]

    Okay now we will write data to the subkey (this is a long way to do it):

    'first we will write the data to the scratch pad
    'reset the bus, send match rom command, then the ROM (romdata is an array
    of 8 bytes)
    owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]

    'dont reset bus, and send the 3-byte command (write scratchpad, address,
    third byte is 1s complement of the address). Our address will be %00101010
    = $2A (42 of course!), but we have to pad the 2 most significant bits with
    1. So our address becomes %11101010 = $EA. The 1s complement is %00010101
    = $15
    owout 15, 0, [noparse][[/noparse]$96, $EA, $15]

    'send the data then rest the bus
    owout 15, 2, [noparse][[/noparse]"Data!"]

    'now we copy the scratch pad to the subkey
    'reset the bus, send match rom command, then the ROM (romdata is an array
    of 8 bytes)
    owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]

    'dont reset bus, and send the 3-byte command (copy scratch pad, subkey
    %10, third byte is 1s complement) the subkey is padded at the end with 6 zeros
    owout 15, 0, [noparse][[/noparse]$3C, %10000000, %01111111]

    'now we have to tell the DS1991 which block to copy. the block selector
    code scheme is odd. You can only write in 8 byte or 64 byte blocks. Each
    block has a weird 8 byte identifier. This identifier is for the range $28
    to $2F
    owout 15, 0, [noparse][[/noparse]$65, $9A, $4C, $9D, $64, $91, $69, $B3]

    'now send the (really weak) password, then reset the bus
    owout 15, 2, [noparse][[/noparse]"Password"]

    Chuck Chargin Jr.

    At 10:13 PM 5/25/2003 +0000, you wrote:
    >Here's the thing, I don't know how to do that, nor anything (besides
    >reading the ID's) with the DS1991
    >
    >--- In basicstamps@yahoogroups.com, "cchargin" <cchargin@e...> wrote:
    > > Hello,
    > >
    > >
    > >
    > >
    > > The DS1991 is a secure device. Have you set the passwords for the
    > > subkeys?
    > >
    > >
    > >
    > >
    > > From the data sheet I also see that it has a command structure
    >that is
    > > a little different than non-secure 1-wire devices. The commands
    > > require 3 bytes to initiate: the first byte is the command, the
    >second
    > > byte is specific information for the command, the third byte is a
    >ones
    > > complement of the second byte (command integrity check). Are you
    > > sending the DS1991 specific 3-byte commands or using the standard
    >1-2
    > > byte commands that other 1-wire devices use?
    > >
    > >
    > >
    > >
    > > Get the DS1991 data sheet. It seems the DS1991 does things a
    >little
    > > different than other simple 1-wire devices (like thermometers,
    >digital
    > > pots, switches, etc).
    > >
    > >
    > >
    > >
    > > Chuck Chargin Jr.
    > >
    > >
    > >
    > >
    > > --- In basicstamps@yahoogroups.com, "Matt" <defiletech@y...> wrote:
    > >
    > >
    > > > Hey,
    > >
    > >
    > > > I have no problem reading the ID's of any 1-wire device, but how
    > >
    > >
    > > > ever, I'm having a problem using the DS1991 MultiKey iButton. I
    > >
    > >
    > > > can't seem to read/write/copy the scratch pad, nor read/write
    >data
    > >
    > >
    > > > block keys properly. I have downloaded the charts for most of
    >the
    > >
    > >
    > > > iButtons, I have the commands, grate, what do I do from there?
    >How
    > >
    > >
    > > > can I make a program to read this 1-wire device (DS1991) using a
    > >
    > >
    > > > Basic Stamp 2P40?
    > >
    > >
    > > >
    > >
    > >
    > > > Also this is a minor question but, why does the BS2P40 have a
    >pin
    > >
    > >
    > > > arrangement of MAINIO 0-15, AUXIO 0-15, and not just pin 0-30? I
    > >
    > >
    > > > would be alot easier to control then to always be swaping back
    >and
    > >
    > >
    > > > forth like that. =\
    > >
    > >
    > > >
    > >
    > >
    > > > Matt
    >
    >
    >To UNSUBSCRIBE, just send mail to:
    > basicstamps-unsubscribe@yahoogroups.com
    >from the same email address that you subscribed. Text in the Subject and
    >Body of the message will be ignored.
    >
    >
    >Your use of Yahoo! Groups is subject to http://docs.yahoo.com/info/terms/
  • ArchiverArchiver Posts: 46,084
    edited 2003-06-02 23:43
    Thanks for giving me this infomation, and I have tried your program
    with my basic stamp, unfortunatly it does not work properly. I
    cannot seem to read the secure data after the unsecure data gets
    coppied over from the scratch pad. Either I'm not reading it
    properly, or I'm not writting properly (or both), but I cannot read
    the same data I enter in to the DS1991. I don't know why this
    ibutton is giving me so much trouble. Also, yes I have worked with
    many different 1-wire devices in the past such as 1-wire transister
    switchs, tempature sensors, digital pot's, etc. Yet still I have
    trouble with this one. =(

    --- In basicstamps@yahoogroups.com, "Chuck Chargin Jr."
    <cchargin@e...> wrote:
    > Hi,
    >
    > Nab the DS1991 data sheet:
    >
    > http://pdfserv.maxim-ic.com/arpdf/DS1991.pdf
    >
    > I have not used the DS1991, but I am familiar with other 1-wire
    devices
    > (DS18B20 thermometer, DS2409 microlan switch, etc...). Check out
    the data
    > sheet and look at the command flow charts. You will notice that
    they are a
    > little different than other non-secure 1-wire devices.
    >
    > If you are just learning 1-wire stuff on the stamp I would suggest
    starting
    > out with the digital switches and thermometers first. They are
    easy to
    > work with while you learn the 1-wire protocols.
    >
    > I put together the steps below just from looking at the data
    sheet. I do
    > not have a DS1991 to try it out with. I must say that compared to
    other
    > 1-wire devices this DS1991 makes you jump through a lot of hoops
    to get
    > simple operations done! But I guess that is the price for
    security.
    >
    > From the data sheet it seems that to write data to a the scratch
    pad, then
    > copy it to a subkey you would do the following:
    >
    > Please remember that I couldn't actually verify that this will
    work since I
    > don't have a DS1991.
    >
    > First you have to set a password for the subkey:
    >
    > ' i am not going for efficiency here, I want to show a variety of
    ways to
    > send data.
    > romdata VAR byte(8) 'put your DS1991 ROM ID in here
    > key0 VAR byte
    > ... (key1 to key6 also dimensioned as
    bytes)
    > key7 VAR byte
    >
    > 'reset the bus, send match rom command, then the ROM (romdata is
    an array
    > of 8 bytes)
    > owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]
    >
    > 'dont reset bus, and send the 3-byte command (write password,
    subkey %10,
    > third byte is 1s complement) the subkey is padded at the end with
    6 zeros
    > owout 15, 0, [noparse][[/noparse]$5A, %10000000, %01111111]
    >
    > 'dont reset the bus, read in the 8 subkey ID bytes
    > owin 15, 0, [noparse][[/noparse]Key0, Key1, Key2, Key3, Key4, Key5, Key6, Key7]
    >
    > 'This "read/write back" step is so you look at Key0 to Key7 and
    verify that
    > this is the key you want
    >
    > 'dont reset the bus, write the subkey ID bytes back to the DS1991
    > 'this step will erase ALL data in the target subkey!
    > owout 15, 0, [noparse][[/noparse]Key0, Key1, Key2, Key3, Key4, Key5, Key6, Key7]
    >
    > 'dont reset bus, send new identifier for subkey
    > owout 15, 0, [noparse][[/noparse]"MyNewID!"]
    >
    > 'Send the new password (as a sysadmin I have to say that you
    should NEVER
    > actually use this password [noparse]:)[/noparse] ), then rest the bus
    > owout 15, 2, [noparse][[/noparse]"Password"]
    >
    > Okay now we will write data to the subkey (this is a long way to
    do it):
    >
    > 'first we will write the data to the scratch pad
    > 'reset the bus, send match rom command, then the ROM (romdata is
    an array
    > of 8 bytes)
    > owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]
    >
    > 'dont reset bus, and send the 3-byte command (write scratchpad,
    address,
    > third byte is 1s complement of the address). Our address will be %
    00101010
    > = $2A (42 of course!), but we have to pad the 2 most significant
    bits with
    > 1. So our address becomes %11101010 = $EA. The 1s complement is %
    00010101
    > = $15
    > owout 15, 0, [noparse][[/noparse]$96, $EA, $15]
    >
    > 'send the data then rest the bus
    > owout 15, 2, [noparse][[/noparse]"Data!"]
    >
    > 'now we copy the scratch pad to the subkey
    > 'reset the bus, send match rom command, then the ROM (romdata is
    an array
    > of 8 bytes)
    > owout 15, 1, [noparse][[/noparse]$55, STR romdata\8]
    >
    > 'dont reset bus, and send the 3-byte command (copy scratch pad,
    subkey
    > %10, third byte is 1s complement) the subkey is padded at the end
    with 6 zeros
    > owout 15, 0, [noparse][[/noparse]$3C, %10000000, %01111111]
    >
    > 'now we have to tell the DS1991 which block to copy. the block
    selector
    > code scheme is odd. You can only write in 8 byte or 64 byte
    blocks. Each
    > block has a weird 8 byte identifier. This identifier is for the
    range $28
    > to $2F
    > owout 15, 0, [noparse][[/noparse]$65, $9A, $4C, $9D, $64, $91, $69, $B3]
    >
    > 'now send the (really weak) password, then reset the bus
    > owout 15, 2, [noparse][[/noparse]"Password"]
    >
    > Chuck Chargin Jr.
    >
    > At 10:13 PM 5/25/2003 +0000, you wrote:
    > >Here's the thing, I don't know how to do that, nor anything
    (besides
    > >reading the ID's) with the DS1991
    > >
    > >--- In basicstamps@yahoogroups.com, "cchargin" <cchargin@e...>
    wrote:
    > > > Hello,
    > > >
    > > >
    > > >
    > > >
    > > > The DS1991 is a secure device. Have you set the passwords for
    the
    > > > subkeys?
    > > >
    > > >
    > > >
    > > >
    > > > From the data sheet I also see that it has a command structure
    > >that is
    > > > a little different than non-secure 1-wire devices. The
    commands
    > > > require 3 bytes to initiate: the first byte is the command, the
    > >second
    > > > byte is specific information for the command, the third byte
    is a
    > >ones
    > > > complement of the second byte (command integrity check). Are
    you
    > > > sending the DS1991 specific 3-byte commands or using the
    standard
    > >1-2
    > > > byte commands that other 1-wire devices use?
    > > >
    > > >
    > > >
    > > >
    > > > Get the DS1991 data sheet. It seems the DS1991 does things a
    > >little
    > > > different than other simple 1-wire devices (like thermometers,
    > >digital
    > > > pots, switches, etc).
    > > >
    > > >
    > > >
    > > >
    > > > Chuck Chargin Jr.
    > > >
    > > >
    > > >
    > > >
    > > > --- In basicstamps@yahoogroups.com, "Matt" <defiletech@y...>
    wrote:
    > > >
    > > >
    > > > > Hey,
    > > >
    > > >
    > > > > I have no problem reading the ID's of any 1-wire device, but
    how
    > > >
    > > >
    > > > > ever, I'm having a problem using the DS1991 MultiKey
    iButton. I
    > > >
    > > >
    > > > > can't seem to read/write/copy the scratch pad, nor read/write
    > >data
    > > >
    > > >
    > > > > block keys properly. I have downloaded the charts for most of
    > >the
    > > >
    > > >
    > > > > iButtons, I have the commands, grate, what do I do from
    there?
    > >How
    > > >
    > > >
    > > > > can I make a program to read this 1-wire device (DS1991)
    using a
    > > >
    > > >
    > > > > Basic Stamp 2P40?
    > > >
    > > >
    > > > >
    > > >
    > > >
    > > > > Also this is a minor question but, why does the BS2P40 have a
    > >pin
    > > >
    > > >
    > > > > arrangement of MAINIO 0-15, AUXIO 0-15, and not just pin 0-
    30? I
    > > >
    > > >
    > > > > would be alot easier to control then to always be swaping
    back
    > >and
    > > >
    > > >
    > > > > forth like that. =\
    > > >
    > > >
    > > > >
    > > >
    > > >
    > > > > Matt
    > >
    > >
    > >To UNSUBSCRIBE, just send mail to:
    > > basicstamps-unsubscribe@yahoogroups.com
    > >from the same email address that you subscribed. Text in the
    Subject and
    > >Body of the message will be ignored.
    > >
    > >
    > >Your use of Yahoo! Groups is subject to
    http://docs.yahoo.com/info/terms/
Sign In or Register to comment.