Friday, April 28, 2017

OpenDPS with the DPS5015


Once again, I found an awesome project via twitter, this time from Johan Kanflo via this article from hackaday folks:

http://hackaday.com/2017/03/07/open-source-firmware-for-a-cheap-programmable-power-supply/

Or more directly, Johan's blog here:

https://johan.kanflo.com/hacking-the-dps5005/

After reading the details, I promptly ordered my own device, specifically this RD DPS5015 Buck Power Supply LCD color display step-down voltage converter on eBay. This DPS is similar, but different than the one Johan used, going on the assumption that it is similar: "Although this guide is written for the ‘5005 it should work for the entire DPS family but I only have 5005s to test with."

Upon inspection, I found that the onboard processor is an 32F100C8T6B with the LQFP48 pinout using the same pin configuration as on the DPS5005 in Johan's project:



http://www.st.com/content/st_com/en/products/microcontrollers/stm32-32-bit-arm-cortex-mcus/stm32f1-series/stm32f100-value-line/stm32f100c8.html

"Medium-density devices are STM32F100x8 and STM32F100xB microcontrollers where the Flash memory density ranges between 64 and 128 Kbytes." [*1]

The [x] is a placeholder for only 1 character, not "all characters until the end, excluding the last B". The "B" in STM32F100CB means "128KB". This is not to be confused with STM32F100C8 or in the case of the DPS5015 - the STM32F100C8T6B - which are 64KB devices.

Don't confuse the 8 or B  with the trailing "B" on the end, That last B is an "Internal Code" having nothing to do with flash size.



I had OpenOCD for Windows installed via the sysprog VisualGDB app, so I used  that one:

cd C:\SysGCC\esp8266\esp8266-bsp\OpenOCD\share\openocd\scripts
openocd -f interface/stlink-v2.cfg -f target/stm32f1x.cfg

Compiling on Windows turned out to be a real pain, giving lame errors like this:

GENHDR include/libopencm3/stm32/l1/irq.json
GENHDR include/libopencm3/stm32/l4/irq.json
GENHDR include/libopencm3/vf6xx/irq.json
BUILD lib/stm32/f0
make[1]:  No rule to make target desig.o', needed byC:/workspace/libopencm3/lib/libopencm3_stm32f0.a'. Stop.
make:  [lib/stm32/f0] Error 2

https://github.com/libopencm3/libopencm3

@ChuckM over on the libopencm3 gitter:

https://gitter.im/libopencm3/

...suggested that I install the WSL

https://msdn.microsoft.com/en-us/commandline/wsl/install_guide

and so ok, once I have Ubuntu on Windows (am I the only one to find that crazy?!?! *Ubuntu* on *Windows* - wow!)... all the toolchain items need to be installed fresh. None of the Windows binaries will run. So I installed the items listed here:

https://developer.arm.com/open-source/gnu-toolchain/gnu-rm

specifically:

sudo apt-get update
sudo apt-get install binutils
sudo apt-get install gcc
sudo apt-get install gdb
sudo apt-get install make
sudo apt-get install build-essential

sudo apt-get install python
sudo apt-get install gawk

sudo apt-get install openocd


then download the GNU ARM Embedded Toolchain from:

https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads

sudo tar -xvjf gcc-arm-none-eabi-6-2017-q1-update-linux.tar.bz2

(I put mine in c:\Downloads\arm\  aka  /mnt/c/download/arm in Ubuntu window)

All this ended up needing a path like this:

export PATH="/usr/bin/Python27:/mnt/c/download/arm/gcc-arm-none-eabi-6-2017-q1-update/bin:/usr/local/bin:/usr/bin:/bin"

I ended up hosting the OpenOCD from MINGW64 bash prompt, but programming via the Ubuntu bash prompt (this is NOT a good idea). The problem is with the apparent path. When doing a "make flash" - I kept getting a "couldn't open opendps.elf" error (yet the file was there).

Doing a "pwd" from the OpenOCD telnet session revealed all!

 C:/workspace/opendps/openocd/scripts

This is despite the fact that MINGW64 sees the path as:

/c/workspace/opendps/openocd/scripts

and the Ubuntu Bash sees it as:

/mnt/c/workspace/ ...

the libopencm3.rules.mk file had this simple command for "make flash":

program $(*).elf verify reset exit
so I used a manual command in the OpenOCD telnet session:

program c:/workspace/opendps/opendps/opendps.elf verify reset

and voila! a newly programmed  DPS5015!



Other stuff:

I found a couple of nice cases on Aliexpress: this console-style and this this shelf unit style.

There's also this interesting hack that uses an Arduino to control the unit by emulating the button presses: http://www.instructables.com/id/Power-Supply-Automation-DPS5015-DP50V5A-Controlled/

The Hangzhou Ruideng Technologies Co., Ltd store can be found here:

https://rdtech.aliexpress.com/store/923042

There's also this video:



Next step: follow Johan's instructions for using ESP8266 for WiFicontrol....


*1 - page 6 of PM0063 Programming manual STM32F100xx value line Flash programming

6 comments:

  1. Would you mind posting a link to the pre-complied firmware? I have been banging my head against a wall trying to compile it on both windows an ubuntu. The author used to have a link in one of his article comment but it is down and has not seemed to be respond to comment in a while. My dps5005 is all open waiting to be flashed but I can't continue with my project without it.

    Thanks!

    ReplyDelete
    Replies
    1. I'll try to get something posted this weekend for you.

      Delete
    2. I've posted my elf file to the development branch in github for you (note first push was for the 5015, I recompiled for to 5005):

      https://github.com/gojimmypi/opendps/blob/development/opendps/opendps.elf

      Delete
    3. You sir are a gentleman and a scholar, thanks a bunch!

      Delete
  2. Replies
    1. glad to help. :) so... you were able to get it working?

      Delete

comments are welcome, but I prefer not to allow links to promotions or other unrelated services.

Find gojimmypi at gojimmypi.github.io

I'm currently working on my new blog home at  gojimmypi.github.io After implementing a variety of features such as dark mode , syntax hi...