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

honya96 said:
but looks like you are working on the website right?
No, maybe some temporary problem with bitbucket:
- https://bitbucket.org/opensourceebikefirmware/opensourceebikefirmware.bitbucket.io
- https://bitbucket.org/opensourceebikefirmware

I have the source files on my computer and I think stancecoke also has, no worry :)
 
honya96 said:
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.php?id=elektrotechnik:eek:pen_source_firmware_fuer_sxxs_ktxx_-controller

regards
stancecoke
 
casainho said:
geofft said:
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....
 
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....

index.php


regards
stancecoke
 
geofft said:
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.
 
casainho said:
geofft said:
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.
 
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)
 
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.
 
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
    Screenshot_2018-01-09-22-47-34-960x540.png
    185.6 KB · Views: 2,699
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.
 
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).
 
Basicaly it can not find anything. Thanks for your help, I am done for today.
 

Attachments

  • 20180110_000151-1536x864.jpg
    20180110_000151-1536x864.jpg
    211.1 KB · Views: 2,692
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:
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:
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:
..\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:
..\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:
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:
exit
Should be to close the window of command line.
 
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.
 
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


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:
PATH = %PATH%;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp;C:\Program Files\SDCC\bin;

regards
stancecoke
 
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.9 KB · Views: 121
Looking at your log, seems that everything did work well :)
The firmware build went well as also the flashing.
Code:
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
 
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.
 
geofft said:
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.
Later, when you write your feedback, please include what you value that you get with this firmware, comparing to original one.
 
honya96 said:
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:

Sorry, I think there's some confusion with our two java tools again. We have two Start_Compiling.bat-files. One in the firmware folder, that is used by the OSEC Parameter Configurator.jar and by eclipse, if you edit the sourcecode. This Start_Compiling.bat can be used to compile and flash just by doubleclicking it, also.

The firmware_configuration_tool.jar uses the Start_Compiling.bat file that's located in the configuration_tool/windows_scripts folder. Double clicking on this will not work properly.
So if you want to use the firmware_configuration_tool.jar, you have to edit the configuration_tool/windows_scripts/Start_Compiling.bat to avoid the immedeadly closing of the cmd-window :?

Regards
stancecoke
 
I found another way to calculate FOC_READ_ID_CURRENT_ANGLE_ADJUST.
I measured with my Q85 and Q11 motors and the values are really different:
- Q85: 143
- Q11: 114

The value measured with my Q85 gave near results by the vale I measured using the other process: 137 VS 143.

Read here: https://opensourceebikefirmware.bitbucket.io/development/Datasheets_and_application_notes--Endless-sphere.com_forum_messages--2018.01.10_-_How_to_measure_FOC_READ_ID_CURRENT_ANGLE_ADJUST.html

25-2.png
 
casainho said:
I found another way to calculate FOC_READ_ID_CURRENT_ANGLE_ADJUST.
I measured with my Q85 and Q11 motors and the values are really different:
- Q85: 143
- Q11: 114

The value measured with my Q85 gave near results by the vale I measured using the other process: 137 VS 143.

Read here: https://opensourceebikefirmware.bitbucket.io/development/Datasheets_and_application_notes--Endless-sphere.com_forum_messages--2018.01.10_-_How_to_measure_FOC_READ_ID_CURRENT_ANGLE_ADJUST.html

25-2.png

This looks like a candidate for the "Advanced Options" menu in your confiurator..... :D

Seriously though, I may actually try this sometime, I still have my old oscilloscope in the back of the shed somewhere.
 
Back
Top