Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Jan 25 2020 3:49am

rob42 wrote:
Jan 24 2020 10:33pm
Ive googled all afternoon, and I'm at a loss, where do I get those utilities?
See here:
https://stm8-binutils-gdb.sourceforge.io/

regards
stancecoke

rob42   1 µW

1 µW
Posts: 3
Joined: Jan 24 2020 10:25pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by rob42 » Jan 25 2020 9:51pm

Thanks, I did find that, but when I tried it I ran into all sorts of compile errors etc. I'll try again fresh and try to be more specific about errors.
Rob

wildekek   1 µW

1 µW
Posts: 3
Joined: Jan 26 2020 4:27pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by wildekek » Jan 26 2020 4:39pm

HughF wrote:
Jan 25 2020 1:57am
rob42 wrote:
Jan 24 2020 10:33pm
Hi,

I'm trying to build and install this from the cloned git repo at https://github.com/AckmaniacSoftware/TS ... D6-display. Ive been through the various pages and explanations etc. setups and dev stuff. (I'm a developer, but usually in java)

Running on ubuntu 18.04, "make -f Makefile_linux all" I get an error :

stm8-size main.elf -A
make: stm8-size: Command not found

Sure enough I dont have that or `stm8-objcopy` which follows in the script.

Ive googled all afternoon, and I'm at a loss, where do I get those utilities?

Thanks
Rob
Hi Rob, sorry I can't help (I've tried googling and seem to end up at the same brick wall as you have), but do you have a windows machine you could use for this task? I know it is admitting defeat, but sometimes you just have to use what delivers the results unfortunately. It's a trait of the electronics industry that they tend to favour Windows with their toolchains, we get it with the Ti DSP assembler we use at work, Windows only.

After faffing about with SDCC the Java Configurator works well for me and I can at least quickly and easily build and test the various motor options.

Hugh
I've just compiled the FW on OSX with the same dependency issues. It's actually pretty easy to solve.

- The makefile uses stm8-size to show the file size of the compiled binary, purely optional.
- The makefile uses stm8-objcopy to strip debug info and reformat the .elf file to a .hex file. This can be done by the SDCC compiler without these additional dependencies.

TLDR; What I'd recommend is to use this makefile:
https://github.com/AckmaniacSoftware/TS ... hx_windows

IMHO the best idea would be to make that Makefile default, not separate between linux/OSX, strip other build cruft and then upstream this in Git. TBH I need to understand a bit more about all the repo's, stakehoders, the italian forums and who is who before I put any effort into this.

rob42   1 µW

1 µW
Posts: 3
Joined: Jan 24 2020 10:25pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by rob42 » Jan 26 2020 7:39pm

Thanks for that, I found another option too. In linux (ubuntu 18.04 with SDCC 3.8 I have some related commands

sdasstm8 - -plosgffw main //manipulates symbols etc
sdldstm8 -nf main.lk //linker

I found it all worked by just running `sdldstm8 -nf main.lk` in the src/controller dir after the make process errored. Gave me a main.ihx file which flashed and worked.

HughF   100 W

100 W
Posts: 201
Joined: Jan 23 2020 6:13pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by HughF » Jan 27 2020 4:46am

rob42 wrote:
Jan 26 2020 7:39pm
Thanks for that, I found another option too. In linux (ubuntu 18.04 with SDCC 3.8 I have some related commands

sdasstm8 - -plosgffw main //manipulates symbols etc
sdldstm8 -nf main.lk //linker

I found it all worked by just running `sdldstm8 -nf main.lk` in the src/controller dir after the make process errored. Gave me a main.ihx file which flashed and worked.
Sweet, glad to hear you have a working solution.
Genesis iOiD Alfine8 Hard tail MTB, 36v TSDZ2, 13s battery, SW102 display
Raleigh reynolds road frame from the 80's, TSDZ2, SW102 display, 1x10 drivetrain, gravel tyres

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Feb 03 2020 3:28am

Mbrusa released his code for the 0.20 in the italian forum (sadly as zip-file in the forum, not as repo at github) now. Thank you mbrusa! The GUI is still missing, you have to edit the config.h manually at the moment. I wonder if all 111 (!!!) :shock: parameters need to be adjusted by the "standard user". I suggest to keep only parameters that have to be adjusted by most users in the config.h and move the "advanced settings" to the main.h (e.g.)
With about 20 parameters it would be much faster to build the adapted GUI!

regards
stancecoke

Elinx   1 kW

1 kW
Posts: 348
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Feb 03 2020 12:01pm

stancecoke wrote:
Feb 03 2020 3:28am
Mbrusa released his code for the 0.20........ The GUI is still missing, you have to edit the config.h manually at the moment. ...........
Thanks to mbrusa we have the possibility to try the v.020 beta1 for default displays.
Yes, it is without a Java Gui, so you must edit config.h
Most parameters are already useable, so edit the configurations you have to change (tyre-size, speed, battery capacity etc.)
For compiling and programming you can use the xxx_20.bat files. Hopefully Marcoq or someone else will make a Java gui later too.

For the ones that want to edit the parameters inside config.h
I have made an English Google translation of the Italian guides inside the "mb.20beta1.A" firmware file (manuals directory).
EN-Configuration-guides-TSDZ2-mb.20beta1.A.zip
(1.11 MiB) Downloaded 195 times
Last edited by Elinx on Feb 03 2020 6:07pm, edited 3 times in total.

Nfer   10 W

10 W
Posts: 83
Joined: Sep 17 2019 6:51am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Nfer » Feb 03 2020 1:03pm

How does it work with the vlcd6? It doesn't have a light button. To turn on the lights you have keep press up bottom.

Elinx   1 kW

1 kW
Posts: 348
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Feb 03 2020 1:17pm

Nfer wrote:
Feb 03 2020 1:03pm
How does it work with the vlcd6? .....
The release is just published and only tested by two users (mbrusa and chr27.5)
So every feedback will be welcome if you want to try this release.
I presume that in that case you must "press up" for confirmation of different modes.
This was the same with mbrusa v0.19C data additions too.
I advice to read at the Italian jobike forum too.

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Feb 03 2020 2:33pm

Elinx wrote:
Feb 03 2020 1:17pm
The release is just published
I've moved most parameters to the file advanced.h and started a GUI:
https://github.com/stancecoke/TSDZ2-Smart-EBike

The GUI is not working yet, it will take two more hours of work, I think...

regards
stancecoke
GUI.PNG
GUI.PNG (31.21 KiB) Viewed 2500 times

chri27.5   10 mW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by chri27.5 » Feb 03 2020 5:31pm

Elinx wrote:
Feb 03 2020 1:17pm
Nfer wrote:
Feb 03 2020 1:03pm
How does it work with the vlcd6? .....
The release is just published and only tested by two users (mbrusa and chr27.5)
So every feedback will be welcome if you want to try this release.
I presume that in that case you must "press up" for confirmation of different modes.
This was the same with mbrusa v0.19C data additions too.
I advice to read at the Italian jobike forum too.
Hi Nfer,
with vlcd6 the light button and the down button.
Attention to work well you have to hold for about two seconds.
if you need help I can make a video.

Elinx   1 kW

1 kW
Posts: 348
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Feb 03 2020 5:35pm

stancecoke wrote:
Feb 03 2020 2:33pm
.....
I've moved most parameters to the file advanced.h and started a GUI:.....
:thumb:
That start is fast done :)

chri27.5   10 mW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by chri27.5 » Feb 03 2020 5:42pm

stancecoke wrote:
Feb 03 2020 2:33pm
Elinx wrote:
Feb 03 2020 1:17pm
The release is just published
I've moved most parameters to the file advanced.h and started a GUI:
https://github.com/stancecoke/TSDZ2-Smart-EBike

The GUI is not working yet, it will take two more hours of work, I think...

regards
stancecoke

GUI.PNG
Hi Stancecoke,
I agree with you that fewer parameters are put into the Gui, the simpler it is to use for less experienced users, but to do a good job all the parameters present in config.h should be put, exactly as mBrusa did.
Thanks in advance for your contribution.

chri27.5   10 mW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by chri27.5 » Feb 03 2020 6:05pm

Elinx wrote:
Feb 03 2020 1:17pm
Nfer wrote:
Feb 03 2020 1:03pm
How does it work with the vlcd6? .....
The release is just published and only tested by two users (mbrusa and chr27.5)
So every feedback will be welcome if you want to try this release.
I presume that in that case you must "press up" for confirmation of different modes.
This was the same with mbrusa v0.19C data additions too.
I advice to read at the Italian jobike forum too.

Hi Elinx,
we have been testing this new version since December, I can tell you that the work done by mBrusa is exceptional, for my part I can say that I struggle to choose which mode to use between:
Pawer assist
Torque assist
eMtb mode
because both are fine.
I can't wait to try this version and give your feedbak.

mbrusa   100 W

100 W
Posts: 138
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Feb 04 2020 2:18am

Veramente sono 111? Non li avevo contati…
La scelta di quali parametri mettere in main.h e quali in config.h l’ho fatta e il risultato è questo!
Una GUI è comoda ma la caratteristica più importante del firmware open source è mantenere la possibilità di personalizzazione, può essere anche ibrida come stai già facendo, una scheda per i parametri indispensabili e una scheda per i parametri delle modalità di guida (6x4=24), gli altri rimanenti possono essere modificati in un file. Buon lavoro e grazie.
Io in questo momento ho poco tempo, riprenderò lo sviluppo tra 2/3 settimane.

Google translator

Hi stanceckoke, are they really 111? I hadn't counted them ...
The choice of which parameters to put in main.h and which in config.h I made and the result is this!
A GUI is convenient but the most important feature of the open source firmware is to maintain the possibility of customization, it can also be hybrid as you are already doing, a tab for the indispensable parameters and a tab for the riding mode parameters (6x4 = 24) , the rest of them can be edited in a file. Good job and thank you.
I currently have little time, I will resume development in 2/3 weeks.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Feb 04 2020 2:57am

mbrusa wrote:
Feb 04 2020 2:18am
The choice of which parameters to put in main.h and which in config.h I made and the result is this!
You are right, mixing the advanced parameters in the main.h is not a good idea. Therefore I moved them to the advanced.h. I plan to use the second button in the GUI to open the advanced.h with notepad.
If someone gets bored, he can make the advanced parameters available in the GUI :wink:
mbrusa wrote:
Feb 04 2020 2:18am
Good job and thank you.
You are welcome!

regards
stancecoke

Elinx   1 kW

1 kW
Posts: 348
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Feb 04 2020 4:25am

stancecoke wrote:
Feb 04 2020 2:57am
mbrusa wrote:
Feb 04 2020 2:18am
The choice of which parameters to put in main.h and which in config.h I made and the result is this!
..... Therefore I moved them to the advanced.h. I plan to use the second button in the GUI to open the advanced.h with notepad.
If it is always possible to edit all functions and seperate them in "basic" and "advanced" configurations, then there should be no problem for everyone.

Till there is a working Gui I have made configuration sections in the English Google translation and improve the layout a bit.
EN-Parameter-Config.h-guide-TSDZ2-mb.20beta1.A.pdf
(673.73 KiB) Downloaded 132 times

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Feb 04 2020 1:47pm

Elinx wrote:
Feb 04 2020 4:25am
Till there is a working Gui
Here you are!

The configurator works now for the basic settings. I think it is mostly self explanatory.
https://github.com/stancecoke/TSDZ2-Smart-EBike

GUI_working.PNG
GUI_working.PNG (35.74 KiB) Viewed 2363 times

For people who want to bring the advanced settings into the GUI:
You'll need approximatly 5 minutes for each advanced parameter to port.
At the moment you can set 14 parameters of 111 with the GUI :wink:
Use the netbeans IDE for development, the sourcefiles are placed in the tools-folder.

If there are very important parameters that should be in the basic settings, please tell me.

regards
stancecoke

famichiki   100 W

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by famichiki » Feb 04 2020 6:21pm

stancecoke wrote:
Feb 04 2020 1:47pm
Here you are!
When are the .ini files saved, upon compiling & flashing? Are they saved in JSON format or something proprietary?

Elinx   1 kW

1 kW
Posts: 348
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Feb 04 2020 7:33pm

stancecoke wrote:
Feb 04 2020 1:47pm
.....

The configurator works now for the basic settings. I think it is mostly self explanatory.
https://github.com/stancecoke/TSDZ2-Smart-EBike
.......

For people who want to bring the advanced settings into the GUI.......
Till then I have re-arranged the configuration guide for basic and advanced settings.
EN-Configurator -TSDZ2-mb.20beta1.A.pdf
(877.33 KiB) Downloaded 119 times

mbrusa   100 W

100 W
Posts: 138
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Feb 05 2020 1:17am

Stancecoke, there is a problem in the config.h file
#define ENABLE_RB_XH18 1
also reading the setting file, the motor type is always 48V
I will try to install Netbeans IDE
Regards
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Feb 05 2020 1:45am

mbrusa wrote:
Feb 05 2020 1:17am
there is a problem in the config.h file
I just fixed the bugs , see the last commit :-)
Please report, if it works now!

famichiki wrote:
Feb 04 2020 6:21pm
When are the .ini files saved, upon compiling & flashing? Are they saved in JSON format or something proprietary?
The .ini files are just simple text files. They content the values of the textfields and true/false for the radio buttons in the same order as in the config.h. They are written at the same time as the config.h

With the start of the GUI, the newest .ini file in the proven settings folder is loaded. So if you are satisfied with a setup, just rename the .ini file in the experimental settings folder and copy it into proven settings.

To add a new parameter to the GUI you have to
1. Install NetBeans
2. fork my repo at github, then open Netbeans and import the project from github with -->team-->git-->clone
3. double-click on TSDZ2_Configurator.java in the project explorer
4. go to the Design Tab (2)
5. Place a text field via drag and drop in the GUI (3). With right click on the new text field you can edit the default text and the variable name. Add a label for the text field by drag and drop (4).
6. switch to the source tab (2)
7. add the new parameter to the load settings function (line 101...) in the same syntax as the existing parameters

Code: Select all

TF_MAX_SPEED.setText(in.readLine());
8. add the new parameter to the action performed function (line 241...) in the same syntax as the existing parameters

Code: Select all

text_to_save = "#define WHEEL_MAX_SPEED " + TF_MAX_SPEED.getText();
iWriter.println(TF_MAX_SPEED.getText()); //writes .ini file
pWriter.println(text_to_save);  // writes config.h
TF_MAX_SPEED is the variable name in this example.

Make sure, that the parameters are in the same order in both functions!
NetbeansGUI.PNG
NetbeansGUI.PNG (308 KiB) Viewed 2261 times
To build the .jar file, right click on the project name in the project explorer and click Build. The .jar file is saved in the /dist folder

regards
stancecoke
Last edited by stancecoke on Mar 27 2020 5:43am, edited 6 times in total.

ilu   100 W

100 W
Posts: 101
Joined: Oct 18 2019 10:51am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by ilu » Feb 05 2020 5:36am

Does anyone know if it's possible to add a brake sensor to a controller which has only the 6-pin display cable? Perhaps soldering a wire on the controller and connecting that to the sensor?

Waynemarlow   1 kW

1 kW
Posts: 456
Joined: Jul 09 2016 7:22am
Location: Bucks, England

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Waynemarlow » Feb 05 2020 8:20am

ilu wrote:
Feb 05 2020 5:36am
Does anyone know if it's possible to add a brake sensor to a controller which has only the 6-pin display cable? Perhaps soldering a wire on the controller and connecting that to the sensor?
You may want to move this over to the other main thread but its already wired, its only the throttle wires which are missing. look at https://github.com/OpenSource-EBike-fir ... 2-to-TSDZ2 for the pinouts.

Waynemarlow   1 kW

1 kW
Posts: 456
Joined: Jul 09 2016 7:22am
Location: Bucks, England

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Waynemarlow » Feb 05 2020 8:37am

For some reason I'm really struggling to get the GUI to operate correctly on my PC, its probably me :) . Is there anyway we could just get one of you guys to just compile a file for the motor and make it public, sort of what Buba and Co did. It would save a lot of pain for the less computer literate who can program the motor but struggle with the GUI.

Post Reply