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

angusinalberta said:
linklemming writes
I can definately feel difference between assist 1(0.5) and 2(1.0) but 3-5(1.5,2.0,2.5) seem the same unless I intentionally barely use the pedals (low cadence, low pressure)
The stock firmware uses torque assist levels of 0.4, 0.75, 1.5, and 3.0
Note the progression, each step is double. Try something like that.

What stock firmware are you talking about?

From the actual code, which is exactly what I see on the LCD for Configuration Menu 3:Assist Level Setup

D:\TSDZ2-SW\TSDZ2-Smart-EBike-master\src\display\KT-LCD3\main.h (21 hits)
Line 40: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_1 5 // 0.5
Line 41: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_2 10
Line 42: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_3 15
Line 43: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_4 20
Line 44: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_5 25
Line 45: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_6 35
Line 46: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_7 40
Line 47: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_8 45
Line 48: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_9 50
 
linklemming said:
angusinalberta said:
linklemming writes
I can definately feel difference between assist 1(0.5) and 2(1.0) but 3-5(1.5,2.0,2.5) seem the same unless I intentionally barely use the pedals (low cadence, low pressure)
The stock firmware uses torque assist levels of 0.4, 0.75, 1.5, and 3.0
Note the progression, each step is double. Try something like that.

What stock firmware are you talking about?

From the actual code, which is exactly what I see on the LCD for Configuration Menu 3:Assist Level Setup

D:\TSDZ2-SW\TSDZ2-Smart-EBike-master\src\display\KT-LCD3\main.h (21 hits)
Line 40: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_1 5 // 0.5
Line 41: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_2 10
Line 42: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_3 15
Line 43: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_4 20
Line 44: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_5 25
Line 45: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_6 35
Line 46: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_7 40
Line 47: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_8 45
Line 48: #define DEFAULT_VALUE_ASSIST_LEVEL_FACTOR_9 50

stock firmware is the firmware that came with the motor, when you bought it.

he recommends you to change the assist level values to values along these lines. it is in the nature of this multiplier concept, that it soon reaches levels that are hard to differentiate.
so, if you are using 5 levels, it could be enough to have a multiplier of 1 on level 3 or 4, and values like 0.4 and 0.7 below that and maybe 1.5 and 2.5 above.
 
linklemming asked
What stock firmware are you talking about?

Sorry I wasn't clear. I meant the original firmware from Tongshen. The numbers I mentioned are based on their sales literature from a couple of years ago.

I was impressed at the time because human perception of effort is a roughly logarithmic function and their designers must have known it.
 
dameri said:
I finally try to flash open source firmare but something went wrong with TSDZ2. I flashed KTLCD3 and everything was fine. Then I tried to flash motor and problems begun. First I made back up original firmaware and I succeeded.

I did according to the instructions and no luck. I try to read all tabs very many times and same error came all the time: error while reading address 0x8000. Problem is on program memory tab. Option byte and data memory tabs are okay but program memory is not working. Finally software read also program memory but it couldn’t program it.

I tried to search internet 0x8000 fault but no luck. Can somebody help me.

Here is output of software:


Hardware configuration set to <ST-LINK on USB with STM8S105x6 plugged in and SWIM protocol>.
Blank check before programming (when available) is OFF
Verify after programming is ON.
Clear memory before loading a file is ON.
Erase device memory before programming (when available) is OFF
Display a popup window when an error occurs is ON.
Log activity is OFF
> Reading OPTION BYTE area...
< OPTION BYTE reading completed -- [Device Checksum 28]
> Reading DATA MEMORY area...
< DATA MEMORY reading completed -- [Device Checksum F9]
> Reading PROGRAM MEMORY area...
Error : Error while reading address 0x8000
Error : < PROGRAM MEMORY reading failed


Reading PROGRAM MEMORY area...
< PROGRAM MEMORY reading completed -- [Device Checksum 1670D0]
> Loading file C:\Users\C\Downloads\TSDZ2-throttle-v0.16.0.hex in PROGRAM MEMORY area ...
< File successfully loaded. File Checksum 0x1AA360
> Programming PROGRAM MEMORY area...
Error : Programming failed
Error : < PROGRAM MEMORY programming failed.
Error : < Operation aborted.

I ran into the exact same issue as you. Programming the LCD3 worked no problem, but random errors when trying to communicate with the TSDZ2. I also made a really short cable that looked a lot like yours and tested each conductor for continuity. I had already been through 2 ST-Link clones so I decided to just get the real STMicroelectonics V2 programmer from Amazon for $32. It worked immediately after hooking it up with my cable so for the relatively small investment it was worth it over the aggravations of using the cheap clones.

I ran into some coms issues with the display after getting everything flashed and wired - all of the LCD segments were activated like in Jbalatu's video, indicating a communications error. Fortunately, I had just twisted the connections together and with a little trial and error, I got the right connections. After it was working I soldered and heat shrinked the connections.

For anyone else stumbling across this:

36V 500W TSDZ2 purchased in early 2018 from auto-ebike
Throttle option but no throttle installed

I cut and spliced the LCD3 cable to the VLCD5 display cable which goes to the motor:
TSDZ2 LCD3
Red Blue
Black Black
Blue Red
Yellow Yellow
Brown Green
Orange - not used
White - not used
Green - not used

I took it for a test ride this morning and it works really well!! Thanks to everyone who has contributed to this project. You have done amazing work.
 
vailbiker said:
dameri said:
I cut and spliced the LCD3 cable to the VLCD5 display cable which goes to the motor:
TSDZ2 LCD3
Red Blue
Black Black
Blue Red
Yellow Yellow
Brown Green
Orange - not used
White - not used
Green - not used

I took it for a test ride this morning and it works really well!! Thanks to everyone who has contributed to this project. You have done amazing work.

and how thas that differ from the wiring suggestion on the wiki?

dameri: have you tried to switch the tsdz2 cables between swim and gnd? maybe that helps.
 
[/quote]

and how thas that differ from the wiring suggestion on the wiki?
[/quote]

It depends on where you look. Look at this image on the wiki: KT-LCD3 0.1" Motor Connector Photo or the wiring diagram on Jblata's video. But yes, it ended up being the same as the table titled: Summary of connections between KT-LCD3, Bafang 850C and TSDZ2 motor cable.

Glad it was so obvious to you. I'm not that smart - just persistent ;)
 
angusinalberta said:
linklemming asked
What stock firmware are you talking about?

Sorry I wasn't clear. I meant the original firmware from Tongshen. The numbers I mentioned are based on their sales literature from a couple of years ago.

I was impressed at the time because human perception of effort is a roughly logarithmic function and their designers must have known it.

No problems, it never even occurred to me as I never even powered up my system with stock firmware except to flash it ASAP.

Did a 30 mile ride today with multipliers of 0.3,0.5,1.0,1.5 and 2.0

On 0.3 I could ride in level gravel road at 15mph at a good target heartrate. I think I do this with a non-ebike about 10-12mph so I am going to bring it down a notch.

The difference between 1.5 and 2.0 was not noticable in my regular riding . I had to use really slow cadence in a really high gear and barely put any pressure on the pedals to notice it and I just dont ride like that.

I think the factor of 2 is going to work well for me. Im going to use 4 levels of 0.2,0.4,0.8 and 1.6.

I thought I was hearing a squeaking sound coming from the motor and just couldnt figure it out. It turns out that the jockey wheels on my rear derailler were dry and squeaking...go figure

Im pretty happy with the range Im getting with this unit and firmware. After riding 30 miles, the hailong 48V/10ah battery voltage was still at 43V while riding and 46V at rest and it was 30F outside.
 
[/quote]
dameri: have you tried to switch the tsdz2 cables between swim and gnd? maybe that helps.
[/quote]

No I haven't. I really don't understand that. I think cables have to be exactly right pins.
 
Quoting is not very easy for me. I tried to quote Vallbiker's post where he told to bought real STMicroelectonics V2 programmer from Amazon for $32.
 
casainho said:
On current code, 1.1 and 1.2 are implemented but 1.2 ODOMETER is not. What I wanted to do but I didn't had time, was to store on EEPROM the last selected 1.x, so if user prefers to see for instance 1.1 DISTANCE SINCE POWER ON, the system will always start at 1.1 when users cycles over odometer fields. Is the same idea that odometer last field number is already stored on EEPROM and then the subfields would also need to be stored on EEPROM.

Do you plan to submit a pull request? I suggest you to make a pull request and then I all look and test it, then we can make a new release.

The code has now been tested by us and no visible bugs. Works great! :D

Here is a video with more information and changelog in the description:
https://www.youtube.com/watch?v=ADyqLxBU-8Y

[youtube]ADyqLxBU-8Y[/youtube]

Planning for pull-request when I have more time! :) Have the source code and hex in my forked repo in GitHub: https://github.com/leon927/TSDZ2-Smart-EBike
 
buba said:
casainho said:
On current code, 1.1 and 1.2 are implemented but 1.2 ODOMETER is not. What I wanted to do but I didn't had time, was to store on EEPROM the last selected 1.x, so if user prefers to see for instance 1.1 DISTANCE SINCE POWER ON, the system will always start at 1.1 when users cycles over odometer fields. Is the same idea that odometer last field number is already stored on EEPROM and then the subfields would also need to be stored on EEPROM.

Do you plan to submit a pull request? I suggest you to make a pull request and then I all look and test it, then we can make a new release.

The code has now been tested by us and no visible bugs. Works great! :D

Here is a video with more information and changelog in the description:
https://www.youtube.com/watch?v=ADyqLxBU-8Y

[youtube]ADyqLxBU-8Y[/youtube]

Planning for pull-request when I have more time! :) Have the source code and hex in my forked repo in GitHub: https://github.com/leon927/TSDZ2-Smart-EBike

:bigthumb: :bigthumb: :bigthumb: :bigthumb: :bigthumb: :bigthumb: :bigthumb: (at last....)
 
andyme said:
dameri: have you tried to switch the tsdz2 cables between swim and gnd? maybe that helps.

Now I tried and no luck. Tomorrow I test new dongle if I get it.
 
buba said:
The code has now been tested by us and no visible bugs. Works great! :D

Planning for pull-request when I have more time! :) Have the source code and hex in my forked repo in GitHub: https://github.com/leon927/TSDZ2-Smart-EBike
Great work!! For the code and the video!!

I was looking at your code changes to review it -- they seem good and I have one note:
You set the odometer by adding 100 km with the up button and subtracting 5 km with the down button. <--- this is clever but on the other side, this only happens to this field and not on the others so it is not consistent over all the configuration menus. Good would be to implement to all menus but I understand is better to have this on this menu than nothing. Maybe even better, as suggested by other user, was to increment at 1 unit and long press on the buttons to increase/decrease automatically at like 10x units.

Next steps I think are needed:
1. you submit the pull request (I will test on my ebike)
2. release V0.17 (V0.16 was already release and since the code is for new features, we need to increase to 0.17)
2.1 we should create a wiki page for V0.17, similar to this one: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Usage-and-configuration-of-firmware-version-0.15.x
2.2 release V0.17
 
andyme said:
how do you reset the trip meter?

Thanks for the thumbs up!! :) You reset the trip meter by a short-click followed by a click-hold on the down button until the trip meter value starts blinking and resets.

Down button: short-click click-hold

Or in other words...

Short click down button and then long click down button until the value resets.

You do this when you see the trip distance in the sub field menu. If you switch to odometer or distance-since-power-on you can reset them the same way.
 
casainho said:
Great work!! For the code and the video!!

I was looking at your code changes to review it -- they seem good and I have one note:
You set the odometer by adding 100 km with the up button and subtracting 5 km with the down button. <--- this is clever but on the other side, this only happens to this field and not on the others so it is not consistent over all the configuration menus. Good would be to implement to all menus but I understand is better to have this on this menu than nothing. Maybe even better, as suggested by other user, was to increment at 1 unit and long press on the buttons to increase/decrease automatically at like 10x units.

Next steps I think are needed:
1. you submit the pull request (I will test on my ebike)
2. release V0.17 (V0.16 was already release and since the code is for new features, we need to increase to 0.17)
2.1 we should create a wiki page for V0.17, similar to this one: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Usage-and-configuration-of-firmware-version-0.15.x
2.2 release V0.17

Casainho, thank you so much! Appreciate it a lot! :)

I agree it is better if it works like you said: increment at 1 unit and long press on the buttons to increase/decrease automatically at like 10x units. This could be implemented throughout the system and be very efficient for the user. Maybe future update?

V0.17 is a go! ;D Will submit the pull request as soon as possible and await your feedback!
 
buba said:
I agree it is better if it works like you said: increment at 1 unit and long press on the buttons to increase/decrease automatically at like 10x units. This could be implemented throughout the system and be very efficient for the user. Maybe future update?

V0.17 is a go! ;D Will submit the pull request as soon as possible and await your feedback!
On 850C firmware, I went a bit further:

Code:
struct_var_number lcd_var_number =
  {
    .p_var_number = &p_configuration_variables->ui8_wheel_max_speed,
    .ui8_size = 8,
    .ui8_number_digits = 2,
    .ui8_decimal_digit = 0,
    .ui32_max_value = 99,
    .ui32_min_value = 1,
    .ui32_increment_step = 1
  };

  item_var_set_number(&lcd_var_number, p_menu_data);
I created a function that increases or decreases a specific variable, with a min and max values, and with a specific step rate. Maybe this can be ported to KT-LDC3 to improve current code and maybe I should add that feature of increase/decrease automatically x10 with a button long press. If I do it, I will use the same code for LCD3 and 850C.
 
casainho said:
On 850C firmware, I went a bit further:

Code:
struct_var_number lcd_var_number =
  {
    .p_var_number = &p_configuration_variables->ui8_wheel_max_speed,
    .ui8_size = 8,
    .ui8_number_digits = 2,
    .ui8_decimal_digit = 0,
    .ui32_max_value = 99,
    .ui32_min_value = 1,
    .ui32_increment_step = 1
  };

  item_var_set_number(&lcd_var_number, p_menu_data);

I created a function that increases or decreases a specific variable, with a min and max values, and with a specific step rate. Maybe this can be ported to KT-LDC3 to improve current code and maybe I should add that feature of increase/decrease automatically x10 with a button long press. If I do it, I will use the same code for LCD3 and 850C.

I like that modular setup. Having every variable clearly defined (min/max/increment/decimal and so on) would make the code so much simpler, better and easier to debug. Good way to start with the 850C!
 
andyme said:
casainho said:
andyme said:
I need more time to look into this. PCB is 2 sided black is supposed to be ground. Maybe there are some combinations of wires that are being activated? I will try to measure this, no idea of i will be successful. I will be back with more ..
Try to make the schematic of that board, can be on a paper and then you take a picture.

repost, in case you missed it, casainho

ok, so it goes like this:

wire combination: "button name"

yellow and black: "plus"
green and black : "minus"
yellow and red : "info symbol"
green and red : "light symbol"
blue and red : "power symbol"

Labels:

blue: L1
green: L2
yellow: L3
red: R1
black: GND
 
andyme said:
repost, in case you missed it, casainho
Ok thanks. I don't really know how that works, maybe it is like a matrix like used for keypads... anyway, it depends on hardware and so we are limited for the 850C hardware. I really think is better to keep 850C original hardware and try improve what we can on firmware, like using buttons combination. In the end, I think we are very luck to have 850C on the market, other way we saw that would be worst if we had only models like DPC18 -- for instance, TSDZ2 motor controller is nice because we can program it without open and other alternatives as Bafang, I think they do not have programming cable so would be much worst for our DIY.
 
casainho said:
andyme said:
repost, in case you missed it, casainho
Ok thanks. I don't really know how that works, maybe it is like a matrix like used for keypads... anyway, it depends on hardware and so we are limited for the 850C hardware. I really think is better to keep 850C original hardware and try improve what we can on firmware, like using buttons combination. In the end, I think we are very luck to have 850C on the market, other way we saw that would be worst if we had only models like DPC18 -- for instance, TSDZ2 motor controller is nice because we can program it without open and other alternatives as Bafang, I think they do not have programming cable so would be much worst for our DIY.

sure, it was worth a shot (to me)
 
buba said:
andyme said:
how do you reset the trip meter?

Thanks for the thumbs up!! :) You reset the trip meter by a short-click followed by a click-hold on the down button until the trip meter value starts blinking and resets.

Down button: short-click click-hold

Or in other words...

Short click down button and then long click down button until the value resets.

You do this when you see the trip distance in the sub field menu. If you switch to odometer or distance-since-power-on you can reset them the same way.

can the hex file be downloaded and installed yet?
 
andyme said:
can the hex file be downloaded and installed yet?

It is on my forked repo on GitHub:

https://github.com/leon927/TSDZ2-Smart-EBike

There you can find the hex under releases and then under 0.16.1. The official version will be 0.17 as Casainho has said. You can try it out if you want or wait for the official version!
 
buba said:
andyme said:
can the hex file be downloaded and installed yet?

It is on my forked repo on GitHub:

https://github.com/leon927/TSDZ2-Smart-EBike

There you can find the hex under releases and then under 0.16.1. The official version will be 0.17 as Casainho has said. You can try it out if you want or wait for the official version!

haha...all this i knew...my question came from the fact that i do not know how to download it.... :lol:

what do i need to do? with the other releases, you klick on them and they download automatically. when i click here, the file opens...and i do not see how to download...so this is why i am asking...
 
Back
Top