TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Electric Motors and Controllers
buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 02 2019 7:21pm

fi7ippo wrote:
Aug 02 2019 5:00pm
andrea_104kg wrote:
Aug 02 2019 4:20pm
fi7ippo what type of assist have you used, power, torque or cadence?
I have only read the manual ad i have not understand if it's possible to do a mix mode.... es. level 1-4 power mode, 5-6 torque, 7-8 cadence and 9 emtb
I've tested the torque mode. I think single mode + emtb at the end!
A trick for cadence calibration: You must lock the crank to the crown so that the motor rotates the pedals during calibration
Impressive that you managed to calibrate without me getting around to provide more documentation and explanations! Wanted to provide some info earlier today but have spent all my time rewriting and testing the EEPROM firmware and bug.

That is a great tip. I usually take a zip tie and temporarily lock the pedal arms to the crank so the motor can rotate the pedals at a constant RPM. Will show this procedure as soon as possible. But again, very cool that you managed and solved it!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Rydon   100 W

100 W
Posts: 237
Joined: Aug 11 2016 5:26pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by Rydon » Aug 02 2019 10:53pm

Just read the wiki config guide and have some feedback. Some of this is carried over from previous releases. The v20 guide is a good start and now having just read it I have some suggestions and questions. I hope this helps.

Questions and suggestions:
0:4 Motor power limit defaults to 0. Does "0" turn off the power? Should it default to 250?
2:0 Power assist is the same as the old assist levels?
3:0 Torque assist is a power multiplier based on just torque? PAS is not a factor? The description on this submenu should read "Torque Assist".
3:2 What does it mean "The value with which the pedal torque is multiplied with"? Perhaps this should be described as a function of max power and torque or something like that that can be understood. Perhaps the actual value should be a value that can be easily understood by this function.
4:0 Default is 5. Why not 0 or 1? Description should be Cadence Assist. Is cadence assist like a normal non-torque sensing PAS? If so then I would suggest that 4:1 value should be a percent of max power. This is easily understood and is the way Bafang does it.
5:0 Default value is 5. Why not 0 or 1?
5:1 If this value is not easily mapped to power or torque then a range should be given here so we know the range of possible values that make sense to try.
10:0 Need some recommended values and their relative effect.
10:1 Should read "submenu number 2"?
10:2 Description should read "Pedal torque conversion factor in submenu number 1"
10:3 Looking forward to cadence sensor advance mode calibration instructions. :)

The "how to use the menus" section seems to be missing a few steps so I rewrote it.

Here is the current version:

How to enter the Configuration Menu
- To enter the configuration menu: hold the UP and DOWN buttons
- To enter a sub menu: click the ON/OFF button
- To navigate between sub menus: click either the UP or DOWN button
- To exit a sub menu: hold or click the ON/OFF button
- To exit the configuration menu: hold the ON/OFF button

You may want to consider changing it to something like this:

How to Navigate the Configuration Menu:
- To enter the configuration setup menu: long-press the UP and DOWN buttons
- To navigate between menus: press either the UP or DOWN button
- To enter a menu: press the POWER button
- To navigate between submenus: press either the UP or DOWN button
- To select a submenu to change: press the POWER button
- To change a value: press either the UP or DOWN button (press and hold the UP or DOWN button to rapidly increase or decrease the value)
- To exit a submenu, menu, or configuration setup: long-press the POWER button
Note: If starting from an unknown state do a factory reset (see 0:9).

fi7ippo   10 mW

10 mW
Posts: 24
Joined: Aug 26 2018 2:29am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by fi7ippo » Aug 03 2019 4:14am

buba wrote:
Aug 02 2019 7:14pm

All this is due to the EEPROM bug. I am trying to solve this once and for all. If you want to remove all those "bugs" try this:

Step 1: Go to the Configuration Menu, Basic Setup

Step 2: Go to the "reset to default settings"

Step 3: Hold the UP button until the counter goes to 10, the screen will become blank.

Step 4 (important): Hold the ONOFF button firmly for a couple of seconds, do not accidentally click.

Step 5: After a couple of seconds you can release the ONOFF button and then power up the system as usual.

Step 6: You will have a working clean install and no more bugs!

Hello Buba, I've done that, some odometer field was fixed, many parameter was reset to factory default after step 4

Backward resistance is present (only at the boot, no more present after powering the motor)
Odometer temp "Options 8" not show (is no important I set it to temp field)

Torque factor was default 67, calibrate mine with 30kg to value 29 (menu 10 - 1)
The default assist factor is too high after reset (1x 2x 3x...) for users I think, but I notice that we have to double at least the factor of 0.19.0 for same assistance!

Thanks You!!
Last edited by fi7ippo on Aug 03 2019 5:40am, edited 1 time in total.

watanabe   1 µW

1 µW
Posts: 1
Joined: Apr 11 2019 6:06am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by watanabe » Aug 03 2019 5:07am

Hello - first off thanks to everyone involved for the great work on this project.

I have a TSDZ2 and 850c I bought specifically because of this firmware, but having some trouble flashing my 850c.

I can get the display to power on with my battery wired into the tsdz2 and the display wired to the tsdz2, but when I try to connect to it in STM32 Link-Utility, it powers down every time. I'm using an official STLink V2 if that matters.

Trying various "Connection Settings" in STM32, but problem persists

Which should I be using?
Port: JTAG or SWD, what frequency?
Access Port: Greyed out at Access port 0
Mode: "Connect Under Reset" Enable debug in low power mode checked or not
Reset Mode: Hardware reset

Is there something else I should try or change?

Rafe   10 W

10 W
Posts: 91
Joined: Oct 16 2018 5:56pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by Rafe » Aug 03 2019 6:37am

Buba do I have to sign up to google drive because all I am downloading at the moment are empty file folders?

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 7:35am

Rafe wrote:
Aug 03 2019 6:37am
Buba do I have to sign up to google drive because all I am downloading at the moment are empty file folders?
I have removed all files as I am still working on the EEPROM bug... it is giving me a hard time. Should have solved this a long time ago but it was always postponed to another release. Really need to solve this. Will update as soon as possible! I am so sorry for the inconvenience!

------------------------

Have seen some great feedback from the community and will answer as soon as the EEPROM is solved!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

Rafe   10 W

10 W
Posts: 91
Joined: Oct 16 2018 5:56pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by Rafe » Aug 03 2019 7:41am

buba wrote:
Aug 03 2019 7:35am


I have removed all files as I am still working on the EEPROM bug... it is giving me a hard time. Should have solved this a long time ago but it was always postponed to another release. Really need to solve this. Will update as soon as possible! I am so sorry for the inconvenience!

------------------------

Have seen some great feedback from the community and will answer as soon as the EEPROM is solved!
Hey no need to apologise, it is no inconvenience at all, take all the time you need and more. I just thought that perhaps I was doing something wrong on google drive as others have used the firmware already.

:bigthumb:

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 9:43am

Rafe wrote:
Aug 03 2019 7:41am
buba wrote:
Aug 03 2019 7:35am


I have removed all files as I am still working on the EEPROM bug... it is giving me a hard time. Should have solved this a long time ago but it was always postponed to another release. Really need to solve this. Will update as soon as possible! I am so sorry for the inconvenience!

------------------------

Have seen some great feedback from the community and will answer as soon as the EEPROM is solved!
Hey no need to apologise, it is no inconvenience at all, take all the time you need and more. I just thought that perhaps I was doing something wrong on google drive as others have used the firmware already.

:bigthumb:

Love this community, thanks!

Some users were faster than me and downloaded before I decided to rewrite the entire EEPROM code...! :wink:

--------------------

FINALLY! It is solved and seems to work. Just need a little more development to make it neater and try to answer and solve some of the feedback already submitted by users. But I really just need to rest for a moment before doing anything because I am exhausted and drained.

The good news is that there will be no more problems for users uploading the 0.20.0. When uploading it will automatically set to default values and there will be no strange system bugs. It will work as expected. This could be implemented in the 0.19.0 and every version before 0.19.0 but it is not worth it as we will have the 0.20.0.

This should have been solved many releases back and would have made it safer and simpler for many users. But I underestimated how important it is.

So stay tuned, more to come in a couple of hours!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

User avatar
stancecoke   100 kW

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

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by stancecoke » Aug 03 2019 11:53am

here is a quite intersting blog about the individual settable modes of a Bosch Nyon:

https://translate.google.com/translate? ... rmodi.html

All settings are multiples of human power, depending on the speed, some settings for different purposes are suggested.

Image

regards
stancecoke

Image
Last edited by stancecoke on Aug 04 2019 4:47am, edited 1 time in total.

perryscope   100 W

100 W
Posts: 104
Joined: Jan 06 2019 4:29pm
Contact:

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by perryscope » Aug 03 2019 12:04pm

buba wrote:
Aug 02 2019 8:48am
Good news and bad news! :wink:

The bad news is that all users must do a total reset when installing the 0.20.0. But for the coming updates this will hopefully not be necessary and might be the last time you need to reconfigure the entire system. Will do my best to not force anyone to reconfigure in the future. But this was such a rewrite that it was necessary.

The good news is that it is possible to download the 0.20.0 Alpha 1.0 from my Google Drive! :bolt:

I know it is still behind my original time line but believe me... it was worth it! For anyone tired of waiting I hope it will be worth the wait.

We now have the possibility to improve a lot of things from user feedback and I have looked forward to this for a long time! This version is very good for showing of the changes so we can base our discussions on something. All riding modes will be improved in one way or another but we will get to that when it is time.

There are some things to fix on the KT-LCD3 but those are esthetic issues. I have prioritized other things so we can have a version out for testing as soon as possible. One example is that some controller data will update very quickly. Such as the wattage, cadence etcetera. Will later filter this so it is much nicer in the coming Alpha.

Please be certain that everything is reset before installing 0.20.0. We do not want any surprises. So when installing the 0.20.0 make sure to erase everything! If not sure how to do that please ask and I will try to help!

Be extra careful and mindful that this update is extreme. GitHub puts it at almost 5000 lines of code and this number will be passed before a stable release... Almost constant development and testing for over a month. So be ready to brake, switch the battery off or whatever it takes to be safe. Double check that the e-brakes work and do everything possible to ensure a safe testing environment. And once again please make sure to reset everything!

I call it the Alpha 1.0 version as I think the official releases from the project GithHub page should be called Beta.

Below is the wiki that still needs more updating but should work fine for now. Read it carefully when configuring.
https://github.com/OpenSource-EBike-fir ... %7C-Manual

Here is my Google Drive:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R
Hi Buba,

I'm really keen to try 0.20.0 Alpha , but nothing on your google drive link?

I have been away for a week so a litle late to the party and catching up on the last few days of the forum, is this still available for testing?

I see a full reset is required.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

User avatar
elem   100 W

100 W
Posts: 135
Joined: May 26 2017 4:27pm
Location: alpes maritimes
Contact:

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by elem » Aug 03 2019 2:15pm

moving from V0.16 to V 0.19
use : mountain biking only
cruise disabled
boost mode disabled

KT-LCD3 and controler cleaned ( all zero ) before programming .
had a small issue programming controler ; fault on data memory error on 04000
second time without clearing with zero ; it s Ok, no fault
all pointer was at zero, no factory default programmed ...

always able to hit 700 w human power ;) seem my torque sensor is in fault

menu : 9 advanced data ( reading )
9/0 : 7
9/1 : 0
9/2 : 53 ( testing with my weight 66 kg : right 89, left 86 )
9/3 : 0
9/4 : 0
9/5 : 0
9/6 : 0
9/7 : 0
9/8 : 1 ( foc angle )

menu : 7 motor controler setup
7/0 : 3
7/1 : 550
7/2 : 4.5
7/3 : 0
7/4 : 0

menu 6 : 6/0 : 0

menu 5 main screen set up : all 1 exepted
5/7 : 0
5/8 : 0
5/10 : 5

menu 4 cruise mode : 4/0 : 0

menu 3 walk assist : 3/0 : 1
5 level used, from ; 5/1 : 25 to 5/5 : 50

menu 2 assist lvl 2/0 : 5
5 lvl configured from 2/1 : 0.3 to /0.6/0.9/1.6 to 2/5 : 2.5

menu 1 battery set up
1/0 : 15
1/1 : 34.8
1/2 : 12
1/3 : 152
1/4 :
1/5 : 0
1/6 : 50
1/7 : 570

menu 0 : km/h / 40 km/h/ 2060/ 0/ 0/ 0/ 15 mn


All work as expected, backward resistance is gone, walk assist work fine, it s good to see our cadence will pedaling ;)

waiting for a stable release with eMTB mode ;)
using also marcoq v0.19 configurator 3.6 ( on other bikes ) and i had to do many tests to find a good configuration, especialy for eMTB mode, but seem it s working fine now for my use ...

Many thanck to casainho/buba/stancoke and all other involved to the devlopment ...

sorry for my bad english, as all know, french speack strangly " english " ...

carpe diem .
RockRider 9.1 TSDZ2 open source firmware .

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 6:12pm

fi7ippo wrote:
Aug 03 2019 4:14am
Hello Buba, I've done that, some odometer field was fixed, many parameter was reset to factory default after step 4

Backward resistance is present (only at the boot, no more present after powering the motor)
Odometer temp "Options 8" not show (is no important I set it to temp field)

Torque factor was default 67, calibrate mine with 30kg to value 29 (menu 10 - 1)
The default assist factor is too high after reset (1x 2x 3x...) for users I think, but I notice that we have to double at least the factor of 0.19.0 for same assistance!

Thanks You!!
Thank YOU for the feedback, fi7ippo! Please continue!

To you and the community: Every bug is due to the EEPROM so solving the EEPROM should solve everything. I am therefore happy to report that the EEPROM is solved in the alpha 2. This bug is present in the motor controller as well but it is not noticed as the display is sending control variables every 100 ms. I do not think any firmware version before the 0.20.0 is working as expected due to this bug.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 6:17pm

stancecoke wrote:
Aug 03 2019 11:53am
here is a quite intersting blog about the individual settable modes of a Bosch Nyon:

https://translate.google.com/translate? ... rmodi.html

All settings are multiples of human power, depending on the speed, some settings for different purposes are suggested.

Image

regards
stancecoke
That is very relevant and interesting! Have not read everything but will do so when time allows. It is definitely worth to consider and adjust our riding modes accordingly.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 6:22pm

perryscope wrote:
Aug 03 2019 12:04pm
Hi Buba,

I'm really keen to try 0.20.0 Alpha , but nothing on your google drive link?

I have been away for a week so a litle late to the party and catching up on the last few days of the forum, is this still available for testing?

I see a full reset is required.
Sorry about that! Will be available shortly!

Long story short: wanted to solve a legacy bug that has been with us since dawn of time. 0.20.0 Alpha 2 has the fix and will make the installation much nicer.

To you and the community: there is a chance that this will be the last ever "force-reset". But still, I apologize for the inconvenience and hope it is okay with all things considered!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 6:31pm

elem wrote:
Aug 03 2019 2:15pm
KT-LCD3 and controler cleaned ( all zero ) before programming .
had a small issue programming controler ; fault on data memory error on 04000
second time without clearing with zero ; it s Ok, no fault
all pointer was at zero, no factory default programmed ...
That is the EEPROM bug! Sorry you had to experience it... It is solved in the 0.20.0!


elem wrote:
Aug 03 2019 2:15pm
waiting for a stable release with eMTB mode ;)
using also marcoq v0.19 configurator 3.6 ( on other bikes ) and i had to do many tests to find a good configuration, especialy for eMTB mode, but seem it s working fine now for my use ...

Many thanck to casainho/buba/stancoke and all other involved to the devlopment ...

sorry for my bad english, as all know, french speack strangly " english " ...

carpe diem .
Thank you for a wonderful post and update! Do no apologize. Merci beaucoup!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 7:22pm

Rydon wrote:
Aug 02 2019 10:53pm
Just read the wiki config guide and have some feedback. Some of this is carried over from previous releases. The v20 guide is a good start and now having just read it I have some suggestions and questions. I hope this helps.
Much appreciated and helped a lot!


Rydon wrote:
Aug 02 2019 10:53pm
0:4 Motor power limit defaults to 0. Does "0" turn off the power? Should it default to 250?
Have not had time to update the wiki but 250 W is default in firmware! And yes it does turn of the power if set to 0 W. Will update the wiki!


Rydon wrote:
Aug 02 2019 10:53pm
2:0 Power assist is the same as the old assist levels?
Yes!


Rydon wrote:
Aug 02 2019 10:53pm
3:0 Torque assist is a power multiplier based on just torque? PAS is not a factor? The description on this submenu should read "Torque Assist".
Yes and yes! PAS, or cadence sensor, is only used for sensing crank rotation. But for the actual calculation of how much current to send to the motor only the torque sensor is used.


Rydon wrote:
Aug 02 2019 10:53pm
3:2 What does it mean "The value with which the pedal torque is multiplied with"? Perhaps this should be described as a function of max power and torque or something like that that can be understood. Perhaps the actual value should be a value that can be easily understood by this function.
This is a problem that is difficult to solve. Every user has a torque sensor with different resting values, operating ranges and different levels of sensitivity. So to have some universal value that can be shared between users and easily understood we need to calibrate the torque sensor to have a common ground. Every user would be forced to calibrate the torque sensor.

One simple workaround is to simply adjust the values for your particular setup and torque sensor. Without calibration. This is much how the original firmware deals with the problem. The difference is that we are controlling the actual torque and they control the duty cycle. Which makes for a big difference in the overall experience.


Rydon wrote:
Aug 02 2019 10:53pm
4:0 Default is 5. Why not 0 or 1? Description should be Cadence Assist. Is cadence assist like a normal non-torque sensing PAS? If so then I would suggest that 4:1 value should be a percent of max power. This is easily understood and is the way Bafang does it.
Should be 0, will update! Yes, Cadence Assist is like a normal non-torque sensing mode. This is one of the riding modes I hope to improve so I am glad you mentioned it. Had one version where it was power based but did not like how it assisted. When I set 200 W of assist I did not get much help during startups. And when at speed it gave too much power. Could you test the current implementation and give some feedback and notes? Especially compared to the Bafang experience? I would love to hear more and will certainly make changes to make it as good or better than the Bafang!


Rydon wrote:
Aug 02 2019 10:53pm
5:0 Default value is 5. Why not 0 or 1?
Should be 0, will update!

Rydon wrote:
Aug 02 2019 10:53pm
5:1 If this value is not easily mapped to power or torque then a range should be given here so we know the range of possible values that make sense to try.
eMTB is like Torque Assist. But the assistance is not linear, instead: Torque ^ Some value. This is very difficult to do efficiently on this kind of hardware. Therefore there are not many values to choose from: 1, 2, 3, 4, 5, 6, 7, 8, 9 and 10. Where 10 is very sensitive and can give maximum power without much pedal torque. I would very much appreciate feedback when you get the chance!

Rydon wrote:
Aug 02 2019 10:53pm
10:0 Need some recommended values and their relative effect.
10:1 Should read "submenu number 2"?
10:2 Description should read "Pedal torque conversion factor in submenu number 1"
10:3 Looking forward to cadence sensor advance mode calibration instructions. :)

Will update! :bigthumb:


Rydon wrote:
Aug 02 2019 10:53pm
The "how to use the menus" section seems to be missing a few steps so I rewrote it.

Here is the current version:

How to enter the Configuration Menu
- To enter the configuration menu: hold the UP and DOWN buttons
- To enter a sub menu: click the ON/OFF button
- To navigate between sub menus: click either the UP or DOWN button
- To exit a sub menu: hold or click the ON/OFF button
- To exit the configuration menu: hold the ON/OFF button

You may want to consider changing it to something like this:

How to Navigate the Configuration Menu:
- To enter the configuration setup menu: long-press the UP and DOWN buttons
- To navigate between menus: press either the UP or DOWN button
- To enter a menu: press the POWER button
- To navigate between submenus: press either the UP or DOWN button
- To select a submenu to change: press the POWER button
- To change a value: press either the UP or DOWN button (press and hold the UP or DOWN button to rapidly increase or decrease the value)
- To exit a submenu, menu, or configuration setup: long-press the POWER button
Note: If starting from an unknown state do a factory reset (see 0:9).

I am working so hard with the code that the wiki and everything else is left far behind. THANK YOU, Rydon! Will copy that without feeling any shame! Will of course credit you!

EDIT: Here is an updated wiki from your suggestions and some more improvements:
https://github.com/OpenSource-EBike-fir ... %7C-Manual

-------------------------

To the community: I have acknowledged the people that have in one way or another helped with the wiki. Please let me know if I have forgotten to add anyone!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 03 2019 10:43pm

So 0.20.0 Alpha 2 is on my Google Drive and ready for testing! :wink:

To install the Alpha 2:

Step 1: Install it however you want, there is no way to mess it up. You do not even need to write zeros. Everything is taken care of.

If for any reason something looks weird I advice to go to the Basic Setup, Reset to defaults, and reset everything to default values. Just covering all possible situations here. See the wiki for more info about how to reset if it is necessary.

Will later update the EEPROM code on the motor controller so it works as well. That will make it possible to use the TSDZ2 without display. Actually, it would also be possible to configure the settings with the display connected and then just remove it when satisfied with the settings.

The last 24 hours I have worked like a mad man to take care of the EEPROM bug and get the Alpha 2 out. I tested, changed and modified well over 1000 lines of code to get it to work perfectly. Works great for me and I can only hope it will work great for the community.

My Google Drive:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R

0.20.0 wiki:
https://github.com/OpenSource-EBike-fir ... %7C-Manual

My development branch:
https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

fi7ippo   10 mW

10 mW
Posts: 24
Joined: Aug 26 2018 2:29am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by fi7ippo » Aug 04 2019 2:21am

buba wrote:
Aug 03 2019 10:43pm
So 0.20.0 Alpha 2 is on my Google Drive and ready for testing! :wink:

My Google Drive:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R

0.20.0 wiki:
https://github.com/OpenSource-EBike-fir ... %7C-Manual

My development branch:
https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc
Hi Buba I'm trying to build myself the pwm branch for modifying a value, but no luck, the program exit with a warning 126: unreachable code..
IMG_20190804_084842.jpg
IMG_20190804_084842.jpg (274 KiB) Viewed 409 times
I think I did something wrong because also the master branch of casainho exit with same warning when I try to compile it!
Use SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.8.0 #10562 (MINGW64) on win10x64

Thanks You, wonderful job!

MathiasP   1 µW

1 µW
Posts: 4
Joined: Aug 02 2019 5:26pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by MathiasP » Aug 04 2019 3:09am

1. What is the difference between Alpha 1 and Alpha 2?
2. Is there any 850C software that works with 0.20.0?

casainho   1.21 GW

1.21 GW
Posts: 3579
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Aug 04 2019 4:52am

watanabe wrote:
Aug 03 2019 5:07am
Hello - first off thanks to everyone involved for the great work on this project.

I have a TSDZ2 and 850c I bought specifically because of this firmware, but having some trouble flashing my 850c.

I can get the display to power on with my battery wired into the tsdz2 and the display wired to the tsdz2, but when I try to connect to it in STM32 Link-Utility, it powers down every time. I'm using an official STLink V2 if that matters.

Trying various "Connection Settings" in STM32, but problem persists

Which should I be using?
Port: JTAG or SWD, what frequency?
Access Port: Greyed out at Access port 0
Mode: "Connect Under Reset" Enable debug in low power mode checked or not
Reset Mode: Hardware reset

Is there something else I should try or change?
Maybe you first should validate you STLink, like trying with the motor controller.

Make sure all connections are correct, I think is probably the issue.

It is SWD and not JTAG.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

casainho   1.21 GW

1.21 GW
Posts: 3579
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by casainho » Aug 04 2019 5:00am

MathiasP wrote:
Aug 04 2019 3:09am
2. Is there any 850C software that works with 0.20.0?
Only when 0.20.0 will be released. For now it is not my priority.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 04 2019 5:53am

fi7ippo wrote:
Aug 04 2019 2:21am
buba wrote:
Aug 03 2019 10:43pm
So 0.20.0 Alpha 2 is on my Google Drive and ready for testing! :wink:

My Google Drive:
https://drive.google.com/open?id=1CPGT- ... bYtY4_JH2R

0.20.0 wiki:
https://github.com/OpenSource-EBike-fir ... %7C-Manual

My development branch:
https://github.com/leon927/TSDZ2-Smart- ... ng-pwm-acc
Hi Buba I'm trying to build myself the pwm branch for modifying a value, but no luck, the program exit with a warning 126: unreachable code..

I think I did something wrong because also the master branch of casainho exit with same warning when I try to compile it!
Use SDCC : mcs51/z80/z180/r2k/r3ka/gbz80/tlcs90/ds390/pic16/pic14/TININative/ds400/hc08/s08/stm8 3.8.0 #10562 (MINGW64) on win10x64

Thanks You, wonderful job!
You have done everything correct! That is just a warning stating that it is possible to remove one line of code as it is unreachable. This is by design :)

Compile again, the "main.ihx" file can be renamed to whatever you like and uploaded to the display or controller depending on what you are compiling. I recommend the latest SDCC to ensure you get the best possible outcome. Am happy you are changing the firmware and trying out things! Let me know if you find something good! :) Please be safe! Big thanks for your feedback!
Last edited by buba on Aug 04 2019 6:04am, edited 1 time in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 550
Joined: Aug 31 2018 12:36am

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by buba » Aug 04 2019 5:58am

MathiasP wrote:
Aug 04 2019 3:09am
1. What is the difference between Alpha 1 and Alpha 2?
2. Is there any 850C software that works with 0.20.0?
1. One bug that has been with us for a long time has left us in Alpha 2. Completely redesigned EEPROM-controller. So when installing the Alpha 2 everything should load properly and without any problem. If there is a problem for any reason it is possible to do a simple "reset to defaults" and it will immediately do it. There is also some slight optimization on the new cadence sensor code.

I always recommend the latest Alpha!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

User avatar
stancecoke   100 kW

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

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by stancecoke » Aug 04 2019 6:13am

elem wrote:
Aug 03 2019 2:15pm
Many thanck to casainho/buba/stancoke and all other involved to the devlopment ...
Don't forget marcoq, his approach is straight foreward, as you can use the original TSDZ2 displays and set up the system with a comfortable user interface using a laptop! Flash your controller just with one click :-)

regards
stancecoke

MathiasP   1 µW

1 µW
Posts: 4
Joined: Aug 02 2019 5:26pm

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Post by MathiasP » Aug 04 2019 6:58am

casainho wrote:
Aug 04 2019 5:00am
MathiasP wrote:
Aug 04 2019 3:09am
2. Is there any 850C software that works with 0.20.0?
Only when 0.20.0 will be released. For now it is not my priority.
I understand.
Just curious if the software that is available today is compatible or if I should run with 0.19 so far?
Thank you for a great job.
buba wrote:
Aug 04 2019 5:58am
MathiasP wrote:
Aug 04 2019 3:09am
1. What is the difference between Alpha 1 and Alpha 2?
2. Is there any 850C software that works with 0.20.0?
1. One bug that has been with us for a long time has left us in Alpha 2. Completely redesigned EEPROM-controller. So when installing the Alpha 2 everything should load properly and without any problem. If there is a problem for any reason it is possible to do a simple "reset to defaults" and it will immediately do it. There is also some slight optimization on the new cadence sensor code.

I always recommend the latest Alpha!
Which I suspected. :-)
Fantastic work you and casainho put into this project.

Post Reply