KT motor controllers -- Flexible OpenSource firmware for BMSBattery S/Kunteng KT motor controllers (0.25kW up to 5kW)

This is the config log below



C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>PATH = C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\controller\AppData\Local\Microsoft\WindowsApps;C:\Program Files\SDCC\bin;C:\Program Files\STMicroelectronics\st_toolset\stvp;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\SDCC\usr\local\bin;C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\tools\cygwin\bin

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>del main.hex

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.7.2 #10526 (MINGW64)
published under GNU General Public License (GPL)

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows clean
Cleaning files...

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>cd stdperiphlib\src

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.asm

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.rel

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.lk
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.lk

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.lst

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.rst

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.sym

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.cdb
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.cdb

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.map
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.map

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.elf
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.elf

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.bin
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.bin

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>cd..

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib>cd..
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\*.elf
Done.

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_itc.c StdPeriphLib/src/stm8s_itc.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_clk.c StdPeriphLib/src/stm8s_clk.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_iwdg.c StdPeriphLib/src/stm8s_iwdg.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_gpio.c StdPeriphLib/src/stm8s_gpio.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_exti.c StdPeriphLib/src/stm8s_exti.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_uart2.c StdPeriphLib/src/stm8s_uart2.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_tim1.c StdPeriphLib/src/stm8s_tim1.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_tim2.c StdPeriphLib/src/stm8s_tim2.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_adc1.c StdPeriphLib/src/stm8s_adc1.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_flash.c StdPeriphLib/src/stm8s_flash.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ogpio.c gpio.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -outils.c utils.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ocruise_control.c cruise_control.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ouart.c uart.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oadc.c adc.c
adc.c:76: warning 85: in function adc_init unreferenced local variable : 'ui16_counter'
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -obrake.c brake.c
brake.c:23: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -otimers.c timers.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -opwm.c pwm.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -omotor.c motor.c
motor.c:217: warning 158: overflow in implicit constant conversion
motor.c:231: warning 158: overflow in implicit constant conversion
motor.c:244: warning 158: overflow in implicit constant conversion
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oPAS.c PAS.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oSPEED.c SPEED.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oupdate_setpoint.c update_setpoint.c
update_setpoint.c:253: warning 85: in function update_setpoint unreferenced function argument : 'setpoint_old'
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -odisplay.c display.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -odisplay_kingmeter.c display_kingmeter.c
sdcc -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug main.c StdPeriphLib/src/stm8s_itc.rel StdPeriphLib/src/stm8s_clk.rel StdPeriphLib/src/stm8s_iwdg.rel StdPeriphLib/src/stm8s_gpio.rel StdPeriphLib/src/stm8s_exti.rel StdPeriphLib/src/stm8s_uart2.rel StdPeriphLib/src/stm8s_tim1.rel StdPeriphLib/src/stm8s_tim2.rel StdPeriphLib/src/stm8s_adc1.rel StdPeriphLib/src/stm8s_flash.rel gpio.rel utils.rel cruise_control.rel uart.rel adc.rel brake.rel timers.rel pwm.rel motor.rel PAS.rel SPEED.rel update_setpoint.rel display.rel display_kingmeter.rel

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>ren main.ihx main.hex

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.hex -verbose -no_loop
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.hex in PROGRAM MEMORY image in computer
<<< Loading file succeeds

Hit 'Esc' key to abort during communication.

>>> Programming PROGRAM MEMORY
<<< Programming PROGRAM MEMORY succeeds

>>> Verifying PROGRAM MEMORY
<<< Verifying PROGRAM MEMORY succeeds

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>pause
Press any key to continue . . .
 
I'm based in the UK if anyone wants to take a crack at the controller I have I'm more than happy to post and provide beer tokens.... :D
 
Now you have chosen Ride Mode Torquesensor :shock:
Please try Mode Throttle first!!!

regards
stancecoke
 
stancecoke said:
Now you have chosen Ride Mode Torquesensor :shock:
Please try Mode Throttle first!!!

regards
stancecoke

I tried that first sorry should have posted that as the image.
 
OK, please try a much bigger value for max phase current than for max battery current.
e.g.
max battery current 400 --> max phase current 450
You have set undervoltage to 140 --> 37,8V The PWM only starts, if the recent voltage is two volts higer than the limit. So decrease the limit for a 10s battery or make sure, that the battery is almost fully charged...

regards
stancecoke
 
reset said:
I'm based in the UK if anyone wants to take a crack at the controller I have I'm more than happy to post and provide beer tokens.... :D

If it comes to that I'll do what I can to help but in the meantime let stancecoke work his magic, I'm sure he'll get you up and running.... :wink:
 
stancecoke said:
OK, please try a much bigger value for max phase current than for max battery current.
e.g.
max battery current 400 --> max phase current 450
You have set undervoltage to 140 --> 37,8V The PWM only starts, if the recent voltage is two volts higer than the limit. So decrease the limit for a 10s battery or make sure, that the battery is almost fully charged...

regards
stancecoke
Thanks again for helping but still not working. I've noticed a line in the config listing kingmeter i have the lcd 3 not sure if it makes any dif.


C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>PATH = C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\iCLS\;C:\Program Files\Intel\Intel(R) Management Engine Components\iCLS\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files\Intel\Intel(R) Management Engine Components\DAL;C:\Program Files (x86)\Intel\Intel(R) Management Engine Components\IPT;C:\Program Files\Intel\Intel(R) Management Engine Components\IPT;C:\Users\controller\AppData\Local\Microsoft\WindowsApps;C:\Program Files\SDCC\bin;C:\Program Files\STMicroelectronics\st_toolset\stvp;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\SDCC\usr\local\bin;C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\tools\cygwin\bin

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>del main.hex

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>sdcc --version
SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.7.2 #10526 (MINGW64)
published under GNU General Public License (GPL)

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows clean
Cleaning files...

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>cd stdperiphlib\src

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.asm

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.rel

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.lk
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.lk

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.lst

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.rst

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.sym

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.cdb
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.cdb

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.map
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.map

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.elf
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.elf

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>del *.bin
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src\*.bin

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib\src>cd..

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\StdPeriphLib>cd..
Could Not Find C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master\*.elf
Done.

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_itc.c StdPeriphLib/src/stm8s_itc.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_clk.c StdPeriphLib/src/stm8s_clk.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_iwdg.c StdPeriphLib/src/stm8s_iwdg.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_gpio.c StdPeriphLib/src/stm8s_gpio.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_exti.c StdPeriphLib/src/stm8s_exti.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_uart2.c StdPeriphLib/src/stm8s_uart2.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_tim1.c StdPeriphLib/src/stm8s_tim1.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_tim2.c StdPeriphLib/src/stm8s_tim2.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_adc1.c StdPeriphLib/src/stm8s_adc1.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oStdPeriphLib/src/stm8s_flash.c StdPeriphLib/src/stm8s_flash.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ogpio.c gpio.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -outils.c utils.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ocruise_control.c cruise_control.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -ouart.c uart.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oadc.c adc.c
adc.c:76: warning 85: in function adc_init unreferenced local variable : 'ui16_counter'
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -obrake.c brake.c
brake.c:23: warning 110: conditional flow changed by optimizer: so said EVELYN the modified DOG
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -otimers.c timers.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -opwm.c pwm.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -omotor.c motor.c
motor.c:217: warning 158: overflow in implicit constant conversion
motor.c:231: warning 158: overflow in implicit constant conversion
motor.c:244: warning 158: overflow in implicit constant conversion
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oPAS.c PAS.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oSPEED.c SPEED.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oupdate_setpoint.c update_setpoint.c
update_setpoint.c:253: warning 85: in function update_setpoint unreferenced function argument : 'PAS'
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -odisplay.c display.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -odisplay_kingmeter.c display_kingmeter.c
sdcc -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug main.c StdPeriphLib/src/stm8s_itc.rel StdPeriphLib/src/stm8s_clk.rel StdPeriphLib/src/stm8s_iwdg.rel StdPeriphLib/src/stm8s_gpio.rel StdPeriphLib/src/stm8s_exti.rel StdPeriphLib/src/stm8s_uart2.rel StdPeriphLib/src/stm8s_tim1.rel StdPeriphLib/src/stm8s_tim2.rel StdPeriphLib/src/stm8s_adc1.rel StdPeriphLib/src/stm8s_flash.rel gpio.rel utils.rel cruise_control.rel uart.rel adc.rel brake.rel timers.rel pwm.rel motor.rel PAS.rel SPEED.rel update_setpoint.rel display.rel display_kingmeter.rel

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>ren main.ihx main.hex

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.hex -verbose -no_loop
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Filling PROGRAM MEMORY image in computer with Blank Value
<<< Filling PROGRAM MEMORY image in computer succeeds

>>> Loading file main.hex in PROGRAM MEMORY image in computer
<<< Loading file succeeds

Hit 'Esc' key to abort during communication.

>>> Programming PROGRAM MEMORY
<<< Programming PROGRAM MEMORY succeeds

>>> Verifying PROGRAM MEMORY
<<< Verifying PROGRAM MEMORY succeeds

C:\Users\controller\Downloads\BMSBattery_S_controllers_firmware-Master\BMSBattery_S_controllers_firmware-Master>pause
Press any key to continue . . .
 
Third time: please use ride mode --> throttle and nothing else for testing!

As last option: swap through all possible Hall- and Phasewire combinations (36! :))

regards
stancecoke
 
As last option: swap through all possible Hall- and Phasewire combinations (36! :))

....having done this exercise recently I can confirm that all 36 combinations of phase/hall connection give some response from the motor. Even the 'wrong' combinations will give a juddering or stuttering action or reverse drive.

Reset: is your motor giving any response in throttle mode?

Did you test this controller with the stock firmware before flashing? If so presumably it worked ok?
 
Good day. I write badly and speak English, so I used Google translator. Recently also tried to program your controller with your firmware.
As a result, got "jerking" the engine. Until then, the engine worked well on the original firmware.
In order not to get into an embarrassing situation with a non-working controller, I decoupled the old microcontroller with the original firmware from the manufacturer and soldered in its place a new one, bought in the store. This gave me the opportunity to conduct experiments and not stay with the idle controller.
In my opinion when the wheel is behaving so badly, most likely the problem is that there is no current sensor ACS711 in the controller, it is not physically installed there. but a place to install it there.
I use a 300-watt motor with a reducer for a bicycle.
And the controller is 350 watts.
While I do not know about the solution to this problem, I want to ride a bike a bit faster than 25 km / h
 

Attachments

  • 222.jpg
    222.jpg
    120.6 KB · Views: 1,330
  • 0-008o.jpg
    0-008o.jpg
    63.7 KB · Views: 1,324
Thank you for testing our firmware and sharing your experience!
The issue with the missing phase current sensor is well known....


https://endless-sphere.com/forums/viewtopic.php?p=1315363#p1315363

https://www.pedelecforum.de/forum/index.php?threads/custom-rom-f%C3%BCr-kunteng-s06s-kt36-controller.50061/page-2#post-883410

https://www.pedelecforum.de/forum/index.php?threads/custom-rom-f%C3%BCr-kunteng-s06s-kt36-controller.50061/page-2#post-883617

https://opensourceebikefirmware.bitbucket.io/windows_instructions/index1.html

regards
stancecoke
 
geofft said:
As last option: swap through all possible Hall- and Phasewire combinations (36! :))

....having done this exercise recently I can confirm that all 36 combinations of phase/hall connection give some response from the motor. Even the 'wrong' combinations will give a juddering or stuttering action or reverse drive.

Reset: is your motor giving any response in throttle mode?

Did you test this controller with the stock firmware before flashing? If so presumably it worked ok?
Yip I tested controller and it was fine, I'm away from it at the minute but will look again on Monday when I'm back in. Thanks again for help.
 
stancecoke said:
Third time: please use ride mode --> throttle and nothing else for testing!

As last option: swap through all possible Hall- and Phasewire combinations (36! :))

regards
stancecoke

Should have some time to test this on monday will let you know how I get on. Thanks again
 
stancecoke said:
Thank you for testing our firmware and sharing your experience!
The issue with the missing phase current sensor is well known....

regards
stancecoke

Dear stancecoke, from all that has been said in these topics, I came to the conclusion that it is necessary to solder the original ACS711 current sensor, only the question arose on which current should the sensor be calculated, when the controller itself is rated at 15 amps? and a maximum of 22 amperes. Who has a good photo of this sensor? in order to see the correct marking and buy the right part for yourself.

use ACS711KEXLT-15 or ACS711KEXLT-31 for ordering according to the specification for this device?

https://www.google.com/url?sa=t&rct=j&q=&esrc=s&source=web&cd=1&ved=2ahUKEwj6-Pj_55vdAhUFXSwKHUrQA1sQFjAAegQICRAC&url=https%3A%2F%2Fwww.allegromicro.com%2F~%2Fmedia%2FFiles%2FDatasheets%2FACS711-Datasheet.ashx&usg=AOvVaw3chHIG54vSl8_E9Zr0x1RP

from what I saw on the photos of the sensor acs711, I tend to conclude that it is necessary to install a current sensor at 31 amperes. Sensitivity Sens Across full range of IP – 45 – mV/A
 
Romantas said:
from what I saw on the photos of the sensor acs711, I tend to conclude that it is necessary to install a current sensor at 31 amperes. Sensitivity Sens Across full range of IP – 45 – mV/A

As we look at the zero-crossing of the phase current only, the sensitivity is not important. As you can see in the photo linked above, Kunteng uses a ACS712 / 30A originally.

file.php


regards
stancecoke
 
stancecoke said:
As we look at the zero-crossing of the phase current only, the sensitivity is not important. As you can see in the photo linked above, Kunteng uses a ACS712 / 30A originally.

file.php


regards
stancecoke

then I can set the sensor 712 and 711 to 25-30A current so that there is no error in the current load, then the controller should normally understand the values from the sensor.
Thank you for the clarification. I will conduct tests on Monday, I will write the results.
 
]I found such a board from the module for arduino,
IMG_2018-09-03_100914_HDR.jpg
I'll attach it to the board, without changing the original controller, I'll see what will change in the work, only then I will change the microcontroller and put the open firmware.
The motor is a gear wheel, the name is on the photo.
ATTACH]

Concerned about the resistor at the output of the current chip, for 712 there is probably no 2.2 kOm resistor
IMG_2018-09-03_110750_HDR.jpg
 

Attachments

  • IMG_2018-09-03_105037.jpg
    IMG_2018-09-03_105037.jpg
    58.2 KB · Views: 1,655
Stop! As you can see easily from the layout of the solder pads, you need a ACS711 in EX-package!

https://www.digikey.de/product-detail/de/ACS711KEXLT-31AB-T/620-1482-1-ND/3868202?utm_campaign=buynow&WT.z_cid=ref_octopart_dkc_buynow&utm_medium=aggregator&curr=eur&site=us&utm_source=octopart

regards
stancecoke
 
get in my conditions this building is a long story of delivery: (
Since I know how to be good friends with a soldering iron, problems are usually solved so :)
IMG_2018-09-03_114725_HDR.jpg

on my subjective sensations, the engine began to work a little quieter after I installed the current sensor. I will look at the oscilloscope of the current sensor.

As a result of measurements on the original firmware, interesting oscillograms of the power phase were obtained. The highest speed, it's a trapezoid, all that looks like a torn sinusoid is the different speeds of the controller.
 

Attachments

  • IMG_2018-09-03_124406_HDR.jpg
    IMG_2018-09-03_124406_HDR.jpg
    84.1 KB · Views: 1,624
  • IMG_2018-09-03_124415_HDR.jpg
    IMG_2018-09-03_124415_HDR.jpg
    80.9 KB · Views: 1,624
  • IMG_2018-09-03_124424_HDR.jpg
    IMG_2018-09-03_124424_HDR.jpg
    70 KB · Views: 1,624
stancecoke said:
Third time: please use ride mode --> throttle and nothing else for testing!

As last option: swap through all possible Hall- and Phasewire combinations (36! :))

regards
stancecoke
thanks again got throttle working turns out there is a 15 sec delay after flashing before throttle responds. LCD works without any info between controller and display. No joy with PAS so any further info would be much appreciated. Many thanks again
 
Romantas said:
As a result of measurements on the original firmware, interesting oscillograms of the power phase were obtained. The highest speed, it's a trapezoid, all that looks like a torn sinusoid is the different speeds of the controller.
Thanks for checking and sharing that info. It is expected to not be a sinusoidal on the power as the speed increases because the system "draws" the phase voltage SVM patterns with less points as speed increases.
 
casainho said:
Thanks for checking and sharing that info. It is expected to not be a sinusoidal on the power as the speed increases because the system "draws" the phase voltage SVM patterns with less points as speed increases.

This oszillographs are from the stock 6-step firmware (SxxP) as far as I understand:

Romantas said:
I'll attach it to the board, without changing the original controller, I'll see what will change in the work, only then I will change the microcontroller and put the open firmware.

So there can't be any sinusodial waveform...
I'm not sure, but I think the graphs can't show the phase current, as in phase current you won't see PWM spikes as they are flatened due to the inductivity of the motor coils...
See your own documentation :wink:

I posted a LT-spice simulation of the phase current some time ago.

regards
stancecoke
 
reset said:
stancecoke said:
Third time: please use ride mode --> throttle and nothing else for testing!

As last option: swap through all possible Hall- and Phasewire combinations (36! :))

regards
stancecoke

Should have some time to test this on monday will let you know how I get on. Thanks again

Hi I'm trying to understand the delay in motor starting, just wondered if anyone has encountered it? thanks
 
reset said:
reset said:
stancecoke said:
Third time: please use ride mode --> throttle and nothing else for testing!

As last option: swap through all possible Hall- and Phasewire combinations (36! :))

regards
stancecoke

Should have some time to test this on monday will let you know how I get on. Thanks again

Hi I'm trying to understand the delay in motor starting, just wondered if anyone has encountered it? thanks

I think this issue might be phase current, just tried raising it again an it seems more consistant.
 
Back
Top