DPS communication protocol

You can find communication protocol for all Riden DPS device at there official google disk.

Link 1

Link 2

Official RD files

As you can see the DPS use Modbus RTU protocol.  Chinese firware anwser every 400ms by Modbus request (2.5 times a second).

My alternative firmware mostly use the same Modbus registers to communicate with DPS. The alternative firmware answer every 100ms (10 times a second).

For example U-SET can be read as Holding register at address 0000H, I-SET as Holding register at address 0001H, and so on.

The alternative firmware uses Modbus data as shown below.

Alternative firmware protocol (all models)

Most of the main data are the same as in stock chinese protocol

Main Data

typedef struct {
uint16_t USET; // always format 00.00
uint16_t ISET; // format 00.00 for DPS5020 // format 00.00 for DPS5015 // format 0.000 for DPS5005
uint16_t UOUT; // always format 00.00
uint16_t IOUT; // format 00.00 for DPS5020 // format 00.00 for DPS5015 // format 0.000 for DPS5005
uint16_t POWER; // always format 0000.0
uint16_t UIN; // always format 00.00
uint16_t LOCK; // key lock
uint16_t PROTECT; // see type definition below protect_t
uint16_t CVCC;
uint16_t ONOFF;
uint16_t BLED; // display backlight (Stores in EEPROM as BCKL)
uint16_t MODEL;
uint16_t VERSION;
uint16_t TMP; // temperature
uint16_t STATE; //Set of bits (before ver 4.2 SPCN; // Source percent)
uint16_t DEBUG_DATA; // Internal use

uint16_t MGIC; // Magic key (Internal use)
uint16_t DVID; // Model, device ID
uint16_t COMM; // online-offline + Baud Rate + Modbus Address
uint16_t GYRO; // Internal use
uint16_t MMAX; // Max memory number 
uint16_t d22; // not used (before ver 4.2 RCNT; // Reset counters)
uint16_t BCKL; // Backlight from BLED (before ver 4.2 C or F)
uint16_t OHP; // overheat temperature
uint16_t d25; // not used ( before ver 4.2 SMART – Smart display // power on start in old versions)
uint16_t PARAM; // Set of parameters (before ver 4.2 BSRC; // battery source)
uint16_t MINS; // minimum source battery 0%
uint16_t MAXS; // maximum source battery 100%
uint16_t CLR1; // PowerOff Color (RGB565)
uint16_t CLR2; // CV color (RGB565)
uint16_t CLR3; // CC color (RGB565)
uint16_t CRC; //Internal use

DummySet_t Dummy[3];
MemorySet_t Memory[20];
CalibData_t Calib;
} ModbusDataSet_t;

Constants (since ver 4.2)

// Bitmask for register STATE
#define ANA_TEMP_SENSOR 0x01 // Analog temperature sensor in the model
#define DIG_TEMP_SENSOR 0x02 // Digital temperature sensor LM75 found at startup
#define GYRO_SENSOR 0x04 // Optional MPU6050 gyro sensor found at startup
#define MODEL_WUZHI 0x10 //This is WUZHI

// Bitmask for register PARAM
#define PARAM_C_OR_F 0x01 // hex for 0000 0001
#define PARAM_RESET_COUNTERS 0x02 // hex for 0000 0010
#define PARAM_SMART_DISPLAY 0x04 // hex for 0000 0100
#define PARAM_BATTERY_SOURCE 0x08 // hex for 0000 1000
#define PARAM_POWER_ON_START 0x10 // hex for 0001 0000
#define PARAM_LOCK_ON_START 0x20 // hex for 0010 0000
#define PARAM_SLEEP_ON_START 0x40 // hex for 0100 0000

// Bitmask for register COMM
#define COMM_BAUD 0x03 // hex for 0000 0011 baudrate 0,1,2,3
#define COMM_ONLINE 0x04 // hex for 0000 0100
#define COMM_WIFI 0x08 // hex for 0000 1000
#define COMM_DEBUG 0x10 // hex for 0001 0000

Type Definition

typedef struct {
uint16_t USET; // always format 00.00
uint16_t ISET; // format 00.00 for DPS5020 // format 00.00 for DPS5015 // format 0.000 for DPS5005
uint16_t SOVP; // always format 00.00
uint16_t SOCP; // format 00.00 for DPS5020 // format 00.00 for DPS5015 // format 0.000 for DPS5005
uint16_t SOPP; // always format 0000.0
uint16_t BLED;  //(chinese version only)
uint16_t SOFT; // Soft Front
uint16_t SINI; // Power output switch (chinese version only)
uint16_t OTIM; // overtime
uint16_t d09;
uint16_t d10;
uint16_t d11;
uint16_t d12;
uint16_t d13;
uint16_t d14;
uint16_t d15;
} MemorySet_t;

typedef struct {
uint16_t JMP_BOOT; // Jump to system bootloader
uint16_t d1;
uint16_t d2;
uint16_t MEM; // Memory Number 
uint16_t d4;
uint16_t d5;
uint16_t d6;
uint16_t d7;
uint16_t d8;
uint16_t d9;
uint16_t d10;
uint16_t d11;
uint16_t d12;
uint16_t d13;
uint16_t d14;
uint16_t d15;
} DummySet_t;

typedef enum {
mode_CV = 0,
mode_CC
} mode_t;

typedef enum {
protect_OK = 0,
protect_OVP,
protect_OCP,
protect_OPP,
protect_OTP, // overtime
protect_OHP, // overheat
protect_BAT, // low source battery. shows “BAT”
protect_BATLOWCURRENT // low charge current. shows “END”
} protect_t;

typedef struct{
uint32_t Value;
uint16_t RowADC;
uint16_t RowDAC;
} CalibRecord_t;

typedef struct{
CalibRecord_t Uin1;
CalibRecord_t Uin2;
CalibRecord_t Uout1;
CalibRecord_t Uout2;
CalibRecord_t Iout1;
CalibRecord_t Iout2;
CalibRecord_t Tmp2;
CalibRecord_t Tmp1; //  Internal use
} CalibData_t;

Chinese stock protocol (all models)

Leave a Reply