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

Electric Motors and Controllers
honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 11:08 am

Casainho, at your link I cant see connection to st-link pins.

Thanks stancecoke :wink:

So first things done.
Attachments
20180109_170730-1024x576.jpg
20180109_170730-1024x576.jpg (191.67 KiB) Viewed 194 times
20180109_165218-580x1031.jpg
20180109_165218-580x1031.jpg (99.4 KiB) Viewed 194 times

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 11:10 am

honya96 wrote:
Jan 09, 2018 11:08 am
Casainho, at your link I cant see connection to st-link pins.
Then I will update with stancecoke pictures and maybe even your picutres.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 11:44 am

So, I have it connected and light is up still.

but looks like you are working on the website right?
Attachments
20180109_174146-864x1536.jpg
20180109_174146-864x1536.jpg (167.22 KiB) Viewed 192 times
20180109_174239-1024x576.jpg
20180109_174239-1024x576.jpg (113.24 KiB) Viewed 192 times

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 11:47 am

geofft wrote:
Jan 09, 2018 10:31 am
That's much better now, powers up dead on zero, maybe starts to drift a little after around 20 secs and eventually settles drifting slightly around 22 watts. Not perfect but probably near enough.
I also got on my ebike around that value. I think i8_motor_current_filtered_10b = 1, that is multiplied by two before sent to LCD. Each unit is 0.25A. So, in your case: 38V( 10S * 3.8V), 22W --> I = P / U; 22/38 = 0.58A

Maybe we could always decrement i8_motor_current_filtered_10b by 1 or 2 units, before sent to LCD.

I wounder it that 22W will not increase after you run the motor for some time, if the shunt on the controller will not change his value considerable...
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 11:51 am

honya96 wrote:
Jan 09, 2018 11:44 am
but looks like you are working on the website right?
No, maybe some temporary problem with bitbucket:
- https://bitbucket.org/opensourceebikefi ... tbucket.io
- https://bitbucket.org/opensourceebikefirmware

I have the source files on my computer and I think stancecoke also has, no worry :-)
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 09, 2018 12:06 pm

honya96 wrote:
Jan 09, 2018 11:44 am
but looks like you are working on the website right?
Perhaps you can proceed with the german tutorial, until the page on bitbucket works again:
https://www.pedelecforum.de/wiki/doku.p ... controller

regards
stancecoke

geofft
100 W
100 W
Posts: 107
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 09, 2018 12:18 pm

casainho wrote:
Jan 09, 2018 11:47 am
geofft wrote:
Jan 09, 2018 10:31 am
That's much better now, powers up dead on zero, maybe starts to drift a little after around 20 secs and eventually settles drifting slightly around 22 watts. Not perfect but probably near enough.
I also got on my ebike around that value. I think i8_motor_current_filtered_10b = 1, that is multiplied by two before sent to LCD. Each unit is 0.25A. So, in your case: 38V( 10S * 3.8V), 22W --> I = P / U; 22/38 = 0.58A

Maybe we could always decrement i8_motor_current_filtered_10b by 1 or 2 units, before sent to LCD.

I wounder it that 22W will not increase after you run the motor for some time, if the shunt on the controller will not change his value considerable...
In fact my battery is 12s so in theory the current is around 500mA. This does not agree with my ammeter (good quality multimeter) in series with the battery which shows (at idle) the current drain is actually just 180mA (for display and controller electronics, etc, etc) so it seems this 22w drain is untrue and being generated by the firmware.

I hope to do a road test tomorrow, I'll see how this looks after the motor has been run for some time.

Just for interest, the idle current drain with the stock firmware is just 90mA....
Last edited by geofft on Jan 12, 2018 1:47 am, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 09, 2018 12:27 pm

I wonder how many board version are available of the KT36. At honyas we see KTE-SVP5, yesterday mdtr from the german forum posted a photo, where the PCB is labeled with KTE-SVP7 and casainho and me have various versions labeled with KTE-6S3-xxx

Strange....

Image

regards
stancecoke

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 12:38 pm

geofft wrote:
Jan 09, 2018 12:18 pm
Just for interest, the idle current drain with the stock firmware is just 90mA....
If possible, unconnected the motor phases and compared. As you can see, they are energized on oir firmware while motor is stop -- I wounder if unbalance of phases and circuit gives that result.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 107
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 09, 2018 12:59 pm

casainho wrote:
Jan 09, 2018 12:38 pm
geofft wrote:
Jan 09, 2018 12:18 pm
Just for interest, the idle current drain with the stock firmware is just 90mA....
If possible, unconnected the motor phases and compared. As you can see, they are energized on oir firmware while motor is stop
I think you're correct because there is some slight resistance to turning the wheel at idle that the stock firmware doesn't have. Will check further tomorrow.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 1:54 pm

Looks like I have removed the original firmware but can't flash new.

How I understand, all I need to do is download firmware.rar folder, open tool and click write configuration? If so then it does not work.

Or do I have to compile by cmd and flash via st programmer? (As in old pdf instructions)

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 2:07 pm

Documentation site is now online again. Please follow the tutorial there, it has some information what happens in background of fimware configuration tool, so you can try to do it manually if the tool fails for some reason.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 4:50 pm

Cmd window should stay open so we know what happend and say on the last line that it went ok and we can close it.
Attachments
Screenshot_2018-01-09-22-47-34-960x540.png

geofft
100 W
100 W
Posts: 107
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 09, 2018 5:24 pm

Cmd window should stay open so we know what happend and say on the last line that it went ok and we can close it.
I had trouble with this too - the answer is - edit the .bat file you're trying to run (right click-edit) and put a 'pause' command on a separate line before the 'exit' command at the end. It will then do exactly what you are asking.
Last edited by geofft on Jan 10, 2018 3:55 am, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 5:37 pm

Thanks, its working :) and about the error I am getting? :D It can't find any of the file's its working with. I have the folder in C:/

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 5:50 pm

Looking at your screenshot, seems that main.bin and main.ihx does not exist and that probably means that build of firmware did fail.
Woild be great if you could look at the build script to find the commands it execute for building, then you could run that commands by yourself and see the output feedback and post here - that feedback is very clear to say what did fail in build (sometimes, something missing on config.h, due to bug on condiguration tool or some error on the firmware sources (because as you know, we have being improving it every day).
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 5:58 pm

That's allready over my head
Attachments
20180109_234427-1536x864.jpg

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 09, 2018 6:02 pm

Basicaly it can not find anything. Thanks for your help, I am done for today.
Attachments
20180110_000151-1536x864.jpg

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 09, 2018 6:11 pm

So, let's looking at the script Start_Compiling.bat. That script is called after firmware_configuration_tool generates the config.h file inside the "firmware" folder (that file has written the options that you did chose on firmware_configuration_tool) -- you can look at config.h by editing with notepad.

So, Start_Compiling.bat has the following lines which you can run on command line, one by one (you can copy-paste from here to the command line):

Code: Select all

PATH = %PATH%;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp
That seems to set the path of ST software for flashing, to be known by Windows command line.

Code: Select all

cd firmware
Let's go inside "firmware" folder!! This mean that this script should be called on the root folder from the unzip file you did download from github.

Code: Select all

..\configuration_tool\windows_scripts\make -f Makefile_windows clean
This command will "clean" any previous generated files, if any, on a previous build firmware process.

Code: Select all

..\configuration_tool\windows_scripts\make -f Makefile_windows
This one will build the firmware!! You should look at the output and see if there is any error mentioned. And copy paste and post here, so we can help you.

Code: Select all

STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -verbose -no_loop
This will use the ST software to flash the firmware file "main.ihx". That "main.ihx" file is generated on the previous build firmware process and if it failed, main.ihx does not exist and you will get something saying that file does not exist.

Code: Select all

exit
Should be to close the window of command line.
Last edited by casainho on Jan 09, 2018 6:17 pm, edited 1 time in total.
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 107
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 09, 2018 6:17 pm

Honya, best if you post the complete cmd page log. What I suggest you do:-
With the cmd log on your screen, right click on the title bar (at the top), click edit, now click 'select all'
Right click title bar again, click 'edit', then click 'copy'.
Open notepad or wordpad, right click on the page and 'paste' the contents of the cmd log. Give it a name and save it.
Post it on here as an attachment and let the guys take a look at it, they can probably point you in the right direction.

Time for bed for me too.... :)

Edit to add: Casainho, just seen your last post, I think it's very difficult to follow. Maybe best if he posts the complete cmd log and you can give him some more concise, easy to follow instructions. Leave it until tomorrow.
Last edited by geofft on Jan 10, 2018 4:03 am, edited 1 time in total.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

User avatar
stancecoke
1 kW
1 kW
Posts: 415
Joined: Aug 02, 2017 2:56 pm

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

Post by stancecoke » Jan 10, 2018 2:36 am

As far as I can see, the path to the SDCC-Folder is missing. There has to be an entry like "C:\Program Files\SDCC\bin;" in the PATH information.
Path to SDCC missing.PNG
You are asked at the installation process of SDCC if you want the installer to set it automatically.
So reinstall SDCC and make sure that the checkbox is activated at this point, then click "Next".

SDCC Setup Screen.PNG
SDCC Setup Screen.PNG (37.65 KiB) Viewed 146 times

Alternatively, you can add the path in the Start_Compiling.bat manually.
Here an example for the first line in the Start_Compiling.bat, if you have installed SDCC with the default settings on a 64bit system.

Code: Select all

PATH = %PATH%;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\Program Files\SDCC\bin;
regards
stancecoke

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 10, 2018 6:13 am

Thanks Stancecoke, looks better now, I had 20 minutes free so I tried again and copied like geofft sugested :wink: no time to chceck myself or test. will continue in 4-5 hours.
Attachments
log.txt
(10.88 KiB) Downloaded 6 times

honya96
100 W
100 W
Posts: 121
Joined: Mar 05, 2015 9:38 am
Location: Czech Republic

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

Post by honya96 » Jan 10, 2018 6:22 am

I have the start compiling. bat edited with timeout /t -1 /nobreak but It does not work with java tool. It needs to be added in the app? :shock:

casainho
100 kW
100 kW
Posts: 1144
Joined: Feb 14, 2011 2:43 pm

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

Post by casainho » Jan 10, 2018 6:33 am

Looking at your log, seems that everything did work well :-)
The firmware build went well as also the flashing.

Code: Select all

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.ihx 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
Developer of the Flexible OpenSource firmware for EBike motor controllers: https://opensourceebikefirmware.bitbucket.io/

geofft
100 W
100 W
Posts: 107
Joined: Nov 09, 2012 9:41 am
Location: Berkshire UK

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

Post by geofft » Jan 10, 2018 8:06 am

Just been out for a short test ride and have to say that the firmware is working really sweetly now, a credit to you guys. Still one or two details to tidy up but the major stuff all works well.
I don't have much time for this today but will ride some more and feedback later this week.
BBS02 V2 48v 750w, 12s lipo.
Q128H (36v 201rpm), KT36/48 20amp, LCD3, 48v 12s lipo.

Post Reply