TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
It s good to find this work
as i don t need all information, i ll try first this code with a VLCD5 asap .
that s a long time i see at this thread and it s true that the original tsdz2 firmware isn t good for me .
I actually use my TSDZ2 only for VTT at 14A ( it s suffisant for me and more mean you can t use all the potential of the motor because limitations of the original firmeware ) .
Sorry my english is soo bad that i can t explain all i would like .
For the future i ll probably buy a vlcd6 if all work because i only need a display as small as possible, the only thing i need but can t have whith this kind of display is the battery Volt "on the fly", it s the only information very usefull when you ride .
as i don t need all information, i ll try first this code with a VLCD5 asap .
that s a long time i see at this thread and it s true that the original tsdz2 firmware isn t good for me .
I actually use my TSDZ2 only for VTT at 14A ( it s suffisant for me and more mean you can t use all the potential of the motor because limitations of the original firmeware ) .
Sorry my english is soo bad that i can t explain all i would like .
For the future i ll probably buy a vlcd6 if all work because i only need a display as small as possible, the only thing i need but can t have whith this kind of display is the battery Volt "on the fly", it s the only information very usefull when you ride .
RockRider 9.1 TSDZ2 open source firmware .
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
This is the Eeprom Map txt file of VLCD6 compatible project (version M0.16.0):
- stancecoke 100 kW
- Posts: 1343
- Joined: Aug 02 2017 2:56pm
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
For easy configuration we have the Java tool in the Kunteng-Project. You don't have to bother with the ST Visual programmer software. Users without programming skills can use it easily, flashing is started with one mouse-click. The Java Tool creates the config.h, that contains all user relevant settings. The user-defined settings are used at startup, if no EEPROM-values are present. You can change the EEPROM values on the fly by the BluOsec-app (only for android), if you want.marcoq wrote: ↑Dec 19 2018 5:11amIt is true that the system is not completely configurable from the display, but some parameters can only be modified using the ST Visual programmer software, I think this job can do even those who are not an experienced programmer, of course it will have to waste some time and have a little patience.
It would be quite easy to make a Java Tool, that writes the settings directly to the EEPROM, but then the user would have to do two steps, flashing the firmware and flashing the EEPROM.

regards
stancecoke
Last edited by stancecoke on Dec 19 2018 8:39am, edited 4 times in total.
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Hi stancecoke.stancecoke wrote: ↑Dec 19 2018 8:18amFor easy configuration we have the Java tool in the Kunteng-Project. You don't have to bother with the ST Visual programmer software. Users without programming skills can use it easly, flashing is started with one mouse-click. The Java Tool creates the config.h, that contains all user relevant settings. The user-defined settings are used at startup, if no EEPROM-values are present. You can change the EEPROM values on the fly by the BlueOsec-app (only for android), if you want.marcoq wrote: ↑Dec 19 2018 5:11amIt is true that the system is not completely configurable from the display, but some parameters can only be modified using the ST Visual programmer software, I think this job can do even those who are not an experienced programmer, of course it will have to waste some time and have a little patience.
regards
stancecoke
Great job! thanks for your information!



Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Hello guys!
I wonder IF the open source firmware Will still work IF i replace the inner motor of the TSDZ2 with a sensorless no hall motor?
Appreciate you input
Regards
I wonder IF the open source firmware Will still work IF i replace the inner motor of the TSDZ2 with a sensorless no hall motor?
Appreciate you input
Regards
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
I thought in improving TSDZ2 firmware to store all the variables in EEPROM so it could run without LCD, like you did. But that would be for when someone want to implement a mobile app and connect to TSDZ2 using an UART Bluetooth module.marcoq wrote: ↑Dec 19 2018 5:11amHi casainho.
Your work together with the other collaborators was excellent, my project was born for my need, I did not want to replace the original display because I did not need all the information like on the KT-LCD3.
For this reason I decided to make compatible the beautiful work you did on the motor with the original display, a need that I read by many members of the forum.
I believe that this project will not foresee major future developments, if not integrate any yours improvements to the motor management.
It is true that the system is not completely configurable from the display, but some parameters can only be modified using the ST Visual programmer software, I think this job can do even those who are not an experienced programmer, of course it will have to waste some time and have a little patience.
I simply wanted to share my need that I could have just for myself, but instead I decided to share with the "ecologist" community.
Forgive me for my english but I got help from the goole translator![]()
![]()
![]()
If you want to submit small pull requests to add that functionality, I will accept on the project. But only if the final firmware works simultaneous with or without LCD, where a data can be sent to TSDZ2 firmware to change all the configuration variables.
And yes, anyone can develop a piece of software that edits the firmware hex file and change the default values of all the configuration variables.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
I think changing the parameters allocated in eeprom even with a smartphone is a good idea. This would allow it to be independent of the display. of course there is a lot of work to do ... I do not know if any programmer in the forum has already done some apps for android or ios ... if there were he could give his contribution. For the moment ... when I have time I try to create a java interface for help user to read and write the parameters in eeprom ... this could be a starting point to achieve something more evolved. I believe that the collaboration of the various programmers of the forum can make an important contribution to the project.casainho wrote: ↑Dec 19 2018 11:56amI thought in improving TSDZ2 firmware to store all the variables in EEPROM so it could run without LCD, like you did. But that would be for when someone want to implement a mobile app and connect to TSDZ2 using an UART Bluetooth module.marcoq wrote: ↑Dec 19 2018 5:11amHi casainho.
Your work together with the other collaborators was excellent, my project was born for my need, I did not want to replace the original display because I did not need all the information like on the KT-LCD3.
For this reason I decided to make compatible the beautiful work you did on the motor with the original display, a need that I read by many members of the forum.
I believe that this project will not foresee major future developments, if not integrate any yours improvements to the motor management.
It is true that the system is not completely configurable from the display, but some parameters can only be modified using the ST Visual programmer software, I think this job can do even those who are not an experienced programmer, of course it will have to waste some time and have a little patience.
I simply wanted to share my need that I could have just for myself, but instead I decided to share with the "ecologist" community.
Forgive me for my english but I got help from the goole translator![]()
![]()
![]()
If you want to submit small pull requests to add that functionality, I will accept on the project. But only if the final firmware works simultaneous with or without LCD, where a data can be sent to TSDZ2 firmware to change all the configuration variables.
And yes, anyone can develop a piece of software that edits the firmware hex file and change the default values of all the configuration variables.



Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
You see, users do not need to flash EEPROM but only the firmware. Please implement in a way the software changes only the firmware HEX file, as the values that goes to EEPROM are the defaults values of the variables and are stored on the firmware file. This way is even simple to users.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Excuse me I probably expressed bad .... I meant that with the software will change the parameters in the program file .hex ..... and that may also correspond to the default parameters that the microcontroller writes in eeprom .... finally the user will flash the modified .hex file into microcontroller.casainho wrote: ↑Dec 19 2018 2:14pmYou see, users do not need to flash EEPROM but only the firmware. Please implement in a way the software changes only the firmware HEX file, as the values that goes to EEPROM are the defaults values of the variables and are stored on the firmware file. This way is even simple to users.
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Ok. I never worked with HEX files, but the data should be there. I think you will have no problems.marcoq wrote: ↑Dec 19 2018 2:34pmExcuse me I probably expressed bad .... I meant that with the software will change the parameters in the program file .hex ..... and that may also correspond to the default parameters that the microcontroller writes in eeprom .... finally the user will flash the modified .hex file into microcontroller.casainho wrote: ↑Dec 19 2018 2:14pmYou see, users do not need to flash EEPROM but only the firmware. Please implement in a way the software changes only the firmware HEX file, as the values that goes to EEPROM are the defaults values of the variables and are stored on the firmware file. This way is even simple to users.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Cool !! Hey I saw a picture of a fan inside the motor housing. What if we we could also initiate the fan above 75 degrees so that the motor starts cooling down and prevents it reaching 85 degrees. We could hook the fan up to the light output ?
I will raise some change requests on github
Marco I hope you can help with some of these since you have already fixed the walk mode !!
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
casainho wrote: ↑Dec 18 2018 2:09pmHere is the beta1 version for future v0.17.0. Please test and give feedback. On the next days I want to improve the wiki page for this version, as there are a lot of changes on the odometer field and they must be documented or users will not understand how to use it.
Download: https://github.com/OpenSource-EBike-fir ... 17.0-beta1
Changes:
- implemented automatic fast increase/decrease of variables on configuration menus
- settable odometer
- trip distance function
- imperial units throughout the system
- saved menu state for all menus when power down
- flashing time on menu number and variables is now short -- it is easier to see the values
This beta release of firmware for KT-LCD3 works with the same previous TSDZ2 v0.16.0 firmware version:
TSDZ2-throttle-v0.16.0.hex
TSDZ2-v0.16.0.hex
I have hit a snag straight away in the configuration menu option 0. When MPH is selected the maximum speed and wheel circumference can not be increased, they can be lowered but not raised. Also the circumference reading is reduced (2050 to 1280) when MPH is selected by I assume a conversion ratio and there is no need for this.
The battery watt meter reads high by about a factor of 10. I haven't taken it out on the road but using it on throttle and kickstand with the 52v battery supplying about 1 amp the indicated motor watts is around 500w.
Before 17.0 beta I had it working perfectly on Buba's 16.1 beta except of course his version does not have the fast variable option. I have now reverted back to Buba's 16.1 and all working perfectly again including the motor watts reading but notice if the raise or lower button is pressed continuously for a time the variable can no longer be adjusted and is freed up by coming out and re-entering the configuration menu, so perhaps your beta has a legacy fault carried over from that . I must say though that the variable fast adjust you have introduced is a great improvement.
I hope this feedback is of some help to you Casainho.
Cheers
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Hi Rafe,Rafe wrote: ↑Dec 20 2018 8:13amI have hit a snag straight away in the configuration menu option 0. When MPH is selected the maximum speed and wheel circumference can not be increased, they can be lowered but not raised. Also the circumference reading is reduced (2050 to 1280) when MPH is selected by I assume a conversion ratio and there is no need for this.
The battery watt meter reads high by about a factor of 10. I haven't taken it out on the road but using it on throttle and kickstand with the 52v battery supplying about 1 amp the indicated motor watts is around 500w.
Before 17.0 beta I had it working perfectly on Buba's 16.1 beta except of course his version does not have the fast variable option. I have now reverted back to Buba's 16.1 and all working perfectly again including the motor watts reading but notice if the raise or lower button is pressed continuously for a time the variable can no longer be adjusted and is freed up by coming out and re-entering the configuration menu, so perhaps your beta has a legacy fault carried over from that . I must say though that the variable fast adjust you have introduced is a great improvement.
I hope this feedback is of some help to you Casainho.
Cheers
Keeping it short: I am working on a version with minor bug fixes. Will be seen on GitHub soon. Planning to send a pull request to Casainho so he can look at the code. Can not promise anything but will look into the bugs you mentioned!
(Might add that I really like the new increment function!!)
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Please make pull request for small changes -- try to solve one issue at a time and make a pull request with that.
Would be great if we could improve even more this firmware.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
The Pull Request is active now so waiting for your feedback and approval, Casainho.

Have not tried to reproduce this particular bug nor solve it in this Pull Request. Trying to keep the request simple:
But will look into it!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Thanks, I will look at it tomorrow.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Casainho, I cant find the configuration howto for versions before v.17 on the wiki. It seems only .17 lcd configuration is there. Can you put the previous versions lcd configuration back in the wiki ? Or If on there can you point me to the url ? Thanks
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
There is no page for previous 0.16.
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Is there one for 0.15 ? And are the parameters the same as .16 except for assist mulitiplier ?
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Thanks. I tested and seems to solve the other bugs noted before.
I did a release of v0.17.0-beta2 and I suggest everyone try and give feedback. There is no wiki page about previous v0.16.x version but there is for this new v0.17.x version.
Download: https://github.com/OpenSource-EBike-fir ... 17.0-beta2
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
- TSDZ2 OpenSource firmware
Developer of OpenSource knowledge and technology for ebikes: Wireless Ebike boar ANT+ and Bluetooth, Flexible OpenSource firmware for EBikes: TSDZ2 mid drive motor, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.
If you like my work, please consider making a donation to help my developments: paypal.me/jorgecasa
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Hello !
Ok my STlink is working,
soo the only thing is writing the program memory with the hex file ?
Want to test marcoq improvment first before trying with LCD3 .
i don t know how modify "data memory " to make it usuable with stlink .
Sorry if my questions are " basique" but i never learn programing ...
have fun .
Ok my STlink is working,
soo the only thing is writing the program memory with the hex file ?
Want to test marcoq improvment first before trying with LCD3 .
i don t know how modify "data memory " to make it usuable with stlink .
Sorry if my questions are " basique" but i never learn programing ...
have fun .
Last edited by elem on Dec 24 2018 5:27am, edited 1 time in total.
RockRider 9.1 TSDZ2 open source firmware .
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
Hicasainho wrote: ↑Dec 23 2018 9:26amThanks. I tested and seems to solve the other bugs noted before.
I did a release of v0.17.0-beta2 and I suggest everyone try and give feedback. There is no wiki page about previous v0.16.x version but there is for this new v0.17.x version.
Download: https://github.com/OpenSource-EBike-fir ... 17.0-beta2
Nice. The previous faults on metric to imperial and fast variable set are all fixed. Setting up the configuration menu is now a doddle.

The fault I reported about the motor wattmeter reading high by a factor of 10 is still there though. I don't think I have made a mistake. I previously went back to Bubba's 16.1 from 17.0 Beta1 and took the bike on a 50 mile ride yesterday and the wattmeter was reading correctly but now I have flashed with 17.0 Beta2 it is reading 10x high again, the same as it did with 17.0 Beta1.
Thanks guys good stuff.
Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor
I was not looking at that particular bug for the latest pull request but since it is Christmas we might have a fix in version 0.17 beta-3...Rafe wrote: ↑Dec 23 2018 2:26pmNice. The previous faults on metric to imperial and fast variable set are all fixed. Setting up the configuration menu is now a doddle.![]()
The fault I reported about the motor wattmeter reading high by a factor of 10 is still there though. I don't think I have made a mistake. I previously went back to Bubba's 16.1 from 17.0 Beta1 and took the bike on a 50 mile ride yesterday and the wattmeter was reading correctly but now I have flashed with 17.0 Beta2 it is reading 10x high again, the same as it did with 17.0 Beta1.
Thanks guys good stuff.

Will make another pull request if it seems to work after my tests.
On a side note, I took the liberty to help out with the wiki for 0.17.X. Updated some text and also the menu layout.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
PayPal: leonstor at bredband.net
Drive: https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R