-
Notifications
You must be signed in to change notification settings - Fork 4
Serial protocol
Steffen K edited this page Sep 24, 2020
·
5 revisions
Offset | Function |
---|---|
1 - 2 | Frame header |
3 | Address |
4 - 5 | Data |
6 | Checksum |
The checksum is calculated as the byte sum (mod 256) of the frame address and data (see: AtyMain.java#L365-L379)
byte checksum = (byte)((address + data[0]) + data[1]);
Header | Function |
---|---|
A5A5 |
Write data/params to BMS |
5A5A |
Read data/params from BMS |
DBDB |
Write data to the screen/main (?) board |
Used in AtyParam2.java
.
Bluetooth: Send 0xDBDB00000000
- Returns 140 bytes of data
BMS serial port: Send 0x5A5A00000000
Offset | Function | Type | Unit |
---|---|---|---|
0 - 3 | Frame Header | 0xAA 0x55 0xAA 0xFF | |
4 - 69 | Voltage data | 0.000 V | |
70 - 73 | Current | int | 0.0 A |
74 | Percentage of remaining battery | u8 | |
75 - 78 | Battery physical capacity | u32 | .000000 AH |
79 - 82 | The remaining battery capacity | u32 | .000000 AH |
83 - 86 | Total battery cycle capacity | u32 | .000AH |
87 - 90 | Accumulated from boot time seconds | u32 | S |
91 - 102 | Actual temperature | short | degree |
103 | Charge mos tube status flag | u8 | (after analysis) |
104 | Discharge mos tube status flag | u8 | (after analysis) |
105 | Balanced status flag | u8 | (resolved below) |
106 - 107 | Tire length | u16 | MM |
108 - 109 | The number of pulses per week | u16 | N |
110 | Relay switch | u8 | does not show |
111 - 114 | Current Power | int | W |
115 | Maximum number of monomer strings | u8 | None |
116 - 117 | The highest monomer | u16 | 0.000V |
118 | Lowest monomer string | u8 | None |
119 - 120 | Lowest monomer | u16 | 0.000V |
121 - 122 | Average | u16 | 0.000V |
123 | The number of effective batteries | u8 | S |
124 - 125 | Detected discharge tube Voltage between D-S poles | u16 | 0.0V not to be displayed |
126 - 127 | Discharge MOS transistor driving voltage | u16 | 0.0V not display |
128 - 129 | Charging MOS tube driving voltage | u16 | 0.0V not display |
130 - 131 | When the detected current is 0, the comparator initial value Control equalization corresponds to 1 equalization |
u16 | is not displayed |
132 - 135 | (1 - 32 bits corresponds to 1 - 32 string equalization) corresponds to bit 1 displays the color at the corresponding voltage |
u32 | |
136 - 137 | The system log is sent to the serial port data 0 - 4: Status 5 - 9: Battery number 10 - 14: Sequential order 15: Charge and discharge (1 discharge, 0 charge) |
u16 | |
136 - 137 | System logs | ||
138 - 139 | Sum check | 2 bytes |
The checksum is calculated as the sum of all data bytes at offsets 4 to 137 and will be verified as follows (see: BcService.java#L277-L286):
int expected = 0;
for (i = 4; i < 138; i++) {
expected += data[i];
}
int checksum = (data[138] << 8) + data[139]; // big endian
if (checksum == expected) {
// checksum valid
} else {
// checksum invalid
}
Value | Type |
---|---|
0 | Off |
1 | Open |
2 | Overvoltage protection |
3 | Over current protection |
4 | battery full |
5 | total overpressure |
6 | battery over temperature |
7 | power over temperature |
8 | Abnormal current |
9 | Balanced line dropped string |
10 | motherboard over temperature |
13 | Discharge tube abnormality |
15 | Manually closed |
Value | Type |
---|---|
0 | Off |
1 | Open |
2 | Over-discharge protection |
3 | Over current protection |
5 | Total pressure undervoltage |
6 | Battery over temperature |
7 | Power over temperature |
8 | Abnormal current |
9 | Balanced line dropped string |
10 | Motherboard over temperature |
11 | Charge on |
12 | Short circuit protection |
13 | Discharge tube abnormality |
14 | Start exception |
15 | Manually closed |
Value | Type |
---|---|
0 | Off |
1 | Exceeds the limit equilibrium |
2 | Charge differential pressure balance |
3 | Balanced over temperature |
4 | Automatic equalization |
10 | Motherboard over temperature |
Address | Type | Notes |
---|---|---|
247 | Close BMS power | |
248 | Current zeroing | |
249 | Discharge MOS tube switch Forced to close the discharge tube |
Data is 0 |
250 | Charge MOS tube switch Forced shutdown charge officer |
Data is 0 |
251 | Change the parameter to iron lithium | |
252 | The battery is automatically balanced | |
253 | Factory Settings button | |
254 | Reboot button | |
255 | Apply button |
AtyParam.java
uses this parsing
Address | Type |
---|---|
1 | Monomer over-voltage alarm voltage |
2 | Single undervoltage warning voltage |
3 | Single overvoltage protection voltage |
4 | Single undervoltage protection voltage |
5 | Monomer overvoltage recovery |
6 | Monomer undervoltage recovery |
7 | Total voltage overvoltage protection voltage |
8 | Total voltage undervoltage protection voltage |
9 | Charge Overcurrent Protection 000.0A |
10 | Charging Overcurrent Protection Delay Seconds |
11 | Discharge Overcurrent Protection |
12 | Discharge Overcurrent Protection Delay Seconds |
13 | Equilibrium voltage limit |
14 | Equilibrium starting voltage during charging |
15 | Equal pressure difference |
16 | Equilibrium current value (1-20) |
17 | System Voltage Reference |
18 | Current sensor range |
19 | Start Current (A) |
20 | Short Circuit Protection Current (A) |
21 | Short circuit protection delay (us) |
22 | No current automatic standby time (seconds) |
23 | Total voltage AD value is 0000 (4-digit integer) (is converted into the actual voltage value parameter) |
24 | Set the number of battery strings |
25 | Battery high temperature charge protection |
26 | Battery High Temperature Charge Recovery |
27 | Battery High Temperature Discharge Protection |
28 | Battery High Temperature Discharge Recovery |
29 | Power tube high temperature protection |
30 | Power tube high temperature recovery |
31 - 32 | Battery Physical Capacity .000 000AH (2 Spaces) (76 Low, 77 High) |
33 - 34 | remaining capacity .000 000AH (2 spaces) (78 low, 79 high) |
35 - 36 | Total circulation capacity .000AH (2 spaces) (80 low, 81 high) |
41 | Tire length |
42 | Number of pulses per week |
51 - 74 | Battery internal resistances |
100 | Runtime (70 - 71 two spaces) |