PARTS: 1K 1-WIRE EEPROM (DS2431)

0 Comments

The Maxim DS2431 1K EEPROM is 1-Wire gadget that adds storage to a job utilizing a single microcontroller pin. We previously interfaced a 1-wire thermometer, however this EEPROM is somewhat different since it draws power directly from the 1-Wire bus. get the datasheet (PDF) as well as comply with along while we checked out as well as compose this easy 1-Wire memory.

DS2431 1-Wire 1K EEPROM (Digikey #DS2431+-ND, $1.67)

We utilized our Bus Pirate universal serial interface to demonstrate the DS2431 EEPROM, we covered the appropriate connections as well as configuration choices in our previous 1-wire post. The DS2431 needs just two connections: ground (pin 1) as well as 1-Wire/power (pin 2).  Pin 3 stays unconnected. like last time, we utilized a 2K pull-up resistor with the 1-Wire bus.

First, we utilize the Bus Pirate’s browse ROM command to determine linked 1-Wire devices.

1-WIRE>(240) <–SEARCH ROM command macro 1WIRE ROM COMMAND: browse (0xF0) Found gadgets at: Macro     1-WIRE address 1.0x2D 0x54 0xD2 0xEF 0x00 0x00 0x00 0x2B <–address *DS2431 1K EEPROM <– type 2.0x2D 0xFE 0x8D 0x43 0x01 0x00 0x00 0x52 *DS2431 1K EEPROM 3.0x2D 0x2B 0xED 0xEF 0x00 0x00 0x00 0x7C *DS2431 1K EEPROM Found 0x03 devices. The very first 10 gadget IDs are offered by MACRO, see (0). 1-WIRE>

The browse ROM command exposes that there are 3 EEPROMs linked to the 1-Wire bus. The Bus Pirate stores the 64bit 1-wire addresses in macros so we don’t have to type it every time. We’ll work with the very first device, determined by macro (1).

Writing to the DS2431 takes three steps:

Write data to DS2431’s 8byte ‘scratch pad’ EEPROM buffer

Verify the scratch pad contents as well as get the compose gain access to key

Copy data from the scratch pad to the EEPROM for long-term storage.

Command 0x0f composes to the scratch pad. The scratch pad is an 8byte buffer that holds data prior to saving it permanently in the EEPROM.

1-WIRE>(85)(1) 0x0f 0x00 0x00 0 1 2 3 4 5 6 7 <–command 1WIRE BUS RESET OK 1WIRE compose ROM COMMAND: match (0x55) *follow with 64bit address 1WIRE ADDRESS MACRO 1: 0x2D 0x54 0xD2 0xEF 0x00 0x00 0x00 0x2B 1WIRE WRITE: 0x0F <–write to scratch pad 1WIRE WRITE: 0x00 <–begin address byte 1 1WIRE WRITE: 0x00 <–begin address byte 2 1WIRE WRITE: 0x00 <–data 1WIRE WRITE: 0x01 1WIRE WRITE: 0x02 1WIRE WRITE: 0x03 1WIRE WRITE: 0x04 1WIRE WRITE: 0x05 1WIRE WRITE: 0x06 1WIRE WRITE: 0x07 1-WIRE>

The match ROM macro, (85), isolates the the very first device, (1). 0x0f is the command to compose to the scratch pad, complied with by the begin address, 0 0. Finally, we send eight bytes of data to save in the scratch pad. The scratch pad is eight bytes long, as well as all eight bytes will be copied from the scratch pad to the EEPROM at once.

1-WIRE>(85)(1) 0xaa r:3 r:8 r:2 r:2 <–command 1WIRE BUS RESET OK 1WIRE compose ROM COMMAND: match (0x55) *follow with 64bit address 1WIRE ADDRESS MACRO 1: 0x2D 0x54 0xD2 0xEF 0x00 0x00 0x00 0x2B 1WIRE WRITE: 0xAA <–read scratch pad 1WIRE bulk READ, 0x03 BYTES: <–access code 0x00 0x00 0x07 1WIRE bulk READ, 0x08 BYTES:<–verify our data 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 1WIRE bulk READ, 0x02 BYTES:<–inverse CRC 0x44 0x67 1WIRE bulk READ, 0x02 BYTES:<–all 1s from here 0xFF 0xFF 1-WIRE>

To copy data from the scratch pad to the EEPROM, we should very first retrieve a three byte gain access to code from the scratch pad with the command 0xaa.  The very first three bytes are the gain access to code (0x00 0x00 0x07), complied with by the data contained in the scratch pad.

1-WIRE>(85)(1) 0x55 0x00 0x00 0x07
1WIRE BUS RESET OK
1WIRE compose ROM COMMAND: match (0x55) *follow with 64bit address
1WIRE ADDRESS MACRO 1: 0x2D 0x54 0xD2 0xEF 0x00 0x00 0x00 0x2B
1WIRE WRITE: 0x55 <–copy to EEPROM command 1WIRE WRITE: 0x00<–access code (3 bytes) 1WIRE WRITE: 0x00 1WIRE WRITE: 0x07 1-WIRE>!!!! <–read bits 1WIRE checked out BIT: 0 1WIRE checked out BIT: 1 <–bits alternate, done 1WIRE checked out BIT: 0 1WIRE checked out BIT: 1 1-WIRE>

Command 0x55 with the appropriate gain access to code will copy the scratch pad to the data EEPROM. bit reads (!!!!) alternating between 0 as well as 1 when the copy completes.

1-WIRE>(85)(1) 0xf0 0x00 0x00 r:8 r:8
1WIRE BUS RESET OK
1WIRE compose ROM COMMAND: match (0x55) *follow with 64bit address
1WIRE ADDRESS MACRO 1: 0x2D 0x54 0xD2 0xEF 0x00 0x00 0x00 0x2B
1WIRE WRITE: 0xF0 <–read memory 1WIRE WRITE: 0x00 <–start address (2 bytes) 1WIRE WRITE: 0x00 1WIRE bulk READ, 0x08 BYTES: <–read back data 0x00 0x01 0x02 0x03 0x04 0x05 0x06 0x07 1WIRE bulk READ, 0x08 BYTES: <–read beyond our data 0x00 0x00 0x00 0x00 0x00 0x00 0x00 0x00 1-WIRE>

Command 0xf0 complied with by a two byte memory address (0x00 0x00) begins the data checked out process. The very first eight bytes (r:8) are the values we composed earlier. Reads don’t include the scratch pad as well as don’t have an 8byte limit, so even more reads continue to the end of the memory.

Don’t fail to remember to catch up on any type of parts messages you may have missed.

Leave a Reply

Your email address will not be published. Required fields are marked *