Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
chri27.5   10 mW

10 mW
Posts: 33
Joined: Jan 25 2019 9:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by chri27.5 » Jan 03 2020 3:20pm

chri27.5 wrote:
Jan 03 2020 3:19pm
chri27.5 wrote:
Jan 03 2020 3:13pm
Elinx wrote:
Jan 03 2020 8:25am
famichiki wrote:
Jan 03 2020 7:12am
.....
I have a better understanding now and edited my previous post to explain the issues that can occur...
What do you think. Is it possible that a hardware sensor calibration could help?
imho you can get a lower zero point, but the range you can't change.
Hi Elinx,
I just made the calibration of the hardware sensor, thanks to Mbrusa I was able to read the ADC values, when empty it read 49.2 and 62.1 with the maximum force applied on the crank in a horizontal position, this calibration I did because having a reading field very narrow the engine had a bad performance, it could only be used in sport / turbo.
After calibration the no-load values ​​are 25.0 and 65.0 with maximum applied force.
I highly recommend you to calibrate it because after calibration the engine works perfectly, now I can use all 4 assistance levels without any problem
Attachments
S00103-211549.jpg
S00103-211549.jpg (248.42 KiB) Viewed 1783 times
S00103-211605.jpg
S00103-211605.jpg (186.63 KiB) Viewed 1783 times

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 03 2020 4:44pm

chri27.5 wrote:
Jan 03 2020 3:20pm
......made the calibration of the hardware sensor, thanks to Mbrusa I was able to read the ADC values, ......
..... after calibration the engine works perfectly,.......
Ciao chri27.5,
I had seen your review already on jobike and I am happy for you that the calibration was successful, so the bike works as you expect. Thanks for the update on ES too.

I haven't yet tried the mbrusa mods. I am satified with how the tsdz2 works, but will do at least some measurements, to see if some improvement is needed or not.
I have two exactly the same bikes (from my wife and me) with the same configurations and imho, in contrast to your situation, both are working the same.

I was responsing on the problem Famichiki has with the torque sensitivity he has, because except that the sensor has an offset, the range is also much larger. With hardware calibration you only can regulate the offset. I hope that Famichiki can solve this too.

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Jan 04 2020 8:26am

I've built a new "empty" Java configuation tool prototype with two tabs for parameter definitions.
I added the .form file to the repo too, so it is very easy to edit the graphical elements on the program interface by drag and drop with the netbeans IDE.

https://github.com/stancecoke/BMSBatter ... urator/src

regards
stancecoke
NetbeansDesktop.PNG
NetbeansDesktop.PNG (144.83 KiB) Viewed 1740 times
ConfiguratorPrototype at runtime.PNG
ConfiguratorPrototype at runtime.PNG (27.5 KiB) Viewed 1740 times

famichiki   100 W

100 W
Posts: 130
Joined: Jul 12 2019 9:00am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by famichiki » Jan 04 2020 11:17am

stancecoke wrote:
Jan 04 2020 8:26am
I've built a new "empty" Java configuation tool prototype with two tabs for parameter definitions.
Looks perfect for separating basic and advanced settings. I like the one-step compile & flash button too. :thumb:

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Jan 04 2020 1:04pm

famichiki wrote:
Jan 04 2020 11:17am
I like the one-step compile & flash button too. :thumb:
The one step compiling+flashing is no matter of the GUI but of the batch files.

After some trials: :D
As marcoq deletes the config.h after compiling, you have to call the configurator_program.bat from the configurator_compile.bat

Code: Select all

@echo off
PATH = %PATH%;C:\SDCC\usr\local\bin;%~dp0..\..\tools\cygwin\bin

make -f Makefile_ihx_windows clean
if errorlevel == 1 goto FAIL

:: pass batch file parameters, e.g. THROTTLE=0
make -f Makefile_ihx_windows %*
if errorlevel == 1 goto FAIL

configurator_program.bat

:PASS
goto EXIT
:FAIL
pause
:EXIT
exit
::pause
You have to add (uncomment) the path to the STVP manually in the configurator_program.bat:

Code: Select all

@echo off
PATH = %PATH%;C:\Program Files (x86)\STMicroelectronics\st_toolset\stvp

STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileOption=option_no_prot.ihx -verbose -verif -no_loop
if errorlevel == 1 goto FAIL

STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data.ihx -FileOption=option_no_prot.ihx -verbose -no_loop -verif -no_warn_protect
if errorlevel == 1 goto FAIL

::STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileProg=main.ihx -FileData=data.ihx -FileOption=option_prot.ihx -verbose -no_loop -no_verif -no_warn_protect
::if errorlevel == 1 goto FAIL

:PASS
goto EXIT
:FAIL
pause
:EXIT
exit
Now it flashes the hex file automatically, if you click the complile-button in the GUI

regards
stancecoke

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by mbrusa » Jan 05 2020 1:02am

Excellent, ready to use!

Regards

thineight   100 W

100 W
Posts: 228
Joined: Oct 05 2018 3:53am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by thineight » Jan 06 2020 5:16am

Stancecoke, Just for my understanding, what is the intent of this "revised" configurator?
Having all the parameters in a text file ready to edit instead of embedded in a Java tool?

Many thanks :wink:
MTB KTM Ultra 29" - City bike DAYTONA 28"

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Jan 06 2020 6:40am

thineight wrote:
Jan 06 2020 5:16am
what is the intent of this "revised" configurator?
This is just a suggestion to help people like demion and mbrusa get started with GUI programming, especially with the drag and drop editing of graphical elements. It is very tedious to program all this purely via the source code.
thineight wrote:
Jan 06 2020 5:16am
Having all the parameters in a text file ready to edit instead of embedded in a Java tool?
The config.h is an elementary part of the source code. I have no idea why marcoq deletes it after compiling.
If you delete or comment out this lines from marcoqs java code (and build the new .jar file), you will see the content of the config.h after comipiling, too:

Code: Select all

// Delete config.h
			Files.deleteIfExists(Paths.get("src/controller/config.h"));

			// Create empty file config.h
			PrintWriter pWriter = null;
			pWriter = new PrintWriter(new BufferedWriter(new FileWriter("src/controller/config.h")));
			pWriter.println("/*\r\n"
					+ " * config.h\r\n"
					+ " *\r\n"
					+ " *  Automatically created by TSDZ2 Controller's Parameters Configurator\r\n"
					+ " *  Author: marcoq\r\n"
					+ " */\r\n"
					+ "\r\n"
					+ "#ifndef CONFIG_H_\r\n"
					+ "#define CONFIG_H_\r\n"
					+ "\r\n#endif /* CONFIG_H_ */");
			
			// Close file config.h
			if(pWriter != null)
			{
				pWriter.flush();
				pWriter.close();
			}				


regards
stancecoke

godofglow   10 mW

10 mW
Posts: 23
Joined: Oct 19 2019 2:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by godofglow » Jan 06 2020 8:15am

stancecoke wrote:
Jan 04 2020 8:26am
I've built a new "empty" Java configuation tool prototype with two tabs for parameter definitions.
I added the .form file to the repo too, so it is very easy to edit the graphical elements on the program interface by drag and drop with the netbeans IDE.

https://github.com/stancecoke/BMSBatter ... urator/src

regards
stancecoke

NetbeansDesktop.PNG

ConfiguratorPrototype at runtime.PNG
+1 :-)

godofglow   10 mW

10 mW
Posts: 23
Joined: Oct 19 2019 2:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by godofglow » Jan 06 2020 8:22am

What happend woith the Git-repo and all forks?

https://github.com/qmarco/TSDZ2-Smart-E ... 6-display/

@stancecoke:
- I saw your post in the italia forum
- Make it sense to start now a new fork (incl. a new GUI tool) based on the https://github.com/OpenSource-EBike-fir ... mart-EBike repo?

User avatar
stancecoke   100 kW

100 kW
Posts: 1165
Joined: Aug 02 2017 2:56pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by stancecoke » Jan 06 2020 8:41am

godofglow wrote:
Jan 06 2020 8:22am
What happend with the Git-repo and all forks?
The fork of ackmaniac (and your own :-)) and several others still exist.

https://github.com/AckmaniacSoftware/TS ... rk/members

If someone of the fork owners read this: Please add marcoqs java source file to your repos! Thank you!

regards
stancecoke

godofglow   10 mW

10 mW
Posts: 23
Joined: Oct 19 2019 2:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by godofglow » Jan 06 2020 8:59am

stancecoke wrote:
Jan 06 2020 8:41am
godofglow wrote:
Jan 06 2020 8:22am
What happend with the Git-repo and all forks?
The fork of ackmaniac (and your own :-)) and several others still exist.

https://github.com/AckmaniacSoftware/TS ... rk/members

If someone of the fork owners read this: Please add marcoqs java source file to your repos! Thank you!

regards
stancecoke
Who is elem01?
Makes it sense to open now a new clean repo (fork/branch from casainho) with the new beginning GUI from you?
Could be much more easier to maintain all the code for the future - or I am wrong?

maximusdm   10 W

10 W
Posts: 90
Joined: Sep 08 2018 12:51pm

Re: Tsdz2 firmware open source adapted to vlcd5

Post by maximusdm » Jan 07 2020 4:10am

chri27.5 wrote:
Jan 03 2020 3:19pm
Hi Elinx,
I just made the calibration of the hardware sensor, thanks to Mbrusa I was able to read the ADC values, when empty it read 49.2 and 62.1 with the maximum force applied on the crank in a horizontal position, this calibration I did because having a reading field very narrow the engine had a bad performance, it could only be used in sport / turbo.
After calibration the no-load values ​​are 25.0 and 65.0 with maximum applied force.
I highly recommend you to calibrate it because after calibration the engine works perfectly, now I can use all 4 assistance levels without any problem
Hi Chri27.5,
Can you please tell me how did you put back the torque sensor on the motor. I really need some details since mine is broken.
More details in here: viewtopic.php?f=28&t=79788&p=1520207#p1520207
How are you making the coil ring with springs to stay in place while you have to force add the second part of the sensor?

Thanks!

chri27.5   10 mW

10 mW
Posts: 33
Joined: Jan 25 2019 9:46am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by chri27.5 » Jan 07 2020 9:41am

maximusdm wrote:
Jan 07 2020 4:10am
chri27.5 wrote:
Jan 03 2020 3:19pm
Hi Elinx,
I just made the calibration of the hardware sensor, thanks to Mbrusa I was able to read the ADC values, when empty it read 49.2 and 62.1 with the maximum force applied on the crank in a horizontal position, this calibration I did because having a reading field very narrow the engine had a bad performance, it could only be used in sport / turbo.
After calibration the no-load values ​​are 25.0 and 65.0 with maximum applied force.
I highly recommend you to calibrate it because after calibration the engine works perfectly, now I can use all 4 assistance levels without any problem
Hi Chri27.5,
Can you please tell me how did you put back the torque sensor on the motor. I really need some details since mine is broken.
More details in here: viewtopic.php?f=28&t=79788&p=1520207#p1520207
How are you making the coil ring with springs to stay in place while you have to force add the second part of the sensor?

Thanks!
Hello,
for assembly, position the motor / bike horizontally, then put a little grease on the springs and position them in the special oval slots, then place the new ring in position.
At this point you can choose two ways to mount the other part of the sensor:
In the first way it takes two people, you can have the new ring held on the motor case by one person using two small tools, at this point you can push the sensor in small strokes, when the sensor arrives against the tools they must be removed and you can finish pushing until the end of the bar.

The second way is a little more annoying if you don't have anyone to help you keep the disc down, don't despair you can also mount it by being careful,
it must be put a lot of fat behind the new disk so it will remain glued for a few seconds, test first and check the adherence time, done this you will have to be quick to tap the other part of the sensor, be careful with the first one. tap verifies that everything is centered.
I succeeded in both ways without problem.

Chewy   10 mW

10 mW
Posts: 29
Joined: Jun 03 2015 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Chewy » Jan 07 2020 4:25pm

What is the latest most stable .hex file to suit 36v 350w motor?

And where can I get it from?

What is the most simple way to change my low voltage cut off?

I have 36v 350w tsdz2

Motor cuts off at 35.5v battery voltage now

I want to cut off at 29v. How do I change this simply?

Thanks

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 07 2020 4:51pm

Chewy wrote:
Jan 07 2020 4:25pm
What is the latest most stable .hex file to suit 36v 350w motor?

And where can I get it from?

The latest (v0.19Cv3.7) of marcoq
Info about other releases and configuration manual
You must start the "all in one" Java Gui "jar" file, then setup your settings, compile your personal hex file, program, done
The difference with the original OSF is that all settings must be setup before and flashed to the controller, that is why you need to compile first.


About the battery cutoff, you can set this in the Java Gui, but the real cutoff depends of the specs. of the used li-ion cells and the cut-off setting of the BMS too. Maybe 29V isn't possible.

Chewy   10 mW

10 mW
Posts: 29
Joined: Jun 03 2015 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Chewy » Jan 07 2020 5:15pm

Thanks, I need to flash using the STVP as the .Jar compiler does not work on my PC, which is why I need the latest .hex file for a stable version.


Can I just flash TDSZ2_Controller_vM0.19.C.hex file using STVP?

Thanks

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 07 2020 5:40pm

Chewy wrote:
Jan 07 2020 5:15pm
Thanks, I need to flash using the STVP as the .Jar compiler does not work on my PC, which is why I need the latest .hex file for a stable version.
You have to install the JRE runtime for running Jar files.
But it is also possible to use the methode of Demion

Edit a config.h file with notepad and compile the complete source with SDCC
If you see a picture of the java Gui, you know wich values you can write in config.h



I have attached a config.h file for the marcoq release that you can edit for your parameters that otherwise where entered in the Java Gui.
config.h
(8.32 KiB) Downloaded 39 times

Chewy   10 mW

10 mW
Posts: 29
Joined: Jun 03 2015 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Chewy » Jan 07 2020 5:59pm

Is it not possible to flash TDSZ2_Controller_vM0.19.C.hex file using STVP?

thineight   100 W

100 W
Posts: 228
Joined: Oct 05 2018 3:53am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by thineight » Jan 07 2020 6:08pm

Chewy wrote:
Jan 07 2020 5:59pm
Is it not possible to flash TDSZ2_Controller_vM0.19.C.hex file using STVP?
Once again, each hex files from marcoq and its branches (i.e. for original displays) includes the settings for the specific user.
You need to compile your own hex.. or obtain a hex files with the same settings you need for your case.
Quick question: do you have one of the original displays or one of the alternative ones (kt-lcd3, 850c, sw102)?
MTB KTM Ultra 29" - City bike DAYTONA 28"

Chewy   10 mW

10 mW
Posts: 29
Joined: Jun 03 2015 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Chewy » Jan 07 2020 6:18pm

I have the VLCD6 display.

I was under the impression that Marqoc settings suited the 36v motor?

All I really need is the original .hex file with the LVC changed to 29v (battery BMS 30v.)

The problem is I only get half range out of my battery as the motor turns off at 35.5v.

Thanks

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 07 2020 6:22pm

Chewy wrote:
Jan 07 2020 5:59pm
Is it not possible to flash TDSZ2_Controller_vM0.19.C.hex file using STVP?
Yes, but first you must compile your personal hex file with sdcc, because you can't configure the settings with the display.
These personal settings you must insert the config.h file.

That is why using the all-in-one Java Gui is easier to use, because compiling and programming is automated.

Chewy   10 mW

10 mW
Posts: 29
Joined: Jun 03 2015 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Chewy » Jan 07 2020 6:24pm

Sorry, I am very new to programming.

What personal setting would I be inserting in the config.h file?

Why cant I just use the settings in TDSZ2_Controller_vM0.19.C.hex?

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 07 2020 6:35pm

Chewy wrote:
Jan 07 2020 6:24pm
Sorry, I am very new to programming.

What personal setting would I be inserting in the config.h file?

Why cant I just use the settings in TDSZ2_Controller_vM0.19.C.hex?
Because it is unknown what the settings are inside.
You want to edit at least the support of the four levels and the power cut-off.
Normally this an easy job in the Java gui and the configurator manual, were all settings are explaned.
For that you must install JRE, SDCC and STVP
JRE runtimes for Java gui, SDCC for compiling and STVP for programming.
JRE runs automatic if you start the JAR file. SDCC and STVP are running automatic by the Java Gui. So that is realy the most easy job.

If you want to edit config.h the best way is to look at the same time to a picture of the Java Gui, so you can compare the settings with the configurator-manual and edit config.h values with notepad.
After that you copy the config.h file into the ../src/controller directory. Than you can run sequencely the compile.bat and program.bat files. For this method you need only to install SDCC and STVP.
Last edited by Elinx on Jan 08 2020 3:56am, edited 7 times in total.

Elinx   100 W

100 W
Posts: 187
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5

Post by Elinx » Jan 07 2020 6:37pm

double

Post Reply