MAX31826 programming 1Kb EEPROM

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

MAX31826 programming 1Kb EEPROM

Postby ArT » Thu May 13, 2021 2:36 pm

MAX31826 is 1-wire digital temperature sensor with 1Kb Lockable EEPROM. It's supported with REVELPROG-IS since version v1.8.5 (where custom script tool has new "BUFFER" feature)

Please take a look at memory organization from MAX31826 datasheet page 9.

In this subject I'll focus only how to read and write EEPROM area. Please note that EEPROM area can be permanently locked, in such case you can only read device (erasing and writing will not work).

Connections with REVELPROG-IS

MAX31826 required connections:
- please connect VDD, GND and DQ pins (DS & MAX devices will not work in programmer socket, but you can use ZIF32 socket or ICSP connector for wires connection),
- please connect only one slave device to programmer,
- pin 4 in programmer = GROUND,
- pin 5 in programmer = DATA,
- pin 8 in programmer = VDD.

Pull-up resistor (optional):
- data line (pin 5) has already 4.7k ohm pull-up resistor inside the programmer,
- if you need stronger pull-up, you can connect additional resistor (1.5k-4.7k) between pin 5 (DATA) and 8 (VPP)

READ/WRITE MAX31826 EEPROM area

You can reprogramm EEPROM of MAX31826 (128 bytes of data) with REVELPROG-IS (since v1.8.5) by selecting device from memory database EEPROM -> 1-Wire -> Maxim -> MAX31826 and use standard read/write buttons from application. It will use custom script tool in background (it will import below custom scripts and execute). It will work since version v1.8.5 where custom script tool was improved. Read is working. Write is working (only if device is not locked). Erase is working (only if device is not locked). Automatic verification is not working, you need to verify manually (write eeprom -> read eeprom -> compare).

Script for reading is very simple, just single operation for reading all 128 bytes of EEPROM:

Code: Select all

#SCRIPT HEADER;
SCRIPT:v1.8.5;

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

// Read EEPROM (128 bytes)
#OPERATION;
SW:0,0,1,127,0,0,0,0,0,500;
INSTR:CC, F0, 00; // SKIP ROM + READ MEMORY + START ADDR (00h)


Script for writing eeprom will work on REVELPROG-IS >=v1.8.5. It writes 16 pages * 8 bytes = 128 bytes in total (16 operations). Script is using new Custom Script feature "DATA:BUFFER" which is importing data directly from buffer in application so you do not need to enter data bytes in script. First of all it copies 8 bytes from buffer to MAX31826 scratchpad2. Secondly it copies Scratchpad2 to EEPROM area. Both operations are repeated 16 times (where memory address is incremented). At the end it reads 128 bytes so you can see if it was written correctly (you can remove this operation from script). Here is the write script:

Code: Select all

// MAX31826 Write EEPROM
SCRIPT HEADER;
SCRIPT:v1.8.5;

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

// Write 128 bytes (16 pages * 8 bytes) to EEPROM
// Data for write will be imported from buffer (buffer should be 128 bytes length)
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,00; // SKIP ROM + WRITE SCRATCHPAD2 + ADDRESS
DATA:BUFFER; // DATA WILL BE IMPORTED FROM BUFFER
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,08;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,10;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,18;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,20;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,28;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,30;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,38;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,40;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,48;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,50;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,58;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,60;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,68;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,70;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE
#OPERATION;
SW:1,7,0,0,50,0,0,50,0,500;
INSTR:CC,0F,78;
DATA:BUFFER;
#OPERATION;
SW:0,0,0,0,0,0,0,25,0,500;
INSTR:CC, 55, A5; // SKIP ROM + COPY SCRATCHPAD2 + ENTER PROGRAMMING CYCLE

// Read EEPROM (128 bytes)
#OPERATION;
SW:0,0,1,127,0,0,0,0,0,500;
INSTR:CC, F0, 00; // SKIP ROM + READ MEMORY + START ADDR (00h)


Lock Memory

Factory new chip is unlocked so you can read & write to EEPROM area. If you are reprogramming MAX31826 please note that it can be permanently locked, so further writing or erasing will not work (new device is required). Please check MAX31826 datasheet for more details.

Vodugo
Posts: 1
Joined: Thu Jun 17, 2021 6:14 pm

Re: MAX31826 programming 1Kb EEPROM

Postby Vodugo » Wed Jun 23, 2021 12:13 pm

Thank you for the script. My friend in Greece was looking for something similar, I will pass him this info


Return to “Tutorials and Examples”

Who is online

Users browsing this forum: No registered users and 1 guest