Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CC Mode #1

Closed
Cabalist opened this issue Mar 9, 2017 · 36 comments
Closed

CC Mode #1

Cabalist opened this issue Mar 9, 2017 · 36 comments

Comments

@Cabalist
Copy link
Contributor

Cabalist commented Mar 9, 2017

Any possibility of implementing Constant Current mode?

@kanflo
Copy link
Owner

kanflo commented Apr 3, 2017

I will probably not do the implementation myself as I did not use CC mode in the stock FW but I would welcome the addition in a PR.

@kanflo
Copy link
Owner

kanflo commented Apr 14, 2017

As CC has been requested and thanks to the findings in #4 might be quite easy I will try to implement it.

@kanflo
Copy link
Owner

kanflo commented Apr 17, 2017

CC is underway, those eager to try it out can have a look at the CC branch. Comments are welcome!

A long press on the "set" key toggles between the CV and CC modes, indicated on the display. TFT inversion has been scrapped.

Remote control of the CV/CC modes is still TODO.

@Cabalist
Copy link
Contributor Author

I'm just going to take this moment to say I really appreciate your work on this. It's been really great having these in our shop and the addition of constant current really rounds it out.

@kanflo
Copy link
Owner

kanflo commented Apr 17, 2017

Thanks for the kind words, appreciated!

@kanflo
Copy link
Owner

kanflo commented Apr 18, 2017

Here's the current UI for setting the current/voltage in CC mode and CV mode (obviously you cannot set the voltage in CC):

opendps-cc opendps-cv

@kanflo
Copy link
Owner

kanflo commented Apr 18, 2017

Remote control via UART in place:

dpsctl.py -d /dev/cu.usbserial-A9MXPNJB --mode cv

@kanflo
Copy link
Owner

kanflo commented Apr 20, 2017

For anyone testing: some runtime adjustments are needed to set the DHR12R2 register controlling CC. On one of my DPS:es, the displayed output current matches the multimeter while the other DPS has a positive ~100mA offset. The OpenDPS FW needs to set a low value and increase until the ADC tells us we are spot on.

@rletendu
Copy link

Great work on this project ! Was hopping someone succeed to open the way to hack those modules !
May be I missed something, but so far looking to the code and the comments for CC mode I am wondering if the CC implementation could not be improved so that it behaves like a regular DPS, meaning that moving from CV to CC could be automated in default dps control.
By default DPS starts in CV and swithes to CC if Iload > Iset. CV/CC is a dps status not a control.
Sorry if my understanding of the implementation is not correct. Awaiting for my modules to arrive and test/contribute by myself.

@kanflo
Copy link
Owner

kanflo commented Apr 24, 2017

Thanks! If someone comes up with a good name we could have three modes, CV, CC and "the mode you describe" ;) It's a bit of an extension of CV that does not cut power on case of over current events, something I personally prefer when testing new PCBs. I am however open to renaming any..all modes if someone comes up with better naming.

@nunojpg
Copy link

nunojpg commented Apr 24, 2017

Hi :) Thanks for the software. I don't have a piece of this hardware yet but when I found it I immediately searched for a open software to replace it. I've been watching the repo for a while. Eventually I will use it.

What @rletendu means is the default way a Lab power supply works. It's what "everyone" is actually expecting for a thing like this. Or I just come from a lab world...

We can start a name discussion to give to the several modes, and I provide a initial suggestion:

  • Lab(oratory) / Constant Current Limiting - Reduce voltage as required to mantain the current below the specified limit.
  • Fuse - when overloaded just switch off until reseted
  • Hiccupp - switch off and restart periodically (for example every second) until fault is removed

In all modes you set a current and voltage. OVP and OCP can be used for different scenarios and actually this hardware might not be capable of doing them as they are generally expected in a lab PS.

@kanflo
Copy link
Owner

kanflo commented Apr 24, 2017

Thanks for the suggestions. "Fuse" sounds a lot better than CV IMHO.

@rletendu
Copy link

For me a key point is to really make the difference between the operating mode requested by the user and the operating status of the power supply.
We can also define how the dps should behave when the compliance limit is reached (error mode behavior).

By default a standard lab dps is intended to be used in Force V mode and operate in CV mode when the Iload is bellow the max limit current.
When the Iload reaches the limit a regular DPS lab swithes to CC mode. But we can also provide more error mode as suggested before (fuse: swith off or periodic restart attempt).

User may want to force voltage (ForceV mode or source V mode) :

  • User set a target operating voltage and a max current limit (compliance)
  • In none error mode (Iload < Max current) status is "CV"
  • In error mode (Iload > MAx current): DPS swithes to CC mode (regular dps error mode behavior ) or fuse mode or Hiccupp, depending on the selected error mode

User may want to force current (ForceI mode or source I mode) :

  • User set a target operating current and a max voltage limit (compliance)
  • In none error mode (V < MaxVoltage) status is "CC"
  • In error mode (V > MaxVoltage): DPS swithes to CV mode (regular smu error mode behavior ) or fuse mode or Hiccupp ...

@nunojpg
Copy link

nunojpg commented Apr 25, 2017

I went to check how the factory firmware works. It seems it works as any other standard lab power supply. So V and A limits always apply, and PS works in CV if A<set point or CA if A=set point.

OVP and OCP provide the "Fuse" mode behaviour.

So in this case there is not much to discuss about "modes". About the UI I also agree that the LCD should say if it is working on CV or CA, and OVP and OCP limits should be displayed in small font if they are enabled.

Once again, as any other lab power supply does, and also as the factory firmware does. No reason to invent anything :)

@rletendu
Copy link

Agree think we should stay with a regular lab power supply dehavior for this feature. If one wants to implement other modes he could implements its own in another feature.

@avion23
Copy link

avion23 commented Jun 4, 2017

The cc branch is currently not compilable. This is the output:
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: opendps.elf section '.data' will not fit in region rom

/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region 'rom' overflowed by 1544 bytes
This is on the current cc branch at commit 24ca7a2 from Tue Apr 18 23:58:32 2017 +0200.

I've tried to investigate where the memory is lost but no success so far

@kanflo
Copy link
Owner

kanflo commented Jun 5, 2017

That's strange, 1.5kB is quite a lot. When building I end up with 5.8kB of data+bss. Could you provide some output from make -C opendps V=1 ? Additionally, could you try hacking ../libopencm3/lib/stm32/f1/stm32f100x8.ld and chang the ram section to twice the size to get though linkage and then be able to find the culprit?

@avion23
Copy link

avion23 commented Jun 5, 2017

Btw thanks for a the effort you put into this project. Here is the verbose make output:

make -C opendps V=1
make: Entering directory '/home/avion23/Documents/programming/embedded/stm32/opendps/opendps/opendps'
Using ../libopencm3 path to library
CC ui.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o ui.o -c ui.c
CC hw.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o hw.o -c hw.c
CC pwrctl.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o pwrctl.o -c pwrctl.c
CC event.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o event.o -c event.c
CC past.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o past.o -c past.c
CC tick.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o tick.o -c tick.c
CC tft.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o tft.o -c tft.c
CC spi_driver.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o spi_driver.o -c spi_driver.c
CC ringbuf.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o ringbuf.o -c ringbuf.c
CC ili9163c.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o ili9163c.o -c ili9163c.c
CC stdio.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o stdio.o -c stdio.c
CC font-0.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o font-0.o -c font-0.c
CC font-1.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o font-1.o -c font-1.c
CC uframe.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o uframe.o -c uframe.c
CC protocol.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o protocol.o -c protocol.c
In file included from protocol.c:30:0:
protocol.c: In function 'protocol_create_status_response':
uframe.h:54:27: warning: comparison of constant '126' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:104:2: note: in expansion of macro 'PACK8'
PACK8(!!power_enabled);
^
uframe.h:54:52: warning: comparison of constant '125' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:104:2: note: in expansion of macro 'PACK8'
PACK8(!!power_enabled);
^
uframe.h:54:77: warning: comparison of constant '127' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:104:2: note: in expansion of macro 'PACK8'
PACK8(!!power_enabled);
^
protocol.c: In function 'protocol_create_lock':
uframe.h:54:27: warning: comparison of constant '126' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:122:2: note: in expansion of macro 'PACK8'
PACK8(!!locked);
^
uframe.h:54:52: warning: comparison of constant '125' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:122:2: note: in expansion of macro 'PACK8'
PACK8(!!locked);
^
uframe.h:54:77: warning: comparison of constant '127' with boolean expression is always false [-Wbool-compare]
if (((uint8_t) b) == _SOF || ((uint8_t) b) == _DLE || ((uint8_t) b) == _EOF) {
^
protocol.c:122:2: note: in expansion of macro 'PACK8'
PACK8(!!locked);
^
CC protocol_handler.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o protocol_handler.o -c protocol_handler.c
CC opendps.c
arm-none-eabi-gcc -Os -std=c99 -g -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wextra -Wshadow -Wimplicit-function-declaration -Wredundant-decls -Wmissing-prototypes -Wstrict-prototypes -fno-common -ffunction-sections -fdata-sections -I. -DCONFIG_DPS_MAX_CURRENT=15000 -DCONFIG_DEFAULT_VOUT=5000 -DCONFIG_DEFAULT_ILIMIT=500 -DCONFIG_WIFI -DCONFIG_SERIAL_PROTOCOL -MD -Wall -Wundef -DSTM32F1 -I../libopencm3/include -I../libopencm3/include/libopencm3/stm32 -I../libopencm3/include/libopencm3/cm3 -o opendps.o -c opendps.c
LD opendps.elf
arm-none-eabi-gcc --static -nostartfiles -T../libopencm3/lib/stm32/f1/stm32f100x8.ld -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wl,-Map=opendps.map -Wl,--gc-sections -L../libopencm3/lib ui.o hw.o pwrctl.o event.o past.o tick.o tft.o spi_driver.o ringbuf.o ili9163c.o stdio.o font-0.o font-1.o uframe.o protocol.o protocol_handler.o opendps.o -lopencm3_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o opendps.elf
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: opendps.elf section .data' will not fit in region rom'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 1544 bytes
collect2: error: ld returned 1 exit status
../libopencm3.rules.mk:198: recipe for target 'opendps.elf' failed
make: *** [opendps.elf] Error 1
make: Leaving directory '/home/avion23/Documents/programming/embedded/stm32/opendps/opendps/opendps'

Continuing with the rom size changed to 128K results in

make -C opendps V=1
make: Entering directory '/home/avion23/Documents/programming/embedded/stm32/opendps/opendps/opendps'
Using ../libopencm3 path to library
LD opendps.elf
arm-none-eabi-gcc --static -nostartfiles -T../libopencm3/lib/stm32/f1/stm32f100x8.ld -mthumb -mcpu=cortex-m3 -msoft-float -mfix-cortex-m3-ldrd -Wl,-Map=opendps.map -Wl,--gc-sections -L../libopencm3/lib ui.o hw.o pwrctl.o event.o past.o tick.o tft.o spi_driver.o ringbuf.o ili9163c.o stdio.o font-0.o font-1.o uframe.o protocol.o protocol_handler.o opendps.o -lopencm3_stm32f1 -Wl,--start-group -lc -lgcc -lnosys -Wl,--end-group -o opendps.elf
make: Leaving directory '/home/avion23/Documents/programming/embedded/stm32/opendps/opendps/opendps'

The resulting file is huge

ls -l opendps/opendps.elf
-rwxr-xr-x 1 avion23 users 680392 Jun 5 11:24 opendps/opendps.elf

compared to your precompiled file

ls -l precompiled/opendps.elf
-rwxr-xr-x 1 avion23 users 423771 Mar 8 21:14 precompiled/opendps.elf

I've attached the opendps folder with the *.o files etc.
compiled.zip

@kanflo
Copy link
Owner

kanflo commented Jun 5, 2017

Very odd indeed. Looking at the output of arm-none-eabi-objdump -hf for your ELF:

Idx Name          Size      VMA       LMA       File off  Algn
  0 .text         0000fc90  08000000  08000000  00010000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

and mine:

  0 .text         0000e600  08000000  08000000  00010000  2**3
                  CONTENTS, ALLOC, LOAD, READONLY, CODE

so the text segment of your binary is 5.6kb larger... I tried building with gcc 5.4.1 from ARM's developer site but did not observe the difference you see. Could you try a more recent version?

@avion23
Copy link

avion23 commented Jun 7, 2017

Oh... I think I can do even better than this. My arm-none-eabi-gcc-7.1.0 delivers:

opendps/opendps.elf: file format elf32-littlearm
architecture: arm, flags 0x00000112:
EXEC_P, HAS_SYMS, D_PAGED
start address 0x08003905`

Sections:
Idx Name Size VMA LMA File off Algn
0 .text 00015114 08000000 08000000 00010000 2**3
CONTENTS, ALLOC, LOAD, READONLY, CODE

With a fresh git clone on the main branch. The only change is 64K -> 128K in the ld file and removal of stm32-f7 target in libopencm3 as the assembler doesn't recognize this CPU.
compiled-7.1.0.zip

@Cabalist
Copy link
Contributor Author

I noticed that the branch for this feature hasn't seen an update in a bit. Is it currently functional? I see there were a couple other issues open that seem daunting for this device...

@kanflo
Copy link
Owner

kanflo commented Jun 28, 2017

@Cabalist I haven't found the time to work on CC since end of April and have a few other things I need to finish before resuming it.

@kanflo
Copy link
Owner

kanflo commented Jun 28, 2017

@avion23 It seems strange you need to clean the libopencm3 build as there should be anything else than F100 stuff included in the OpenDPS build. Could you please provide the output from the failing assembler?

@avion23
Copy link

avion23 commented Jun 29, 2017

Ah Sorry, I managed to compile it with the official ARM toolchain. No problem there. Crossdev and gcc-arm-none-eabi from debian stretch both fail.

@kanflo
Copy link
Owner

kanflo commented Jul 5, 2017

@avion23 glad you managed to sort it out.

@geekbozu
Copy link

What is the current status of this? I see there have been no updates on this for a while, and might be willing to put some work in on it.

@kanflo
Copy link
Owner

kanflo commented Oct 23, 2017

@geekbozu I have been quite restricted on time and have not worked on this for a while. My next step would be to merge the CC branch to master as they have diverged a bit.

@geekbozu
Copy link

Do you have a rough eta on when that would be? I would hate to work on new features and make the merge more complicated then it already seems to be.

@kanflo
Copy link
Owner

kanflo commented Nov 9, 2017

I am rather hoping to merge CC to master this month. We'll see...

@clickworkorange
Copy link

clickworkorange commented Dec 11, 2017

About the UI I also agree that the LCD should say if it is working on CV or CA, and OVP and OCP limits should be displayed in small font if they are enabled.

How about just changing the colour of the value that is being "constrained"? E.g. if current draw exceeds the set current - thus triggering CC mode - just change the current readout to yellow.

I am mainly interested in this project because it simplifies the display and only shows information that really matters (i.e. actual voltage, actual current draw). It would be a terrible shame if it ends up being cluttered up with every additional "feature" people can think of. In my opinion it looks fabulous just the way it is.

@snhstq
Copy link

snhstq commented Jan 15, 2018

First : Great project, love it !

I want to use a 5015 with cc to charge my calcium batteries.

When I compile master (on Raspberry Pi using arm-none-eabi) it will fit and work, but I get this message when compiling the cc tree:

****~/opendps# make -C opendps flash
make: Entering directory '/root/opendps/opendps'
LD opendps.elf
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: opendps.elf section .data' will not fit in region rom'
/usr/lib/gcc/arm-none-eabi/5.4.1/../../../arm-none-eabi/bin/ld: region `rom' overflowed by 2288 bytes
collect2: error: ld returned 1 exit status
../libopencm3.rules.mk:198: recipe for target 'opendps.elf' failed
make: *** [opendps.elf] Error 1
make: Leaving directory '/root/opendps/opendps'**
**

Any idea where I might 'find' 2288 bytes ?
I can remove the CV/CC images (2x480 bytes), but I am then still ~1200 bytes short.
Last question: where can I find a pre-complied cc for the 5015 ?

Thanks Henk

@kallemooo
Copy link

Hi @snhstq ,

The problem is that the Debian package gcc-arm-none-eabi version 15:5.4.1+svn241155-1 that provides GCC cross compiler for ARM Cortex-A/R/M processors is to old and is not usable. (gcc version 5.4.1)

Install the official toolchain from ARM and use that instead. (gcc version 7.2.1)
https://developer.arm.com/open-source/gnu-toolchain/gnu-rm/downloads

Also se issue #22 for more info.

@geekbozu
Copy link

any progress here?

@kanflo
Copy link
Owner

kanflo commented Apr 9, 2018

I am currently porting CC to master. Since the branches have diverged quite a bit it will not me a merge per-se.

@kanflo
Copy link
Owner

kanflo commented Apr 13, 2018

First chunk of CC code is now on master. I have only tested it on one unit and the CC is a bit off, calibration might be needed.

Edit: SET + rotate changes between the CV and CC modes. Any mode can easily be added.

@kanflo
Copy link
Owner

kanflo commented Oct 1, 2018

Closing this one as CC is now on master.

@kanflo kanflo closed this as completed Oct 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

9 participants