• Hello ES! We could use some help to get us past the finish line on building the new knowledgebase for the forum.
    Can you donate? Please see our fundraising page. Thank you!

Kunteng controller programming pins

basssignal

New here
Joined
Jul 24, 2021
Messages
5
Hi all, could someone please show me the pads used to program the STM chip. I can't find a pic online. It's a kte-6sc board. Thanks
 

Attachments

  • IMG_20260706_151917.jpg
    IMG_20260706_151917.jpg
    3.6 MB · Views: 4
Normally the schematics were on the KT open source firmware wiki, but it's no longer there

Strange because it was there a year ago when I tinkered with this. Maybe because the corresponding bitbucket got deleted

Maybe browse through the beginning of this huge thread

Or perhaps someone remembers of the order of pins. But there are normally 4 holes in a row, I think power and ground might have been the first and the third but I am not too certain...
 
I got it all setup, but getting this error. Just incase anyone is reading :) I am using a LCD03. Getting the same errors with the Java tool

C:\BMSBattery_S_controllers_firmware-Master>PATH = C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Python\Python310\Scripts\;C:\Python\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files (x86)\dotnet\;C:\Users\John\AppData\Local\Microsoft\WindowsApps;C:\Users\John\.dotnet\tools;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:\BMSBattery_S_controllers_firmware-Master>REM ;C:\BMSBattery_S_controllers_firmware-Master\tools\cygwin\bin

C:\BMSBattery_S_controllers_firmware-Master>cd C:\BMSBattery_S_controllers_firmware-Master\

C:\BMSBattery_S_controllers_firmware-Master>del main.hex
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\main.hex

C:\BMSBattery_S_controllers_firmware-Master>sdcc --version
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/r4k/r5k/r6k/sm83/tlcs90/ez80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8/f8l TD- 4.6.0 #16555 (MINGW64)
published under GNU General Public License (GPL)

C:\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows clean
echo "Cleaning files..."
"Cleaning files..."
cmd /C del *.asm
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.asm
cmd /C del *.rel
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.rel
cmd /C del *.lk
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.lk
cmd /C del *.lst
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.lst
cmd /C del *.rst
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.rst
cmd /C del *.sym
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.sym
cmd /C del *.cdb
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.cdb
cmd /C del *.map
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.map
cmd /C del *.adb
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.adb
echo "Done."
"Done."

C:\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oBOdisplay.c BOdisplay.c
uart.h:22: warning 283: function declarator with no prototype
BOdisplay.h:176: warning 283: function declarator with no prototype
BOdisplay.h:177: warning 283: function declarator with no prototype
main.h:43: warning 283: function declarator with no prototype
BOdisplay.c:582: warning 283: function declarator with no prototype
BOdisplay.c:586: warning 283: function declarator with no prototype
BOdisplay.c:603: warning 283: function declarator with no prototype
BOdisplay.c:620: warning 283: function declarator with no prototype
BOdisplay.c:624: warning 283: function declarator with no prototype
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAcontrollerState.c ACAcontrollerState.c
main.h:43: warning 283: function declarator with no prototype
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAeeprom.c ACAeeprom.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAsetPoint.c ACAsetPoint.c
main.h:43: warning 283: function declarator with no prototype
ACAsetPoint.c:61: warning 283: function declarator with no prototype
ACAsetPoint.c:70: warning 283: function declarator with no prototype
ACAsetPoint.c:83: warning 283: function declarator with no prototype
adc.h:27: error 328: inline function adc_trigger declared with external linkage, but not defined in translation unit
make: *** [ACAsetPoint.rel] Error 1

C:\BMSBattery_S_controllers_firmware-Master>ren main.ihx main.hex
The system cannot find the file specified.

C:\BMSBattery_S_controllers_firmware-Master>make -f Makefile_windows clean
echo "Cleaning files..."
"Cleaning files..."
cmd /C del *.asm
cmd /C del *.rel
cmd /C del *.lk
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.lk
cmd /C del *.lst
cmd /C del *.rst
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.rst
cmd /C del *.sym
cmd /C del *.cdb
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.cdb
cmd /C del *.map
Could Not Find C:\BMSBattery_S_controllers_firmware-Master\*.map
cmd /C del *.adb
echo "Done."
"Done."

C:\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
(API) ERROR : No such file or directory

C:\BMSBattery_S_controllers_firmware-Master>pause
Press any key to continue . . .
 
adc.h:27: error 328: inline function adc_trigger declared with external linkage, but not defined in translation unit
make: *** [ACAsetPoint.rel] Error 1
It looks like it couldn't compile. Idk why.

Approximately a year ago I tried the torque from X4 branch (superior to the master branch in speed and allegedly in lack of glitching) GitHub - stancecoke/BMSBattery_S_controllers_firmware at Torque_from_X4

And this branch which has updated and aggregated code and LCD8 support

Both compiled no problem. Perhaps double check that you followed all the software instructions correctly...
 
Thanks Alex, i tried the X4 Branch but still experiencing issues. Attached the java setup.


C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>PATH = C:\Program Files (x86)\Common Files\Oracle\Java\java8path;C:\Program Files (x86)\Common Files\Oracle\Java\javapath;C:\Program Files (x86)\STMicroelectronics\st_toolset\asm;C:\Python\Python310\Scripts\;C:\Python\Python310\;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\System32\OpenSSH\;C:\Program Files\PuTTY\;C:\Program Files (x86)\dotnet\;C:\Users\John\AppData\Local\Microsoft\WindowsApps;C:\Users\John\.dotnet\tools;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:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>REM ;C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\tools\cygwin\bin

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>cd C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>del main.hex
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\main.hex

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>sdcc --version
SDCC : mcs51/z80/z180/r2k/r2ka/r3ka/r4k/r5k/r6k/sm83/tlcs90/ez80/z80n/r800/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8/pdk13/pdk14/pdk15/mos6502/mos65c02/f8/f8l TD- 4.6.0 #16555 (MINGW64)
published under GNU General Public License (GPL)

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>make -f Makefile_windows clean
echo "Cleaning files..."
"Cleaning files..."
cmd /C del *.asm
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.asm
cmd /C del *.rel
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.rel
cmd /C del *.lk
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.lk
cmd /C del *.lst
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.lst
cmd /C del *.rst
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.rst
cmd /C del *.sym
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.sym
cmd /C del *.cdb
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.cdb
cmd /C del *.map
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.map
cmd /C del *.adb
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.adb
echo "Done."
"Done."

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>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 -oBOdisplay.c BOdisplay.c
uart.h:22: warning 283: function declarator with no prototype
BOdisplay.h:176: warning 283: function declarator with no prototype
BOdisplay.h:177: warning 283: function declarator with no prototype
main.h:43: warning 283: function declarator with no prototype
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAcontrollerState.c ACAcontrollerState.c
main.h:43: warning 283: function declarator with no prototype
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAeeprom.c ACAeeprom.c
sdcc -c -IStdPeriphLib/inc -I. -mstm8 --std-c99 --nolospre --out-fmt-ihx --debug -oACAsetPoint.c ACAsetPoint.c
main.h:43: warning 283: function declarator with no prototype
ACAsetPoint.c:61: warning 283: function declarator with no prototype
ACAsetPoint.c:70: warning 283: function declarator with no prototype
ACAsetPoint.c:83: warning 283: function declarator with no prototype
adc.h:27: error 328: inline function adc_trigger declared with external linkage, but not defined in translation unit
make: *** [ACAsetPoint.rel] Error 1

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>ren main.ihx main.hex
The system cannot find the file specified.

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>make -f Makefile_windows clean
echo "Cleaning files..."
"Cleaning files..."
cmd /C del *.asm
cmd /C del *.rel
cmd /C del *.lk
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.lk
cmd /C del *.lst
cmd /C del *.rst
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.rst
cmd /C del *.sym
cmd /C del *.cdb
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.cdb
cmd /C del *.map
Could Not Find C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4\*.map
cmd /C del *.adb
echo "Done."
"Done."

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>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
(API) ERROR : No such file or directory

C:\KT\BMSBattery_S_controllers_firmware-Torque_from_X4\BMSBattery_S_controllers_firmware-Torque_from_X4>pause
Press any key to continue . . .
 

Attachments

  • Setup.PNG
    Setup.PNG
    79.5 KB · Views: 1
adc.h:27: error 328: inline function adc_trigger declared with external linkage, but not defined in translation unit
I guess you have to delete the "inline" in this line of code.
The recent version of SDCC seems to be more strict in throwing warnings and errors...

You could try to use an older version of SDCC also.
 
Last edited:
Eureka! its compiling now. The issue appeared to be the SDCC version i was using. I installed v4.1.0 x64 and it didn't work, i then installed v4.1.0 RC1 and it compiles fine without errors and the hex uploads to the STM08 no problem now :)

The LCD03 switches on ok but no throttle or PAS. Its a sine KT36/48SVPR-GLT03.

36V battery (42V when charged), Bafang 250W motor, with 3 phase, 5 hall connected. External speed sensor installed. The original firmware worked ok but my aim was simply to get off-road and road compliant modes using the brake morse code.

My settings attached, Can anyone spot anything wrong in my config? Do i need to reset the LCD03 to factory default?

Using Stancecoke x4 build.

Thanks
 

Attachments

  • Setup_x4.PNG
    Setup_x4.PNG
    81.4 KB · Views: 1
Last edited:
Back
Top