TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

Electric Motors and Controllers
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 » May 18 2019 6:19am

fabioditorino wrote:
May 18 2019 5:26am
Hi all,
i have a TSDZ2 with the Accelerator. Do you think is it possibile flashing the Firmware by connecting the St-link to the Accelerator connector instead of the Speed sensor connector?
Thanks.
Fabio
No !

The signal in the speed sensor are specialized for programming .
RockRider 9.1 TSDZ2 open source firmware .

User avatar
ashrambo   1 W

1 W
Posts: 55
Joined: Apr 30 2018 4:31am
Location: Madrid
Contact:

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

Post by ashrambo » May 18 2019 6:25am

casainho wrote:
thineight wrote:
May 17 2019 12:26pm
Hello, Just wanted to ask the status of the various development.
As far as I remember the v.0.19 beta was about to turn to the stable version, as well as the LCD3 updates.. but no news in the last weeks from the developers.

And what's the status of the other displays (850c and 102)?

Thanks a lot!
I personally I am not finding time to work on the firmware. Maybe because this year, during this nice months, I am being riding on mountains, etc. On winter I tend to ride less and then I have more free time.

This is what I know:
- LCD3 firmware: I think Buba is available to correct bugs and there are no planned new features (even because the programming memory is full!)
- TSDZ2 motor controller firmware: the big improvement from latest stable version is the removing of motor resistance when pushing the bicycle backwards. In the process, other bugs did appear and they need energy to solve them. I think Buba will try to help on this.
- LCD 850C firmware: I did not working on it lately but I think I should make a version with fixed numeric fields and graphs, as adding options to customize variables will take s lot of work. For the graph, I want to make it show the human pedal power. For numeric fields, for sure I want pedal cadence, motor power -- what should be the other 2?
- LCD SW102 Bluetooth and mobile app: I think there are about 4 developers working on it, where 1 is specifically developing the Android mobile app.

Yes, I am being riding with my family and we love it. And now about one of the most dramatic experiences we had recently. While we were riding, we found a Smart car overturned and inside an old woman - that was on a trail that almost no one pass. We found at 14h but the woman was there stuck since the previous night. She was fragile and gave her water and after my sweetened juice that I; always carry with me on my bicycle trips. The firefighters and police were very fast and the woman was ok, everything went well in the end.

Image

Image
She was very lucky, you were her angel.


Thanks for sharing your during these last years.

Enviado desde mi SM-G510 mediante Tapatalk

TREK REMEDY MOTOR TSDZ2

Dirkro   10 W

10 W
Posts: 82
Joined: Jun 30 2018 8:18am
Location: Bochum Germay

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

Post by Dirkro » May 18 2019 12:04pm

Hi,
I had some requests regarding error blinking 1 and I have asked ho to make it better for me, because I sometimes got stucked on steep sections.
But frankly spoke, I just swiched off the setting to power on without pedal rotation and I was suprized how fast the power came in the first 10th of my pedal rotation Vrey OK for me!.
Must say your guys are right in my opinion. I am happy with the engine as it is!.

@casainho
You was right, no need to change :-)

Just for people who want a different threshhold:
I got a good help from here where to find the code in the firmware, my very outdated BASIC knowlege was sufficient h to find the (hope I am right ) at the last section in ebike_app.c file. It would easily possible to change the threshold tfrom 12 to 40 in the code,

Looking forward to test the next beta of 19 19.6 was not working

Regards

Dirk
Oh darling, this is not a new bike.. :roll:

buba   10 kW

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

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

Post by buba » May 20 2019 3:56am

Small update coming soon!

e3s   10 W

10 W
Posts: 79
Joined: Jan 08 2018 12:40pm

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

Post by e3s » May 20 2019 1:36pm

after a bit of problems I want to share how to install stm8flash in ubuntu.
Packets needed are:
stm8flash (obviously)
dependencies to compile it are
make
gcc
pkg-config
libusb-1.0-0-dev

to download stm8flash there are 2 options:
1- install git
sudo apt install git
git clone https://github.com/vdudouyt/stm8flash.git

2- download it manually from the link above


install all dependencies
sudo apt install make gcc pkg-config libusb-1.0-0-dev


point to the folder

cd stm8flash-master

sudo make
sudo make install
Last edited by e3s on May 20 2019 1:47pm, edited 1 time in total.

thineight   100 W

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

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

Post by thineight » May 20 2019 1:43pm

buba wrote:
May 20 2019 3:56am
Small update coming soon!
Cool! What happened in the upcoming update?
MTB KTM Ultra 29" - City bike DAYTONA 28"

buba   10 kW

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

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

Post by buba » May 20 2019 3:49pm

e3s wrote:
May 20 2019 1:36pm
after a bit of problems I want to share how to install stm8flash in ubuntu.
Packets needed are:
stm8flash (obviously)
dependencies to compile it are
make
gcc
pkg-config
libusb-1.0-0-dev

to download stm8flash there are 2 options:
1- install git
sudo apt install git
git clone https://github.com/vdudouyt/stm8flash.git

2- download it manually from the link above


install all dependencies
sudo apt install make gcc pkg-config libusb-1.0-0-dev


point to the folder

cd stm8flash-master

sudo make
sudo make install
Thank you for taking the time to write that! Hopefully some will find it really useful. I really think it would be great to combine all the knowledge in this community in the wiki in some way.

buba   10 kW

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

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

Post by buba » May 20 2019 4:34pm

thineight wrote:
May 20 2019 1:43pm
buba wrote:
May 20 2019 3:56am
Small update coming soon!
Cool! What happened in the upcoming update?
Had a free day today (finally) so decided to spend the time coding and repairing pop's bike. Worked all day with the new button logic and solving bugs. Tried to make the experience to setup the system as intuitive as possible. The entire configuration menu has gotten a system facelift and everything is working great. Here is the updated wiki for the changes in the user interface:

https://github.com/OpenSource-EBike-fir ... tery_Setup

Installed a 36 volt motor today as well. The previous motor, 48 volt, had a short circuit so had to replace it. Feels great with a 36 volt motor and 48 volt battery! As for the firmware: had no problems with the soon-to-be-released 0.19.0 beta (Boost, Offroad mode and throttle not yet tested).

Will look at some of the reported issues and hopefully submit a pull request by tomorrow.

Thineight, you previously reported that Cruise was oscillating. I have spent the day testing it. Could you share what motor and system voltage you have on your setup when you have that problem?

thineight   100 W

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

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

Post by thineight » May 21 2019 1:28am

buba wrote:
May 20 2019 4:34pm
Thineight, you previously reported that Cruise was oscillating. I have spent the day testing it. Could you share what motor and system voltage you have on your setup when you have that problem?
Sure, my setup is a TSDZ2 (2017) 350W with a 36v battery.
Unless it's a trivial fix, please do not focus too much in the cruise function.. after all that is a nice to have feature and we can live with it as it is :wink: :wink:

Maybe it is better first to fix the blinking 1 "issue"..

Thanks for the configuration menu fix! :thumb:
Cheers
MTB KTM Ultra 29" - City bike DAYTONA 28"

buba   10 kW

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

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

Post by buba » May 21 2019 6:35am

thineight wrote:
May 21 2019 1:28am
buba wrote:
May 20 2019 4:34pm
Thineight, you previously reported that Cruise was oscillating. I have spent the day testing it. Could you share what motor and system voltage you have on your setup when you have that problem?
Sure, my setup is a TSDZ2 (2017) 350W with a 36v battery.
Unless it's a trivial fix, please do not focus too much in the cruise function.. after all that is a nice to have feature and we can live with it as it is :wink: :wink:

Maybe it is better first to fix the blinking 1 "issue"..

Thanks for the configuration menu fix! :thumb:
Cheers
Cruise
--------------------------------
I can confirm the oscillating and it is very simple to solve for. The thing is we need different control parameters for the 48 volt and 36 volt motor. I tuned it for the 48 volt motor and 48 volt battery. So it worked great on that setup but is maybe too aggressive on the 36 volt motor. Will maybe make it overall less aggressive and then it will work okay on both motors. Best thing would be to allow the users to change the parameters on the fly. But this would only work on the other displays with more memory and room for this.

I only noticed this now when I have the 36 volt motor and the open source firmware installed. Sorry! I do not have a lot of hardware to test for all different setups so it was only tuned for 48 volt. But hopefully you and others now know that.

The Blinking 1
--------------------------------
Will take the bike today and try to reproduce this as I need to know how the problem occurs to be able to solve it. Will try to test it and then see what can be done.

Still power on assistance 0 #86
--------------------------------
Will also test this today and try to reproduce it.

Pull Request
--------------------------------
I have the code that I have been working on pushed to my GitHub. We could even create a new beta today with all the fixes so far but will try to solve more bugs before I do a Pull Request.

casainho   10 GW

10 GW
Posts: 4826
Joined: Feb 14 2011 2:43pm

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

Post by casainho » May 21 2019 6:41am

buba wrote:
May 21 2019 6:35am

Still power on assistance 0 #86
--------------------------------
Will also test this today and try to reproduce it.
That one is solved as far I remember. I had to add an else to force the value to 0 when user change assist level when pedaling.
- 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

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » May 21 2019 11:06am

KT-LCD3 using flashing pins for the USB charging ?

I know there are already KT-LCD3 displays with USB port available on the market, but would it be possible utilize the FW flashing pins (+5V and GND) as the power supply for USB devices ?

I guess the biggest danger is that it will blow some display circuits off..

thineight   100 W

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

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

Post by thineight » May 21 2019 11:21am

casainho wrote:
May 21 2019 6:41am
buba wrote:
May 21 2019 6:35am

Still power on assistance 0 #86
--------------------------------
Will also test this today and try to reproduce it.
That one is solved as far I remember. I had to add an else to force the value to 0 when user change assist level when pedaling.
Confirmed, that one was solved on beta5 as far as I remember.
MTB KTM Ultra 29" - City bike DAYTONA 28"

hefest   100 W

100 W
Posts: 154
Joined: Jan 11 2019 4:55am

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

Post by hefest » May 21 2019 11:37am

e3s wrote:
May 20 2019 1:36pm
after a bit of problems I want to share how to install stm8flash in ubuntu.
Packets needed are:
stm8flash (obviously)
dependencies to compile it are
make
gcc
pkg-config
libusb-1.0-0-dev

to download stm8flash there are 2 options:
1- install git
sudo apt install git
git clone https://github.com/vdudouyt/stm8flash.git

2- download it manually from the link above


install all dependencies
sudo apt install make gcc pkg-config libusb-1.0-0-dev


point to the folder

cd stm8flash-master

sudo make
sudo make install
Thanks for this!
Can you give us rough description of the whole process for flashing? I don't have Windows on any of the computers.


buba   10 kW

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

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

Post by buba » May 22 2019 4:31am

casainho wrote:
May 21 2019 6:41am
buba wrote:
May 21 2019 6:35am

Still power on assistance 0 #86
--------------------------------
Will also test this today and try to reproduce it.
That one is solved as far I remember. I had to add an else to force the value to 0 when user change assist level when pedaling.
Great! Can also confirm it works! What other bugs/issues do you know of? I see the issues list on GitHub but can not replicate any of the problems so I imagine that a lot of them are already solved. I am curious of The Blinking 1 but have not yet experienced it.

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

The community, if there is any issue you would like to report please do so. Also, give a detailed explanation how to replicate the issue/error.

dameri   100 W

100 W
Posts: 182
Joined: Sep 20 2018 10:57am

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

Post by dameri » May 22 2019 8:16am

I’m waiting solution for blinking 1. It stops all assist. And it can appear suddenly when you start pedalling. Sometimes have to reboot display several times before blinking 1 disappear and motor is working again.

I don’t have any spesifc situations when it comes but it’s very annoying.

perryscope   100 W

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

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

Post by perryscope » May 22 2019 8:20am

buba wrote:
May 22 2019 4:31am
casainho wrote:
May 21 2019 6:41am
buba wrote:
May 21 2019 6:35am

Still power on assistance 0 #86
--------------------------------
Will also test this today and try to reproduce it.
That one is solved as far I remember. I had to add an else to force the value to 0 when user change assist level when pedaling.
Great! Can also confirm it works! What other bugs/issues do you know of? I see the issues list on GitHub but can not replicate any of the problems so I imagine that a lot of them are already solved. I am curious of The Blinking 1 but have not yet experienced it.

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

The community, if there is any issue you would like to report please do so. Also, give a detailed explanation how to replicate the issue/error.
I also see the Blinking 1 error, and its always when I stop at a junction and keep one foot on a pedal, mainly as i use clip-ons so its natural to only take one foot off. I don't run any brake sensors on this bike so its easy to put a little too much pressure on the pedal at standstill with manual brakes enabled, you only notice the error once you set off and there is no assist.

looking at the safe_tests function in the ebike_app.c I think the main issue is that once there is any torque value > 12 you have 10 seconds to reach a wheel speed of 4kmph or the error is triggered.

What may be causing the issue here is that you only need a small torque value to be recorded at a standstill to apply power to the motor (when not using e-brakes). Should it not also require a small amount of pedal cadence? or is the intention to always use e-brakes to disengage the motor and as soon as the break is lifted any toque will power the motor from standstill?

Would it be safer to also require a small amount of cadence? maybe two pulses to signify its rotating a few degrees? Sure this would delay the initial power from standstill until you rotate manually a very small amount but would allow you to hold the motor on the brakes with or without e-brakes.

i do plan to add a brake sensor to my hydraulic brakes, but have not yet got round to it :)
Empowered people support rider and trustee
www.empoweredpeople.co.uk

casainho   10 GW

10 GW
Posts: 4826
Joined: Feb 14 2011 2:43pm

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

Post by casainho » May 22 2019 8:30am

dameri wrote:
May 22 2019 8:16am
I’m waiting solution for blinking 1. It stops all assist. And it can appear suddenly when you start pedalling. Sometimes have to reboot display several times before blinking 1 disappear and motor is working again.

I don’t have any spesifc situations when it comes but it’s very annoying.
For me, when I tested with boost disabled, when I get this issue I have to stop the bicycle and wait for wheel speed = 0. I also apply brake sensors, sometimes works to reset this issue, others only when I let wheel speed = 0.
- 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

dameri   100 W

100 W
Posts: 182
Joined: Sep 20 2018 10:57am

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

Post by dameri » May 22 2019 8:45am

I don’t have boost enabled and don’t have brake sensors. When blinking 1 comes it only disappear when I reboot display.

Francisco   1 µW

1 µW
Posts: 3
Joined: May 22 2019 12:08am

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

Post by Francisco » May 22 2019 10:52am

Hi all.
I'm new in the forum. Sorry for the language, I use the Google translator.
First of all, to thank everyone in general, the work done, the perseverance and the help offered to those who like me have no technical knowledge.
I have been reading and rereading for some time, in order to be clear on how to update Casahino's firmware, I have bought everything, but after having read on several occasions that it is advisable to incorporate brake sensors, a question arises, that I would like someone to answer me and will detail a little. First of all I have a 6 pin connector to tsdz2, therefore, it does not have brakes or accelerator. I want to incorporate some magnetic brake sensors to the KT-LCD3 screen, but I need to know how I should perform the installation, I have read in the forum something about the subject, but I think it refers to 8-pin tsdz2 cables.
I would greatly appreciate the help, I am sorry I did not explain myself better.
pastedImage.png
pastedImage.png (35.65 KiB) Viewed 933 times
pastedImage.png
pastedImage.png (33.12 KiB) Viewed 933 times
pastedImage.png
pastedImage.png (66.71 KiB) Viewed 933 times

thineight   100 W

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

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

Post by thineight » May 22 2019 11:12am

dameri wrote:
May 22 2019 8:45am
I don’t have boost enabled and don’t have brake sensors. When blinking 1 comes it only disappear when I reboot display.
Hello, I do not have startup boost enabled, but I do have the brake sensors. I experienced the issue during a very steep climb while moving as far as I remember (it was the 0.19 beta or beta4).. I did not know about it so I thought it was a sort of failure due to the heat or some new function.
Therefore I do not directly relate the issue to the standstill start.. I will try to dig more (I'm currently on beta5)
MTB KTM Ultra 29" - City bike DAYTONA 28"

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » May 22 2019 11:58am

Francisco wrote:
May 22 2019 10:52am
Hi all.
I'm new in the forum. Sorry for the language, I use the Google translator.
First of all, to thank everyone in general, the work done, the perseverance and the help offered to those who like me have no technical knowledge.
I have been reading and rereading for some time, in order to be clear on how to update Casahino's firmware, I have bought everything, but after having read on several occasions that it is advisable to incorporate brake sensors, a question arises, that I would like someone to answer me and will detail a little. First of all I have a 6 pin connector to tsdz2, therefore, it does not have brakes or accelerator. I want to incorporate some magnetic brake sensors to the KT-LCD3 screen, but I need to know how I should perform the installation, I have read in the forum something about the subject, but I think it refers to 8-pin tsdz2 cables.
I would greatly appreciate the help, I am sorry I did not explain myself better.pastedImage.pngpastedImage.pngpastedImage.png
The KT-LCD3 doesn't have the extra 6th pin for the brake signal but it is available on the 6PIN TSDZ2 connector or cable. So all you need is to connect the correct 2 pins from the magnetic sensor to GND (black) and BREAKE(purple) on TSDZ2 connector.
I am using the same magnetic breaks what you shared. Those are made for Bafang with 3 pin but in fact you just need 2 pins. To chose the right 2 pins just use regular ohm meter and find pair which is short circuit (0 ohms) when magnet is detached (and with magnet attached the pins are disconnected).
Attachments
Capture.JPG
Capture.JPG (60.78 KiB) Viewed 917 times

Francisco   1 µW

1 µW
Posts: 3
Joined: May 22 2019 12:08am

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

Post by Francisco » May 22 2019 2:04pm

Hello Elfnino, Thank you very much for the detailed explanation you have shared, without your help I would not have been able to understand it and get it. Now I have one last doubt, you, how did you make the connections between cables? Can you detail it to me with the same clarity as your previous message? I would appreciate it.

User avatar
elfnino   100 mW

100 mW
Posts: 48
Joined: Mar 06 2019 5:09am

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

Post by elfnino » May 23 2019 3:45am

Francisco wrote:
May 22 2019 2:04pm
Hello Elfnino, Thank you very much for the detailed explanation you have shared, without your help I would not have been able to understand it and get it. Now I have one last doubt, you, how did you make the connections between cables? Can you detail it to me with the same clarity as your previous message? I would appreciate it.
Well I replaced the original KT-LCD3 cable with the VLCD5 cable and just soldered it directly to KT-LCD3 mainboard.
Then I drilled two new holes on the back side of the KT-LCD3 for the sensor cables and did the connection (BREAK, GND) inside the display case where is just enough space for it.This is the elegant way with simple cabling but perhaps not the easiest.

The other options I was considering is to run extra cable from sensors directly to TSDZ2 controller and do the soldering inside.

Post Reply