DPS5005
The DPS5005, and related DPS3005, are variable 'bench' power supply modules.
OpenDPS
The firmware can be overwritten with an open source project called OpenDPS.
Calibration
Voltage and current are controlled using 2 DAC and measured using 2 ADC. The values are model specific and may need to be calibrated.
Calibration requires 2 values per DAC or ADC: The slope (K) and offset (C). These values are defined inside the dps-model.h file.
To calibrate the voltage DAC, set a voltage value to the DHR12R1 register at address 0x40007408. We will map this voltage value to the actual voltage that is measured with a reference multimeter.
- Turn on power using the power button
- Set the voltage through OpenOCD:
mww 0x40007408 50(D1) - Measure the voltage with a reference multimeter (V1)
- Set the voltage to another value:
mww 0x40007408 500(D2) - Measure the voltage again. (V2).
- Calculate the K value: (D1 - D2) / (V1 - V2)
- Calculate the C value: D1 - (K * V1)
- Update values for K and C as V_DAC_K and V_DAC_C.
The same principle applies for the current DAC, but DAC_DHR12R2 at 0x40007414.
- Connect a current meter in series with a load
- Set the current through OpenOCD:
mww 0x40007414 500(D1) - Measure the current as C1
- Set the current through OpenOCD:
mww 0x40007414 1200(D2) - Measure the current as C2
- Calculate the K value: (D1 - D2) / (C1 - C2)
- Calculate the C value: D1 - (K * C1)
- Update values for K and C as A_DAC_K and A_DAC_C.
The ADC K/C values can be calibrated by calculating the original raw value based on the measured and actual voltage/current and then adjusting the existing K/C values to account for any drift. The raw value is calculated as: R=(V-C)/K, where V is the measured value, K is the existing slope and C is the existing offset values. With R, calculate the new K and C values with respect to the actual values.
Fonts
The Makefile is capable of rendering different fonts to be used in the firmware. Copy your ttf or otf font and run:
# make -C opendps fonts METER_FONT_FILE=`pwd`/nf.ttf METER_FONT_SMALL_SIZE=16 METER_FONT_MEDIUM_SIZE=22 METER_FONT_LARGE_SIZE=30
Graphics
Convert a png with the script:
% python gen_lookup.py -i gfx/png/poweroff.png -o poweroff
Converting gfx/png/poweroff.png to gfx-poweroff.c/h
JTAG
The DPS power supplies have a STM32 microprocessor. You can use a STLink adapter to access the microprocessor.
- Install OpenOCD.
- Connect the DPS pins GND, SWDIO, and SWCLK to the STLink adapter
- Connect power to the DPS
- Run OpenOCD with
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg.
$ openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg
Open On-Chip Debugger 0.10.0
Licensed under GNU GPL v2
For bug reports, read
http://openocd.org/doc/doxygen/bugs.html
Info : auto-selecting first available session transport "hla_swd". To override use 'transport select <transport>'.
Info : The selected transport took over low-level target control. The results might differ compared to plain JTAG/SWD
adapter speed: 1000 kHz
adapter_nsrst_delay: 100
none separate
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : Unable to match requested speed 1000 kHz, using 950 kHz
Info : clock speed 950 kHz
Info : STLINK v2 JTAG v17 API v2 SWIM v4 VID 0x0483 PID 0x3748
Info : using stlink api v2
Info : Target voltage: 3.236988
Info : stm32f1x.cpu: hardware has 6 breakpoints, 4 watchpoints
Info : accepting 'telnet' connection on tcp/4444
Telnet to port 4444:
$ telnet localhost 4444
> flash list
{name stm32f1x base 134217728 size 131072 bus_width 0 chip_width 0}
> flash banks
#0 : stm32f1x.flash (stm32f1x) at 0x08000000, size 0x00020000, buswidth 0, chipwidth 0
> halt
target halted due to debug-request, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x080001d2 msp: 0x200007a8
> stm32f1x options_read 0
Option Byte: 0x3fffffe
Readout Protection On
Software Watchdog
Stop: No reset generated
Standby: No reset generated
User Option0: 0xff
User Option1: 0xff
Readout Protection is set to On, which can be changed by changing the Read Protection (RDP) level. There are 3 levels:
- 0: No read protection.
- 1: Read protection enabled.
- 2: Debug/chip read protection disabled. Will disable JTAG, which is bad for our case.
By changing the RDP value from 1 to 0, you will erase the flash. That's what I inadvertently did here, oops.
> stm32f1x unlock 0
Device Security Bit Set
target halted due to breakpoint, current mode: Handler HardFault
xPSR: 0x61000003 pc: 0x2000003a msp: 0x2000076c
stm32x unlocked.
INFO: a reset or power cycle is required for the new settings to take effect.
> stm32f1x options_read 0
Option Byte: 0x3fffffc
Readout Protection Off
Software Watchdog
Stop: No reset generated
Standby: No reset generated
User Option0: 0xff
User Option1: 0xff