opendps icon indicating copy to clipboard operation
opendps copied to clipboard

DPS5015 setting in dps-model.h does not work 100% with the latest hardware

Open wangxiatao opened this issue 7 years ago • 53 comments

Hi, I bought a dps5015 fairly recently from a distributor called "KKmoon" from Amazon EU, and I quickly put in opendps after I did some testing on the stock firmware.

Two problems as I can tell right now. First off the settings in dps-model.h does not work correctly on the hardware I have (on the PCB it says version V2.3):

  • ADC on the voltage reading seems to be OK
  • DAC on the voltage is off by about 5%, i.e when setting 12V, it outputs about 11.4V
  • ADC on the current fluctuates quite a lot (when the mean is about 200mA, it displays between 100 and 300mA), and the mean number is not accurate either (it's hard to say what exactly the mean is since it jumps up and down, but if I guess it'll be off by 50%
  • DAC on the current is hard to measure since I yet to find a way to turn it into CC mode on the UI, and I have not tried serial or wifi yet

The second issue is the fan, somehow the fan is slowing ramping up speed regardless of what kind of load is on the output, it feels there's some DAC/PWM output drifted upwards and causing the power supply to the fan to go up. It does turn off if I press the power button to disable output.

Saying that, for the first one, at least on the voltage DAC, I can give it a try and measure the numbers then refine the dps-model.h, as long as I know where to measure, any guidance on that?

Thanks for all your answers in advance!

/Tao

wangxiatao avatar Sep 23 '18 11:09 wangxiatao

Did you by any chance run the register dump prior to reflashing? As I don't have a '5015 myself I am a little lost. I d know there are people running OpenDPS on their '5015:s so hopefully someone of them can help.

kanflo avatar Sep 23 '18 17:09 kanflo

CC is entered by pressing SET and running the knob btw.

kanflo avatar Sep 23 '18 17:09 kanflo

Thanks for getting back to me so quickly Johan! Yeah...well, I missed that step to dump registers, what a mistake :(

I didn't have the same issue as some people have with the on/off button, so I guess the hardware change isn't that substantial, however I only have this dps so it's pretty hard for me to compare. Regarding the CC mode, I don't know if I missed any steps but I don't see it the way you described, I'd guess the UI will show "CC" if it's in CC mode? I did this:

  1. Boot up and wait till "wifi" stops flashing, by default it boots to CV mode
  2. Press "SET", and the cursor defaults to voltage
  3. Press "M2", run the knob and set the current
  4. Press "SET" again to confirm, the cursor disappears and the parameters are set (I guess)
  5. Press "ON/OFF"
  6. UI is still showing "CV" and the power is still cut off when current is over the set limit

wangxiatao avatar Sep 23 '18 20:09 wangxiatao

BTW, will it help if I buy a new one from the same source I bought earlier on, and ship over to you? So you have a hopefully identical dps as I or other people have, with stock firmware to measure on. I'd guess a lot of people will go for 5015 simply because it's quite comparable price as 5005, and given it's active heat sink it should do a better job on heavy load. At least that what I thought when buying it, I can see the sales of 5015 is going to be up.

wangxiatao avatar Sep 23 '18 20:09 wangxiatao

BTW, will it help if I buy a new one from the same source I bought earlier on, and ship over to you? So you have a hopefully identical dps as I or other people have, with stock firmware to measure on. I'd guess a lot of people will go for 5015 simply because it's quite comparable price as 5005, and given it's active heat sink it should do a better job on heavy load. At least that what I thought when buying it, I can see the sales of 5015 is going to be up.

Did kanflo accept your generous offer to provide a 5015 for development?

I ask because I also have a 5015 and would love for this model to be officially supported!

ricktendo avatar Sep 28 '18 22:09 ricktendo

If you generously send me a '5015 @wangxiatao I would be happy to look at it. I have two other pressing matters on my todo list though, one just got covered on Hackaday, so I would guess "November" on '5015 support.

kanflo avatar Oct 01 '18 18:10 kanflo

I guess I should add #error "Perform register dump prior to flashing"to opendps.c making sure no-one misses that ;)

kanflo avatar Oct 01 '18 19:10 kanflo

BTW, will it help if I buy a new one from the same source I bought earlier on, and ship over to you? So you have a hopefully identical dps as I or other people have, with stock firmware to measure on. I'd guess a lot of people will go for 5015 simply because it's quite comparable price as 5005, and given it's active heat sink it should do a better job on heavy load. At least that what I thought when buying it, I can see the sales of 5015 is going to be up.

Did kanflo accept your generous offer to provide a 5015 for development?

I ask because I also have a 5015 and would love for this model to be officially supported!

Yes he did :) According to @kanflo good things might happen in November, stay tuned

wangxiatao avatar Oct 10 '18 08:10 wangxiatao

Hi,

I have DPS5015 PCB revision V2.3 (bought from TomTop an year ago). I did registers dump before reflashing it to OpenDPS. DPS5015_debug_data.tar.gz After reflashing it does not working properly, but I guess I did some mistakes somewhere. Before reflashing I desoldered STM32F100 and soldered new one instead of it, so I have backup chip with stock firmware.

ps. please note that files 5V-off_new.txt and 5V-on_new.txt in the archive are registers dump with OpenDPS firmware, the rest files are registers dump with stock firmware.

u22br avatar Oct 13 '18 21:10 u22br

Hi,

Today I found the reason why my OpenDPS setup was not worked. I wasted a lot of time trying to found where I made a mistake when I edited source code files/compiled a project/flashed it to mc/something else. Finally I decided to check microcontroller ID and bingo :) As I said before, I desoldered original STM32F100C8T6B for have a backup and soldered other MC which I bought on Aliexpress 3 month ago from this seller: https://ru.aliexpress.com/item/5PCS-STM32F100C8T6B-QPF32-MCU-new-and-original-IC-free-shipping/32461309300.html

Unfortunately I have got STM32F100C8T6 (without "B" at the end) but this is not so important more important that this is supposed to be remarked STM32F103. What said openocd about this remarked chip: root@stm32-dev:~/opt/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-8.1/.content/scripts# openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "init" -c "$target_name mdw 0xE0042000 1" -c "exit" 0xe0042000: 20036410

information from reference manual for STM32F103xx 2

What said openocd about original chip from DPS5015: root@stm32-dev:~/opt/xPacks/@gnu-mcu-eclipse/openocd/0.10.0-8.1/.content/scripts# openocd -f interface/stlink.cfg -f target/stm32f1x.cfg -c "init" -c "$target_name mdw 0xE0042000 1" -c "exit" 0xe0042000: 10016420

information from reference manual for STM32F100xx 3

photo of remarked chip 32f100

u22br avatar Oct 17 '18 18:10 u22br

Aha so this is how a register dump looks like! How does one make use of this dump?

I just checked my stock MCU and it has the same response as your original MCU, just to confirm that. Now knowing this, have you been able to get your dps to work @u22br ?

wangxiatao avatar Oct 17 '18 20:10 wangxiatao

Today I ordered STM32F100C8T6B from local distributor, hope that I will get it in 2-3 days. I guess that my DPS will work OK with right stm32 because of with fake STM32F100 everything was fine except of reaction on ON/OFF button. That is due to STM32F103 does not have DAC.

u22br avatar Oct 17 '18 20:10 u22br

Hi,

Some updates. With genuine STM32F100C8T6B my dps has appropriate reaction on ON/OFF button, output voltage appeared but there is some issue as wangxiatao described in first message. Output voltage a bit less than I set up, for example if I set 5V real output voltage is about 4.68V. Also recently I have got new toy - DPS5020. It also has PCB revision V2.3 and I took a photos of all active components on both DPS5015 and DPS5020. I am not sure that this issue thread is right place for posting these photos but if @kanflo confirm that it is OK, I will post it here. In my opinion the difference between 5015 and 5020 very little - output choke, one electrolytic capacitor, input mosfets.

u22br avatar Oct 22 '18 19:10 u22br

Please feel free to post the photos @u22br.

kanflo avatar Oct 22 '18 20:10 kanflo

Aha so this is how a register dump looks like! How does one make use of this dump?

@wangxiatao The register dump can be used to check what state of the STM32 peripherals (DAC, timers, GPIOs, ...) when the original firmware is running. With this information it is possible to check if the original firmware uses a peripheral that OpenDPS currently not supports.

kanflo avatar Oct 22 '18 20:10 kanflo

later I will edit this post and add to it some additional info and photos . . 5015 0 1 all four output mosfets same as this one: 2 3 4 5 6 7 8 9 10 11 12 . . . . 5020 0 1 2 3 4 5 6 7 8 9 10 11 12 13

u22br avatar Oct 22 '18 20:10 u22br

Very nice pictures! Can you see which component is the current shunt? I'm interested to know which ADC pins are used by the ST micro to measure current.

I'm not able to use "try an error" to fix the current, I know it's silly and I should've started with measuring the right components, but I actually did that on the voltage DAC and the value below gives me good setting on the voltage, which is confirmed by another multimeter: #define V_DAC_K (double)0.076700

wangxiatao avatar Oct 23 '18 20:10 wangxiatao

@wangxiatao sorry, I am not sure that I correctly understand what you mean when say "which component is the current shunt". There are three current shunts on the board near output terminals. Near it (in fact right under current shunts) there are four active components (all sot-23): SOT-23-5 | marking on the board: U6 | marking code: A63A | LM321M SOT-23-5 | marking on the board: U3 | marking code: S0BFA | SGM8581 regarding to this information https://www.elektroda.pl/rtvforum/topic3442107.html SOT-23 | marking on the board: Q02 | marking code: Y1 | SS8050 SOT-23 | marking on the board: Q6 | marking code: 702 | 2N7002 (I am not dead sure that marking codes correctly decoded, please double check it)

13 14 15 16

u22br avatar Oct 23 '18 21:10 u22br

Hi,

Today I decided to do a big job, I desoldered almost all components from pcb which cover pcb traces. So with these photos everyone can find out connections between components. And may be someone will be brave enough to do schematics using these photos :) Please note that I will solder pcb back nearest days, so I can do more photos if something hard to examine on provided photos.

pcb_bottom pcb_top

u22br avatar Oct 24 '18 11:10 u22br

@u22br sorry I should've described my question better, I was looking for the amplification output of the voltage drop over the current shunts. The components you mentioned are probably for amplification, so it's interesting to know which pin is the output of the final signal before it goes into the ADC.

The current shunts have extremely low resistance as I measured in room temperature, I don't know if it changes with the current which brings up the temperature. I'm also using quite poor equipment so the measurement is probably below the multimeter's resolution, I only read 0.1ohm to 0ohm. Again I know very little about electronics, maybe this revised description is again incomprehensible :)

wangxiatao avatar Oct 25 '18 08:10 wangxiatao

@wangxiatao I guess that interested your path goes something like that (maybe I'm wrong): i_adc

u22br avatar Oct 25 '18 12:10 u22br

Hi everybody! I would like to report the strange behavior I see on my new DPS5015 and DPS5020 (both V2.3). Of course I have no register dump... stupid, I know!

When I am in the CV-mode I can't setup the voltage. As you can see here in the pictures the voltage jumps between 0V and approximately 83V. Even if I am at the last digit. Sometimes the PSU crashes and need to be restarted, sometimes the LCD gets completely white. The setup of the current seems to work. Also in the CC-mode.

img_20181026_164009 img_20181026_164014

DPS5015 and DPS5020 seem to act the same to me. I have compiled the source with make -C opendps MODEL=DPS5015 MAX_CURRENT=9999

Jantek avatar Oct 26 '18 15:10 Jantek

I should have read the other issues first! Isn't it #48 with have been closed for #17 ?

Jantek avatar Oct 26 '18 15:10 Jantek

I have used @u22br 's scans from https://github.com/kanflo/opendps/issues/50#issuecomment-432616154 to trace the bottom layer for an overlay: dps5015_traces Note that there are separate bottom fills and some vias connect to these.

gnbl avatar Nov 29 '18 18:11 gnbl

@u22br Could you get the values for RT1, R29, RL? I suspect these could be used for temperature sensing - not sure if U7 has a part in it. Also present on DPH5005.

gnbl avatar Nov 30 '18 10:11 gnbl

Hi @gnbl right now I can measure it only without de-soldering if it is not OK for you, please let me know R29 - 9.63kOhm (slightly increased during measurement, may be actually it close to 10kOhm) RL - 10.0kOhm RT1 - 8.97kOhm (slightly increased during measurement, may be actually it close to 10kOhm)

u22br avatar Nov 30 '18 14:11 u22br

@u22br Thanks, I got very similar values - posted in a comment at https://johan.kanflo.com/the-future-of-opendps/ with other findings, but it's not published yet. I suspect U7 is a voltage regulator or reference, but I have not yet found pin compatible parts (assumption: 1 = EN, 2=GND, 3=Out, 4=Vcc, 5=GND). EN then would be controlled by PD1, PA0 would be an ADC to measure the reference voltage, which also sources RL-R29+RT1-GND. PA6 then would measure across RT1. This then is a 10k NTC - pulling PA6 to GND causes the fan to start.


Mistake: RL is across pin 3 (Out) and 4 (VCC). That changes things slightly, hold on..

NTC RT1 is in series only with R29 and connected to VCC, creating a divider that is measured with PA6.

PA0 then isn't involved with temperature measurement but only connected to the suspected output U7.3.

gnbl avatar Nov 30 '18 15:11 gnbl

Although my comment since has appeared in kanflo's blog, I'll take the liberty to "dump" it here as well with minor modifications and additions:

I just got a DPS5015 and DPH5005. There seems to be surprisingly little hardware info on these RD DPS/ DPH power supply modules out there. So far I found https://github.com/kanflo/opendps/tree/master/hardware/reverse-engineering/dps3003 (KiCAD schematics) https://circuitmaker.com/Projects/Details/Damian-Thompson-2/DPH3205-Reverse-Engineer (proprietary schematics) https://github.com/kanflo/opendps/issues/50 DPS5015 PCB photos

Hardware info in the code https://github.com/kanflo/opendps/blob/master/opendps/hw.c#L383 https://github.com/kanflo/opendps/blob/master/opendps/hw.h https://github.com/kanflo/opendps/blob/master/ocd-client.py#L64

which means that there seem to be a few pins unused.

Microcontroller STM32F100C8T6B (C=48 pins, 8=64 Kbytes of Flash memory, T=LQFP -> medium- density device, LQFP48, 8 Kbytes of SRAM) Product page: https://www.st.com/en/microcontrollers/stm32f100c8.html Datasheet: https://www.st.com/resource/en/datasheet/stm32f100c8.pdf Reference Manual: https://www.st.com/resource/en/reference_manual/cd00246267.pdf Errata: https://www.st.com/resource/en/errata_sheet/cd00260217.pdf

GPIO Pin usage on MCU, according to sources above

 1 VBAT
 2 PC13 power control on '5015
 3 PC14 NOT CONNECTED (DPS5015)
 4 PC15 NOT CONNECTED (DPS5015)
 5 OSC_IN NOT CONNECTED (DPS5015)
 6 OSC_OUT / PD1 -> U7.1 (SOT23-5, "M2Y8")
 7 NRST NOT CONNECTED (DPS5015)
 8 V_SSA -> U7.5 (DPS5015)
 9 VCC
10 PA0 (RL, U7.3 on DPS5015 and DHP5005)
11 PA1 button M2
12 PA2 button SEL
13 PA3 button M1
14 PA4 DAC1 V_set
15 PA5 DAC2 I_set
16 PA6 NOT CONNECTED (temp sensing on DPS5015?)
17 PA7 ADC V_out
18 PB0 ADC V_in
19 PB1 ADC I_out
20 PB2 BOOT1-GND (NOT CONNECTED on DPS5015)
21 PB10 NOT CONNECTED
22 PB11 power control on '5005 / fan control on '5015
23 GND
24 VCC
25 PB12 TFT Reset (P4.4 on DPS5015 v2.3)
26 PB13 TFT SPI SCK (P4.5 on DPS5015 v2.3)
27 PB14 TFT CS (P4.6 on DPS5015 v2.3)
28 PB15 TFT SPI MOSI (P4.7 on DPS5015 v2.3)
29 PA8 [TFT, unused?] (P4.8 on DPS5015 v2.3)
30 PA9 TX
31 PA10 RX
32 PA11 NOT CONNECTED
33 PA12 NOT CONNECTED
34 PA13 (SWDIO)
35 GND
36 VCC
37 PA14 (SWCLK)
38 PA15 not used in opendps? connected to current sense shunt and amplifier
39 PB3 not used in opendps? connected to current sense shunt and amplifier
40 PB4 button power
41 PB5 button rotary encoder
42 PB6 NOT CONNECTED
43 PB7 TFT backlight
44 BOOT0 (pull-down R12 on DPS5015)
45 PB8 rotary encoder
46 PB9 rotary encoder
47 GND
48 VCC

So that's quite a few GPIOs that are not connected but could be soldered to (pin width=0.2 mm, pitch = 0.5 mm). Four accessible pins: RX&TX, SWDIO/SWCLK. And one pin to the TFT whose usage is unclear.

Serial connector (DPS5015 V2.3, DPH5005 V1.1)

1 GND  
2 TXD PA9
3 RXD PA10
4 VCC_U5

Programming connector (DPS5015 V2.3, DPH5005 V1.1)

12345
1 VCC
2 NC
3 GND
4 SWCLK / PA14
5 SWDIO / PA13 

LCD connector (see below, also warning) 12345678

KEY connector (see below, also warning) 12345678

UI PCB V2.2

FRONT

M1            ENC
SET    TFT
M2            ON/OFF

BACK

   78
   56 (LCD PCB soldered in via pin header)
   34
   12

12345678 LCD
12345678 KEY

Warning: because of the keying of the connectors, pin order is reversed on the mainboard (i.e. leftmost pins on mainboard connectors LCD and KEY are GND (=OUT-).

LDC.1 7 PA8 [TFT, unused?] 
LDC.2 3 PB15 TFT SPI MOSI
LDC.3 1 PB14 TFT CS
LDC.4 5 PB13 TFT SPI SCK
LDC.5 6 PB12 TFT reset
LDC.6 2 VCC_U5
LDC.7 4 Backlight (PB7)
LDC.8 8 GND
KEY.1 M2
KEY.2 SET
KEY.3 M1
KEY.4 ON_OFF
KEY.5 ENCODER PUSH
KEY.6 ENCODER PHASE (via 1k resistor)
KEY.7 ENCODER PHASE
KEY.8 GND (rightmost pin as seen from plug)

The mysterious component U7 with marking "M2Y8" (DPH5005) / "M2PQ" (DPS5015) [also "M2Y8" and "M21P" in u22br' photos] next to the CPU on DPS5015 and DPH5005 looks like a SOT23-5 package. It does not appear to be a MEMS oscillator (OSC_IN not connected).

U7.1 OSC_OUT (PD1)
U7.2 GND
U7.3 PA0 (ADC) 
         - RL  (10k, "01C")
U7.4 VCC
U7.5 GND

opendps initializes these as PA0 GPIO_CNF_OUTPUT_OPENDRAIN PA6 - PD1 GPIO_CNF_OUTPUT_PUSHPULL but it appears they are not actively used.

This dump (15V-on.txt from https://github.com/kanflo/opendps/issues/50#issuecomment-429578505) of a DPS5015 PCB revision V2.3 does this:

PA0 GPIO_CNF_OUTPUT_OPENDRAIN PA6 GPIO_CNF_INPUT_ANALOG PD1 GPIO_CNF_OUTPUT_PUSHPULL

Voltages at room temperature U7.1 PD1 3.3 U7.2 GND
U7.3 PA0 3.3 U7.4 VCC 3.3 U7.5 GND

RL - R29 3.3
PA6 (ADC) 1.78

Forcing PA6 to 3.3 V does not start the fan - forcing it to GND does!

Suspected component values: RT1 - 10k (room temp) R29 - 9k6 ("01C")

It's a simple resistor divider with PA6 measuring across the NTC:

VCC - R29 + RT1 - GND
PA6 (ADC) + 

Is U7 a voltage reference and might PD1 be used to enable it?

Command to clear PD1 (OSC_OUT alternate function remap PD1 via AFIO MAPR): GPIOD_BASE = 0x40011400 GPIOx_ODR = 0x0c

Confirmed with script output:

>>>> gpiod
GPIOD settings
...
ODR      : 0x00000002  [0x4001140c]

So we just need to write zero to 0x4001140c: opendps$ ./ocd-client.py w 0x4001140c 0

Despite PD1 going low, the suspected output U7.3 does not change (3.3 V).

PA0 could be used for a reference measurement, as the LQFP48 package does not have VREF but probably uses VDDA as ADC reference.

Also, I have some "register dumps": DPS5015_HW2.3_FW1.6_5V1A_off_fan_on.txt DPS5015_HW2.3_FW1.6_10V1A_on.txt DPS5015_HW2.3_FW1.6_5V_off.txt DPS5015_HW2.3_FW1.6_5V1A_on.txt

And a view with the CPU pinout overlay: stm32f100c8_crop

gnbl avatar Dec 02 '18 11:12 gnbl

Even if U7 was supposed to be used as voltage reference, the stock firmware does not use it to calibrate the ADC. If the supply voltage drops, the module input voltage reading is much higher (19 V for 12 V at 1.9V VCC).

gnbl avatar Dec 02 '18 16:12 gnbl

I am now looking at the DPS5015 that @wangxiatao kindly sent me. For the DPS5015 folks out there, what output is generally needed to make the stock firmware turn the fan on? I can control it as expected via PB11 but if there are ways of setting the speed I would like to get register dumps before wiping the stock firmware.

kanflo avatar Dec 14 '18 19:12 kanflo