This repository is there to build an open-source firmware for the ZPB30A1 electronic load.
The original firmware is protected and therefore could not been read and improved partially.
So if you plan to buy a load like this and want to "upgrade", consider ordering the processor and a cheap STLink V2 too (if you haven't got one already).
The ZPB30A1 uses a STM8S005K6 running at 16 MHz with an external 12 MHz crystal and internal 128 kHz.
- 32 kByte Flash
- 2 kByte RAM
- 128 Byte EEPROM
- External interrupts in almost all pins
- Up to 6 analog inputs in LQFP32 package
- 2x 16 Bit, 1x 8 Bit timers
- UART, SPI, I2C
|1||NRST||IN PUP||NRST||Connect to ST-Link|
|5||VCAP||PAS||VCAP||1uF for internal 1.8V regulator|
|9||VDDA||PWR||Vcc||5V (via PCB inductor)|
|11||PB5/AIN5||IN PUP||Encoder 2||Frontpanel|
|12||PB4/AIN4||IN PUP||Encoder 1||Frontpanel|
|13||PB3/AIN3||IN Analog||Input voltage||
|14||PB2/AIN2||IN Analog||Sense voltage||
|15||PB1/AIN1||IN Analog||Load voltage||
|16||PB0/AIN0||IN Analog||Thermistor input||
|17||PE5||OUT||Enable||Must be LOW to enable load regulation, otherwise MOSFET stays off (no load)|
|19||PC2/T1C2||IN PUP||Overload detect||LOW when SET I is higher than the source can deliver|
|20||PC3/T1C3||IN PUP||Encoder Button||Frontpanel|
|21||PC4/T1C4||IN PUP||Run Button||Frontpanel|
|25||PD0/T3C2||OUT PWM||FAN||PWM speed control, 50 kHz, 1/3 duty on idle|
|26||PD1/SWIM||PROG||SWIM||Connect to ST-Link|
|27||PD2/T3C1||OUT PWM||F||50 kHz 50% duty|
|28||PD3/T2C2||IN PUP||Voltage OK||LOW when VIN > 9.6 V|
|29||PD4/T2C1||OUT PWM||Buzzer||2.364 kHz 50% duty|
|30||PD5/U2TX||OUT||Tx||115200 baud 8n1|
|31||PD6/U2RX||IN||Rx||115200 baud 8n1|
I-SET runs now at 571 Hz, which gives also good results.
It seems like they have activated the Read Out Protection, so when running a flash readout, it just dumps zeros. Using STVP-STM32 on Windows confirmed my guess and made it even worse. So not only the ROP is set, the write protection is also set. So there neither real software reverse engineering possible nor can you recycle the existing processor. Software needed to be build from scratch.
As there are just a few compilers out there and just one open source solution, we'll be using Small Device C Compiler (SDCC).
Development started using a STM8S Discovery, which is using a STM8S003K3. This is incompatible with the 005 on the load, as UART2 is UART1, PWM on FAN is not available and there are no internal PullUps on the encoder pins.
- Different modes:
- CC (Constant Current, as default)
- CW (Constant Power)
- CR (Constant Resistance)
- BAT (Battery capacity test)
- Continous output of data via UART
- Logging of Ah, Wh, J (?) in every mode
- Adjusting shunt resistance (if replaced with e.g. 100 mΩ for an offset as low as 20 mA instead of 200 mA, not the resistance itself but the value in software)
ℹ️Not needed, we can safely trim the current down to almost 0 mA by PWM
- Toggle beeper, auto shutdown
- Currently no beeper active
- Nice menus even though we got just that small seven segments
|Voltage Input||0-30 V||± 0.3% ± 20 mV (oversampling the 10 bit ADC to get 12 fake bit)|
|Current control||0-10 A||± 0.1% ± 1 mA|
|Temperature||30-90°C||± 1.5 °C|
Due to multiplication of the tolerances in constant power and constant resistance mode no concrete specifications are given.
||Ultra-high voltage for battery capacity testing. [whatever this should be]|
||VBATT < VTHRESHOLD, reversed or not connected|
||Line resistance to high; The set current can't be delivered|
||Circuit failed somewhere somehow. [Unknown error]|
||Input voltage is inapropiate (12V/0.5A), if using a correct power supply, check PB3 and PD3 for shorts or open contacts|
||Over temperature protection [if everything is cool, check the thermistor value @ 25°C / 77°F]|
||Temperature sensore failure or temperature too low|
||Overvoltage Protection [Sense can measure 35 V max]|
||Transient power protection [Peaks?]|