Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

mff47025 said:
I have noticed that a couple of vendors are have a SM-102 display that works with stock firmware. Do you think this OSF would would work with that version of the SM-102 ......
Yes, every display which is working with stock tsdz2 firmware can work with OSF for stock displays too.
These displays (like SW102, 860C) are flashed specific for tsdz2, so the communication protocol is the same as vlcd5/6 and XH18.

Maybe only problem will be that handling the OSF functions must be found by yourself because these could be different from stock display's. As you found with battery bars too. There is a chance that you can't use all OSF functions, because OSF works with the display error codes for activating these functions.
 
First post. Many THANKS to all the folks working on this project. Really great work here!
I have installed TSDZ2 48v 14s5p 52v, ridden once (Specialized Fuse). Working on OSX, but can borrow wife's Windows work laptop.

Was unable to flash (using STLink-V2 from Eco Cycles) with OSX as it would not assign a USB port.
But, was able to flash from the Windows machine, after changing PATH in Flash.bat for STVP_Cmdline (windows would not let me install STMicroelectronics at C:\).

I am way behind on reading this thread, up to about 25 pages. Thanks again!
 
Elinx said:
mff47025 said:
I have noticed that a couple of vendors are have a SM-102 display that works with stock firmware. Do you think this OSF would would work with that version of the SM-102 ......
Yes, every display which is working with stock tsdz2 firmware can work with OSF for stock displays too.
These displays (like SW102, 860C) are flashed specific for tsdz2, so the communication protocol is the same as vlcd5/6 and XH18.

Maybe only problem will be that handling the OSF functions must be found by yourself because these could be different from stock display's. As you found with battery bars too. There is a chance that you can't use all OSF functions, because OSF works with the display error codes for activating these functions.
Thanks. I appreciate the feedback. It might be awhile before I attempt this. I'll report back when I do.
 
Finally able to compile stm8flash on Raspberry PI after much help from GitHub and internet. Had the same error as MacOS, but installed libusb to fix.
Java Configurator now working on Raspberry PI to compile and flash TSDZ2, whew! Now to go ride the dang bike!
Thanks all. :D
 
mff47025 said:
.....
Thanks. I appreciate the feedback. It might be awhile before I attempt this. I'll report back when I do.
You haven't think about it to use the version of Casainho for SW102/850C/860C?
Because that version is specific build for these display's
Also a default display is cheaper than the custom flashed one for Tsdz2.

Tiger_one said:
Finally able to compile stm8flash on Raspberry PI ...
Your wife wasn't agreed with the use of her Windows laptop? ;)
 
Your wife wasn't agreed with the use of her Windows laptop? ;)

LOL, no mostly me, I am a klutz working windows, been on mac and linux too long. That, and I'm always worried that something I load will mess up her online work ability! :mrgreen:
 
Okay, just back from 3rd ride. Last ride was Torque Assist, this one I choose Power Assist, stock settings other than 48v, 44v cutoff, 800wh and 14s.
600 watts limit on street (I may up this to 700 for my next flash)
15amps
55 minutes ride, 14.5 miles, max speed 23.58 (some downhills but I was in TOUR mode :wink: ), 16.3 mph ave.

Motor temp from outside with laser at hottest point within 5 minutes of stopping, 56c.
Battery showed about half bars and was 52volts (about right).
I found if you just pause a 1/2 second while shifting no clunk, very smooth.
I could tell slightly better motor pull on SPORT and TURBO, but I stayed in TOUR for the most part and downshifted gears on climbing hills. Think I like this mode as the Torque assist makes you keep trying to petal harder.

On programming, I am using the raspberrypi and made some .sh files to clean like the batch file clean.bat and also a couple more to set the option bytes to enable, and then flash the hex.

Very nice overall for this old man, pretty good workout for someone that has not ridden a bike in 20 years!

Thanks to all that have made this happen, also those latest wiki notes have helped a lot.
P.S. Do not flash the option byte any more. When I flash the main.ihx, gives error first try and loads second try.
 
Tiger_one said:
.....
Motor temp from outside with laser at hottest point within 5 minutes of stopping, 56c.
......
I assume you haven't add the temperature sensor and also no improvements for heat dissipation.
Realize that the tsdz2 has a bad heat management. You can't trust measurements on the housing.

This because there is an airgap between bare motor and housing.
In the wiki there is mentioned a hardware addition to improve the heat dissipation.
Also you find here some variants
 
Hi all,

today i decided to flash mbrusa firmware in my tsdz2 36v (original firmware) and i think something went wrong. Now the motor doesnt response.

Before start the process i disconnected the battery, let stay connected the vlcd5, disconnected speed sensor and connected the usb programmer to the motor.
After I opened STVP and configured as STM8S105x4 tried to read memory. All worked ok and i created backup files from tabs (program, memory, option byte) without problems.

Then decided to use the java configurator to compile and flash memory (i was reading for days posts and manuals to configure my options and rechecked all before start). Compilation ended ok but in first flashing step the script stopped, this is the log file:

new log session
date: 01/26/21
time: 22:00:44
----------------------------------------------------------
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Loading file option_no_prot.ihx in OPTION BYTE image in computer
<<< Loading file succeeds

>>> Programming OPTION BYTE
<<< Programming OPTION BYTE succeeds

>>> Verifying OPTION BYTE
Error on Option Bytes (complementary bytes). Reprogram Option Bytes of device
<<< Verify OPTION BYTE fails
______________________________

I got afraid about this messsage but openned again STVP and i readed the memory tabs from motor without problem.

Now is when i think i meshed up all. I returned to forums looking for someone talking about error "verify OPTION BYTE fails" and found someone that said that better to try flash with the VLCD disconnected. I disconnected my VLCD while the usb programer conected and STVP open. As i disconnected it the motor stopped to response to STVP. (not sure if i saw a disconnection msg at STVP) but now as you try to read the memory get this errors.

> Reading PROGRAM MEMORY area...
Error : Error while reading address 0x8000
Error : < PROGRAM MEMORY reading failed.
> Reading DATA MEMORY area...
Error : Cannot communicate with the device !

after this tried to disconnected all, restart laptop and reconnected programmer, but motor still doesnt response.

then removed programmer and connected battery, vlcd and sensor to check motor. The vlc5 works but motor doesnt do anything, nor pushing throttle nor moving pedals. Also If i move pedals doesnt get speed sensor. The battery level shows only one bar (before flash it showed full charge).

Any idea to fix this mesh?

I have to say before start this aventure dived in tons of posts from this forums, watched the videos about install the firmware and readed carefully the manuals and readme.

Thank you all anyway. I saw a lot of work and help from developers and community.
 
Elinx said:
Tiger_one said:
.....
Motor temp from outside with laser at hottest point within 5 minutes of stopping, 56c.
......
I assume you haven't add the temperature sensor and also no improvements for heat dissipation.

Right, thanks for the heads up, I have been reading about it and may go there at some point. I have some temp sensors but not sure of their resistance values.

I'm trying to take it easy on the motor. 600watts with 55v is only 11amps. I start out with 57.7volts. 700watts would be 13.5amps at 52volts.

My PowerWall is also 14s but 100p, the ebike is 14s 5p. The batteries average 2800ma capacity. Pretty conservative on my settings.
 
kw1980 said:
Hi all,

today i decided to flash mbrusa firmware in my tsdz2 36v (original firmware) and i think something went wrong. Now the motor doesnt response.

Before start the process i disconnected the battery, let stay connected the vlcd5, disconnected speed sensor and connected the usb programmer to the motor.
After I opened STVP and configured as STM8S105x4 tried to read memory. All worked ok and i created backup files from tabs (program, memory, option byte) without problems.

Then decided to use the java configurator to compile and flash memory (i was reading for days posts and manuals to configure my options and rechecked all before start). Compilation ended ok but in first flashing step the script stopped, this is the log file:

new log session
date: 01/26/21
time: 22:00:44
----------------------------------------------------------
STVP_CmdLine version 1.6

Verbose ON
Log activity ON
Display Progress OFF
Message box warning if protect option byte ON
Loop mode OFF
Erase device OFF
Blank check device OFF
Verify device ON

Configuration:
BoardName=ST-LINK ST-LINK_ID=0 Device=STM8S105x6 Port=USB ProgMode=SWIM

>>> Loading file option_no_prot.ihx in OPTION BYTE image in computer
<<< Loading file succeeds

>>> Programming OPTION BYTE
<<< Programming OPTION BYTE succeeds

>>> Verifying OPTION BYTE
Error on Option Bytes (complementary bytes). Reprogram Option Bytes of device
<<< Verify OPTION BYTE fails
______________________________

I got afraid about this messsage but openned again STVP and i readed the memory tabs from motor without problem.

Now is when i think i meshed up all. I returned to forums looking for someone talking about error "verify OPTION BYTE fails" and found someone that said that better to try flash with the VLCD disconnected. I disconnected my VLCD while the usb programer conected and STVP open. As i disconnected it the motor stopped to response to STVP. (not sure if i saw a disconnection msg at STVP) but now as you try to read the memory get this errors.

> Reading PROGRAM MEMORY area...
Error : Error while reading address 0x8000
Error : < PROGRAM MEMORY reading failed.
> Reading DATA MEMORY area...
Error : Cannot communicate with the device !

after this tried to disconnected all, restart laptop and reconnected programmer, but motor still doesnt response.

then removed programmer and connected battery, vlcd and sensor to check motor. The vlc5 works but motor doesnt do anything, nor pushing throttle nor moving pedals. Also If i move pedals doesnt get speed sensor. The battery level shows only one bar (before flash it showed full charge).

Any idea to fix this mesh?

I have to say before start this aventure dived in tons of posts from this forums, watched the videos about install the firmware and readed carefully the manuals and readme.

Thank you all anyway. I saw a lot of work and help from developers and community.

Hi,

I fixed the problem,

the memory got corrupted when disconnected the vlcd while STVP was running and usb connected.

Followed tips about motor no response at wiki and restored original fw. It didnt work until changed voltage pin from 5v to 3.3v in usb. Added the reset pin to connection and rewrited original option bytes tab. After that restored memory and program backups and now all is ok.

I saved my ass, it is my girl's bike. :D

I will try OSF next week with more time and calm instead late night at work day.
 
kw1980 said:
........ It didnt work until changed voltage pin from 5v to 3.3v in usb...... now all is ok. ....
If it is a nice colored Chinese ST-link V2 , I recommend to pull back a bit, the aluminium housing, so you can read the pin-out signal names on the PCB.
There is a good change that the signal names printed on the aluminum housing are swapped and wrong.

Update:
Casainho writes also about these Chinese ST-link v2 here and refers to this article.
 
Just thought I would throw my project picture up, bad wx all day, no riding. Friend gave me the donor bike. Specialized Fuze 27.5" x 3" tubeless. BB is PF46, I had to turn some bushings for each side to fit TSDZ2 and 1/8" offset as the gap between motor and mount shaft is quite close. Stock gearing is perfect for me, will do 24mph in top gear.

20210122_072119.jpg20210126_172851.jpg20210126_172859.jpg
 
Got the MacBook Pro working for flashing the TSDZ2. I just copied the flash file from raspberry, my mistake on the Mac was trying to assign a PORT, just need the "-c stmlinkv2" setting.

Temp sensor installed and working great, hopefully get to ride it today. Short 1 mile hop yesterday only got to 33.3c when 15c outside.

Great job on the software to all that contributed to this outstanding build! The OSF was the deciding factor for me to purchase this motor.
 
Ride today, about 13 miles, 17c outside temp.
Motor temp showed 62.8 for highest I saw during ride, but did get the E06 error on screen for last part of ride.

Temp set min 65 max 80.

When does the E06 come on, at 65 or 80?? Never saw temp over 62.8.
 
As you prefer.
Copy and paste from the manual:
...
- Temperature error with min limit
If enabled, the error code E06 - ERROR_OVERTEMPERATURE is displayed when the minimum temperature limit is exceeded. If disabled when the maximum limit is exceeded.
Only available with installed temperature sensor.
- Motor temperature min limit
Set the temperature from which the motor protection will start, limiting the power. The power gradually decreases up to the maximum temperature limit, then the motor stops.
- Motor temperature max limit
Set the maximum motor temperature. At this temperature the motor will be turned off.
Values in degrees Celcius.

...
 
Hello,

I am new here. I would like to ask some help to configure emmebrusa's firmware.
Maybe there is a database of config files. I don't know. I have all the sw installed but I am afraid of flashing without your supervision.
I am confused in some settings mainly in the battery settings. Could you please tell me what numbers are good but safe in my case?
I have that motor: 750W 42T TSDZ2.
The display is VLCD5
The detailed battery specs:
Code:
48V 17.5AH Samsung Specification: (the interior battery is SAMSUNG Li-ion battery)
 The battery pack fits 48V 250W/350W/500W/750W1000W motor, can't working on  1500W motor, if your motor power over 1000W , we can't provide warranty for this battery
1. Rated capacity: 17.5AH
2. Voltage: 48V
3. Charging Voltage: 54.6V
4. Discharge cutoff voltage: 36.4V
5. 5P13S Li-ion 65pcs battery cells (the interior battery is SAMSUNG Li-ion battery)
6. Continuous discharge current: 30A
7. Pulse/Max discharge current 50A
8. Max charging current : 5A
9. Charging temperature: 0~45°C
10. Dischargeing temperature: -20~55 °C
11.Operating voltage:36.4V~54.6V
12.Diamesion: 90.3*109.4*367.4mm 
13.Weight of battery pack About kg
Note: Please turn on the power switch when you charging this battery pack.
The battery pack fits 250W / 350W / 500W motor and 48 V 750W 48V 1000W motor
Packing list:
1 pcs 48V 17.5h hailong plus ebike battery pack  (the interior battery is SAMSUNG Li-ion battery)
1 pcs 2A charger
It has no usb power output
And here is my config file. Probably with some issues.
Code:
false
true
false
25
false
20
67
160
500
2
30
20
8
28
750
840
65
196
29
100
100
4.35
4.05
3.95
3.70
3.45
3.25
3.85
3.70
3.55
3.40
3.25
2.90
2280
45
true
true
false
true
false
false
true
true
true
false
false
0
true
false
false
false
1
6
7
true
500
25
false
false
47
176
65
80
false
false
true
false
true
false
false
50
true
30
true
false
50
50
50
250
250
50
1
2
5
4
8
0
70
120
210
300
70
100
130
160
70
100
130
160
6
9
12
15
30
40
50
60
6
false
60
15
18
21
24
false
10
0
2
true
false
0
255
ACtC-3dG_O1LiHiAk8NuwtlVJWkZj4zWL31umTRfmEJNke28CM8PSoc-dZxsnqz7aueA1XiB6RKv2AC_1SXNsP2hXdkEoV0YPjQy9TZRJDj9IaSNBQOw5lOYw543DN8nHGb3zLwzbFBhxoJrwekBgqlkbJh3pQ=w1138-h598-no
 
matedon said:
..
...Could you please tell me what numbers are good but safe in my case?....

battery current max. 17A (you don't need 28A, max cutoff contoller is 18A)
battery power max. 750W is OK
battery capacity 840Wh is OK (48x17,5)
battery cell nr. 13 (5P13S, count only the serial S number)
battery cutoff voltage 40V (29V is for 36V battery) (BMS cutoff is 36,4V-54,6V)

Which means for 48V battery (useable 41V-52V):
41V min x17A max = 700W with minimal battery
750W max /52V max = 15A with max battery

I see you want on/off headlight too. You can only get low 6V and 500mA current (3W) from controller for that.
You need a relay for higher currents and use battery direct for the lights.
 
Elinx said:
I see you want on/off headlight too. You can only get low 6V and 500mA current (3W) from controller for that.

How can I make my controller work again with 20S 60V?

I flashed OS-ebike firmware and made it work without torque-sensor, just with cadence sensor.
I used 12S 36V for two months. I switched to 18S 54V for 10 days.
I replaced 63V capacitors with 100V capacitors and switched to 20S 60V. I ran 4 days with it.
Two days ago I connected fenix bc30 to +6V green wire and 0V orange wire. It worked on first the lowest mode. After that I run into trouble.

Now my controller works fine with 46V, 51V and refuse to work with 58V. Display can not connect with controller. And I can not reach controller with stlink v2 - neither read, nor flash on this voltage. 46V everything works just fine.

I replaced TSDZ2 controller with new one. Flashed it. I replaced 4 capacitors with with new rated for 100V. But I repeated my test with fenix and 6V light.

So second controler does not work with 69V bit works fine with 46V.

photo_2021-02-25_18-49-15.jpg

photo_2021-02-25_14-26-48.jpg

photo_2021-02-25_17-19-00.jpg
 
livello said:
.......
Two days ago I connected fenix bc30 to +6V ...... After that I run into trouble.

.....I repeated my test with fenix and 6V light....
This is exactly the reason for my notification about the use of headlights with Tsdz2.
The bc30 can give more than 2000 lumen. You need more than 20Watt for that.
So you try to pull 2,5 A out of the controller.
Because this isn't possible, problably something is burned on both controllers.
 
Hi everyone, the time has come to release the new version.
There are still some tweaks to be done, but if I wait for everything to be perfect I will never release it.
There are actually three new versions, one for standard displays with Java configurator, one for LCD3 and one for 860C color display.
For all versions, The base firmware of the engine is the same, v7 of mspider65 which comes from 20beta1, to which I have added other changes.
In all versions, the operation and parameters of the motor are the same, so I decided to open another thread that groups all these new versions.

This is the link
TSDZ2 OSF for all displays, VLCD5-VLCD6-XH18, LCD3, 860C.
 
For the past couple of months, I have been helping test this new version of firmware 20.1C for the 860C!
I have to say it's the best version of firmware I've ever used on the TSDZ2!
Last year mbrusa improved the firmware 20.1 for the LCD3 so it was much safer and better than before!
Then the last few months he was able to add the 860C and 850C displays to the 20.1C firmware and improved it for all the displays!
I want to publicly thank mbrusa for all his work getting his version of 20.1C working on all the displays. And working with me the last two years to make MAJOR improvements to his version 20.1C!
THANKS!
Jeff
 
Totally agree, Jeff !
Also want to thank all off you who put a lot of free time in this project to aprove the firmware and possebilities for our TSDZ2 middrive motor. :thumb:

Special thanks from Holland to mr. Mbrusa who gives us this greate new firmware and still keep working on it :bigthumb:


One question about the new firmware for xh18 display. How can i change street to offroad mode for all level modes?
Change parameters startup /go to level one / push 1x light / 1x push to change 1 to 0 / didn`t work out...
Still de motor is running in street mode.. :roll:
 
cejean said:
..
One question about the new firmware for xh18 display. How can i change street to offroad mode for all level modes?
.....
I have a XH18 display too and have no problems with it.
Switching from street to offroad is only possible in level 1 (eco), NOT all levels

With 0.20.1B and 0.201C the button sequence is the same.
In level 1 push ON..ON (a bit slow) and wait. (To fast klick again is switching to E03 without change)

0.20.1B/C start up at assist level 1 after switching the power.
So pushing ON ............ON..ON............ does the trick.

With v0.20.1C the display speed info after first push ON must be 10.x km/h (street)
After the second push ON it must be 00.x km/h (offroad)
Wait 5 seconds and the mode should be set.
You can check this by pushing ON just one time, you see 00.x km/h(offroad)
 
Back
Top