DS2434 1-wire battery chip programming (reset counter, read/write eeprom)

Interesting examples and tutorials about REVELPROG-IS features and device programming
ArT
Posts: 1497
Joined: Wed Mar 25, 2015 8:54 am
Location: Warsaw, Poland
Has thanked: 51 times
Been thanked: 160 times

DS2434 1-wire battery chip programming (reset counter, read/write eeprom)

Postby ArT » Tue Jun 22, 2021 1:19 pm

REVELPROG-IS since v1.8.5 is supporting DS2434 Battery Identification Chip. It's older version of DS2436 Battery ID/Monitor Chip which is already supported - there are only small differences (please check programming procedures for DS2436 here viewtopic.php?f=32&t=436). Both battery chips are using 1-Wire interface and has 160 bytes of memory divided to 5 pages. I'll be using custom scripts for custom script tool in REVELPROG-IS.

DS2434 is 1-wire device with 16-bit unique ID, 2-byte battery cycle counter, A/D converter for battery temperature monitoring and 32 bytes eeprom for user data (total memory area is 160 bytes divided to 5 pages, but not all bytes are used).

Connection requires 3 wires:
- ground (pin 4 in programmer),
- data line (pin 5 in programmer),
- vdd (pin 8 in programmer)

This is how I connected it with REVELPROG-IS socket but you can also try to programm it in external circuit.
DS2434_programming_connection.jpg
DS2434_programming_connection.jpg (306.31 KiB) Viewed 3005 times


Below are ready to use scripts for REVELPROG-IS.
You can read more about Custom Scripts Programming here: viewtopic.php?f=22&t=280

DS2434 Read EEPROM (5 pages, 32 bytes per page = 160 bytes total*)

Code: Select all

// DS2434 READ (5 pages, each 32 bytes = 160 bytes total)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// PAGE 1 read (24 EEPROM bytes + 8 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:71; // COPY NV1 to SP1
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 00; // READ SCRATCHPAD + SP1 ADDR

// PAGE 2 read (8 EEPROM bytes + 24 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:77; // COPY NV2 to SP2
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 20; // READ SCRATCHPAD + SP2 ADDR

// PAGE 3 read (32 SRAM bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:7A; // COPY SRAM to SP3
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 40; // READ SCRATCHPAD + ADDR

// PAGE 4 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:B2, 60; // READ REGISTERS + REG. START. ADDR

// PAGE 5 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:B2, 80; // READ REGISTERS + REG. START. ADDR

*please check datasheet which bytes are valid and which can be changed because not all bytes in memory area are used and some of them are read only

DS2434 Read 16-bit unique ID

Code: Select all

//DS2434 Read ID Register (16-bit)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Read ID Register
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 80; // READ REGISTERS + REG. START. ADDR



DS2434 Write EEPROM (3 pages: 24 bytes (SP1 = EEPROM) + 8 bytes (SP2 = EEPROM) + 32 bytes (SP3 = SRAM))
- data from buffer (since v1.8.5 only)

Code: Select all

//DS2434 WRITE EEPROM (using current data in buffer)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Unlock NV1
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:44; // Unlock NV1

// PAGE1 Write EEPROM (24 bytes)
#OPERATION;
SW:1,23,0,0,0,0,0,0,0,500;
INSTR:17, 00; // WRITE SCRATCHPAD + SP1 address
DATA: BUFFER, 0;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:22; // Copy SP1 to NV1

// PAGE2 Write EEPROM (8 bytes)
#OPERATION;
SW:1,7,0,0,0,0,0,0,0,500;
INSTR:17, 20; // WRITE SCRATCHPAD + SP2 address
DATA: BUFFER, 20;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:25; // Copy SP2 to NV2

// PAGE3 Write RAM & SRAM (32 bytes)
// please note: it will be lost when battery disconnected
#OPERATION;
SW:1,31,0,0,0,0,0,0,0,500;
INSTR:17, 40; // WRITE SCRATCHPAD + SP3 address
DATA: BUFFER, 40;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:28; // Copy SP3 to SRAM


DS2434 Reset Battery Cycle Counter

Code: Select all

//DS2434 Reset Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Reset cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:B8; // Reset Battery Cycle Counter


DS2434 Increment Cycle Counter

Code: Select all

//DS2434 Increment Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Increment cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:B5; // Increment Battery Cycle Counter

// Read cycle counter
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 82; // READ Cycle counter register


DS2434 Read Cycle Counter

Code: Select all

//DS2434 Read Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Read cycle counter
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 82; // READ Cycle counter register



DS2434 Read Battery Temperature (with A/D conversion at first step)

Code: Select all

//DS2434 Read Battery Temperature

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Start A/D conversion for temperature
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:D2; // Convert T

// Dummy - wait for temperature conversion (max 1000ms)
#OPERATION;
SW:0,0,0,0,250,250,250,250,0,1500;
INSTR:B2, 62; // READ Status Register

// Read Temperature
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 60; // READ Temperature Register


I'm also including updated memory database file for v1.8.5 (so you can find DS2434 in memory list). Please unpack this file and replace it in "%appdata%/REVELPROG-IS" only if you have v1.8.5 software version
Attachments
device_list.zip
(59.45 KiB) Downloaded 197 times

faizanmazhar00
Posts: 1
Joined: Mon Feb 21, 2022 8:02 pm

Re: DS2434 1-wire battery chip programming (reset counter, read/write eeprom)

Postby faizanmazhar00 » Mon Feb 21, 2022 8:09 pm

ArT wrote:REVELPROG-IS since v1.8.5 is supporting DS2434 Battery Identification Chip. It's older version of DS2436 Battery ID/Monitor Chip which is already supported - there are only small differences (please check programming procedures for DS2436 here viewtopic.php?f=32&t=436). Both battery chips are using 1-Wire interface and has 160 bytes of memory divided to 5 pages. I'll be using custom scripts for custom script tool in REVELPROG-IS.

DS2434 is 1-wire device with 16-bit unique ID, 2-byte battery cycle counter, A/D converter for battery temperature monitoring and 32 bytes eeprom for user data (total memory area is 160 bytes divided to 5 pages, but not all bytes are used).
.
Connection requires 3 wires:
- ground (pin 4 in programmer),
- data line (pin 5 in programmer),
- vdd (pin 8 in programmer)

This is how I connected it with REVELPROG-IS socket but you can also try to programm it in external circuit.
DS2434_programming_connection.jpg


Below are ready to use scripts for REVELPROG-IS.
You can read more about Custom Scripts Programming here: viewtopic.php?f=22&t=280

DS2434 Read EEPROM (5 pages, 32 bytes per page = 160 bytes total*)

Code: Select all

// DS2434 READ (5 pages, each 32 bytes = 160 bytes total)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// PAGE 1 read (24 EEPROM bytes + 8 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:71; // COPY NV1 to SP1
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 00; // READ SCRATCHPAD + SP1 ADDR

// PAGE 2 read (8 EEPROM bytes + 24 dummy bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:77; // COPY NV2 to SP2
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 20; // READ SCRATCHPAD + SP2 ADDR

// PAGE 3 read (32 SRAM bytes)
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:7A; // COPY SRAM to SP3
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:11, 40; // READ SCRATCHPAD + ADDR

// PAGE 4 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:B2, 60; // READ REGISTERS + REG. START. ADDR

// PAGE 5 read
#OPERATION;
SW:0,0,1,31,0,0,0,0,0,500;
INSTR:B2, 80; // READ REGISTERS + REG. START. ADDR

*please check datasheet which bytes are valid and which can be changed because not all bytes in memory area are used and some of them are read only

DS2434 Read 16-bit unique ID

Code: Select all

//DS2434 Read ID Register (16-bit)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Read ID Register
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 80; // READ REGISTERS + REG. START. ADDR



DS2434 Write EEPROM (3 pages: 24 bytes (SP1 = EEPROM) + 8 bytes (SP2 = EEPROM) + 32 bytes (SP3 = SRAM))
- data from buffer (since v1.8.5 only)

Code: Select all

//DS2434 WRITE EEPROM (using current data in buffer)

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Unlock NV1
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:44; // Unlock NV1

// PAGE1 Write EEPROM (24 bytes)
#OPERATION;
SW:1,23,0,0,0,0,0,0,0,500;
INSTR:17, 00; // WRITE SCRATCHPAD + SP1 address
DATA: BUFFER, 0;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:22; // Copy SP1 to NV1

// PAGE2 Write EEPROM (8 bytes)
#OPERATION;
SW:1,7,0,0,0,0,0,0,0,500;
INSTR:17, 20; // WRITE SCRATCHPAD + SP2 address
DATA: BUFFER, 20;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:25; // Copy SP2 to NV2

// PAGE3 Write RAM & SRAM (32 bytes)
// please note: it will be lost when battery disconnected
#OPERATION;
SW:1,31,0,0,0,0,0,0,0,500;
INSTR:17, 40; // WRITE SCRATCHPAD + SP3 address
DATA: BUFFER, 40;
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:28; // Copy SP3 to SRAM


DS2434 Reset Battery Cycle Counter

Code: Select all

//DS2434 Reset Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Reset cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:B8; // Reset Battery Cycle Counter


DS2434 Increment Cycle Counter

Code: Select all

//DS2434 Increment Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Increment cycle counter
#OPERATION;
SW:0,0,0,0,0,0,0,0,0,500;
INSTR:B5; // Increment Battery Cycle Counter

// Read cycle counter
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 82; // READ Cycle counter register


DS2434 Read Cycle Counter

Code: Select all

//DS2434 Read Battery Cycle Counter

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Read cycle counter
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 82; // READ Cycle counter register



DS2434 Read Battery Temperature (with A/D conversion at first step)

Code: Select all

//DS2434 Read Battery Temperature

#SCRIPT HEADER;
SCRIPT:v1.8.5;

#HARDWARE SETTINGS;
HW:1-WIRE,5.0V,SLOW;

// Start A/D conversion for temperature
#OPERATION;
SW:0,0,0,0,0,0,0,10,0,500;
INSTR:D2; // Convert T

// Dummy - wait for temperature conversion (max 1000ms)
#OPERATION;
SW:0,0,0,0,250,250,250,250,0,1500;
INSTR:B2, 62; // READ Status Register

// Read Temperature
#OPERATION;
SW:0,0,1,1,0,0,0,0,0,500;
INSTR:B2, 60; // READ Temperature Register


I'm also including updated memory database file for v1.8.5 (so you can find DS2434 in memory list). Please unpack this file and replace it in "%appdata%/REVELPROG-IS" only if you have v1.8.5 software version

Thanks


Return to “Tutorials and Examples”

Who is online

Users browsing this forum: No registered users and 5 guests

cron