Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
mbrusa   100 W

100 W
Posts: 101
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 17 2020 3:51pm

bingo5, ilu
I did not believe it but it is just like that, with the version on GitHub the temperature control does not work.

For stancecoke
The problem is: #include "advanced.h"
it must be in the main.h file, some definitions are used there, and from there it is included in other files.
In the check that I did, I also found a small bug, the error E06 was not always displayed.
I attach the correct files, if you can update GitHub. Thank
TSDZ2-mb.20beta1.A-update.zip
(23.13 KiB) Downloaded 38 times
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Mar 18 2020 1:51am

mbrusa wrote:
Mar 17 2020 3:51pm
I attach the correct files, if you can update GitHub.
Done! Thank you for fixing!

https://github.com/stancecoke/TSDZ2-Sma ... 27de01cc8a

regards
stancecoke

bingo5   10 mW

10 mW
Posts: 27
Joined: Jul 04 2019 12:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by bingo5 » Mar 18 2020 4:09am

Thanks a lot mbrusa and stancecoke.
I will test the new github version in a few hours. At the moment I am still at work and afterwards I first want to modify my engine for better heat dissipation. If the problem still exists I will upload my config.

bingo5   10 mW

10 mW
Posts: 27
Joined: Jul 04 2019 12:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by bingo5 » Mar 18 2020 12:59pm

Unfortunately I did not manage to modify the cooling system. But I could test the new Github version. Now the display and limit function works as intended :D Thanks a lot! Also the overrun fix works great.

But... I think your E06 fix is not that good, because the error code (when reaching the MOTOR_TEMPERATURE_X_VALUE_LIMIT ) blocks the display and you can't see or adjust anything else. A short announcement would be better.

And another problem: after displaying another value (e.g. temperature) the current speed is often not displayed for a while. Instead, the display shows only "0.00" for some minutes.

Apart from that, the firmware is a lot of fun! :D

flufferty   100 mW

100 mW
Posts: 37
Joined: Apr 22 2017 4:00pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by flufferty » Mar 18 2020 1:42pm

bingo5 wrote:
Mar 18 2020 12:59pm
And another problem: after displaying another value (e.g. temperature) the current speed is often not displayed for a while. Instead, the display shows only "0.00" for some minutes.
If I recall correctly that is a feature. Since the speedometer is used to display values, the odometer gets wrong values, so the speedometer stays 0 for a while to compensate.

bingo5   10 mW

10 mW
Posts: 27
Joined: Jul 04 2019 12:37am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by bingo5 » Mar 18 2020 3:34pm

flufferty wrote:
Mar 18 2020 1:42pm
If I recall correctly that is a feature. Since the speedometer is used to display values, the odometer gets wrong values, so the speedometer stays 0 for a while to compensate.
That makes sense. Thanks, then I'll turn off the compensation.

mbrusa   100 W

100 W
Posts: 101
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 18 2020 3:57pm

bingo5 wrote:
Mar 18 2020 12:59pm
Unfortunately I did not manage to modify the cooling system. But I could test the new Github version. Now the display and limit function works as intended :D Thanks a lot! Also the overrun fix works great.

But... I think your E06 fix is not that good, because the error code (when reaching the MOTOR_TEMPERATURE_X_VALUE_LIMIT ) blocks the display and you can't see or adjust anything else. A short announcement would be better.

And another problem: after displaying another value (e.g. temperature) the current speed is often not displayed for a while. Instead, the display shows only "0.00" for some minutes.

Apart from that, the firmware is a lot of fun! :D
All error codes block the use of the display because I have given them priority, it is a problem I know and I have already solved, the change will be in the next version.
For the odometer they have already answered.
The display always interprets the data received as speed and increases the odometer even when the bike is stationary, the speed remains at zero until the added kilometers are compensated.
If the accuracy of the kilometers is not important to you and you prefer to see the speed immediately, you must set ENABLE_ODOMETER_COMPENSATION to zero.
Well, I'm happy to hear that "fix overrun" works.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Mar 19 2020 4:42am

mbrusa wrote:
Mar 17 2020 3:51pm
I attach the correct files, if you can update GitHub
A question to all users: is it still valuable to have the java configurator? To be honest, I don't feel like updating my repo with mbrusa's developments all the time.
I think it's confusing for unexperienced users to have one version without the configurator from various zip-files published in the forums and one with the configurator from github...

regards
stancecoke

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 19 2020 3:23pm

just done my first firmware with marcos software all seem to be ok apart from my throttle no longer works I have enabled it to 1 in advanced settings but do I also have to enable the assist without peddaling on the main screen.
cheers

cejean   100 µW

100 µW
Posts: 9
Joined: Jul 20 2019 5:41pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by cejean » Mar 19 2020 5:24pm

stancecoke wrote:
Mar 19 2020 4:42am
mbrusa wrote:
Mar 17 2020 3:51pm
I attach the correct files, if you can update GitHub
A question to all users: is it still valuable to have the java configurator? To be honest, I don't feel like updating my repo with mbrusa's developments all the time.
I think it's confusing for unexperienced users to have one version without the configurator from various zip-files published in the forums and one with the configurator from github...

regards
stancecoke
For me its verry helpfull to have the java configurator. Thank you mr. Stancecoke for making that great tool! :wink:
After MarcoQ took a breake it was nice to see that you and Mbrussa did put time and energy into this project for all TSDZ2 users worldwide.
I hope you both will continue to do this for people like me.

:thumb: Many, many thanks fot that! :thumb:

maximusdm   10 W

10 W
Posts: 90
Joined: Sep 08 2018 12:51pm

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by maximusdm » Mar 20 2020 6:01am

Hi mbrusa,

I plan to add the overrun fix to the LCD3 version.
LE: I noticed in lcd3 thread taht you already did it :). But my question still stands.

I noticed that in case of STANDARD_MODE there is

Code: Select all

// for overrun problem
ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 4));
and in case of ADVANCED_MODE there is

Code: Select all

// for overrun problem
ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 2));
Can you please explain?

Thanks,
Max.

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 20 2020 12:30pm

Hi i have updated my firmware with the latest one everything seems to work except my throttle which i like to use i have tried altering the settins in the advanced txt file from zero to one but with no job any help much appreciated i have a tsdz2 48v

mbrusa   100 W

100 W
Posts: 101
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 21 2020 2:11am

maximusdm wrote:
Mar 20 2020 6:01am
Hi mbrusa,

I plan to add the overrun fix to the LCD3 version.
LE: I noticed in lcd3 thread taht you already did it :). But my question still stands.

I noticed that in case of STANDARD_MODE there is

Code: Select all

// for overrun problem
ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 4));
and in case of ADVANCED_MODE there is

Code: Select all

// for overrun problem
ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 2));
Can you please explain?

Thanks,
Max.
Hi maximusdm
If you only ask this question I think you understand the rest of the change.
Synthesizing.
To minimize the overrun time I had to add another control method for stationary pedals, and above all I had to put all the code in motor.c inside the PWM cycle function that runs every 64us (first, part of the code was in ebike_app.c which runs every 0.1 sec).
"ui16_cadence_sensor_ticks" is the number of pulses, at the PWM frequency, between one step of the cadence sensor and the next, and is inversely proportional to the speed.
"ui16_cadence_sensor_ticks_counter" is the counter of these impulses, when the pedal stops the counter does not immediately reset, continues to count.
When it reaches the value of "ui16_cadence_sensor_ticks_stop" the padals are considered stationary.
"ui16_cadence_sensor_ticks_stop" is calculated with the last valid value of "ui16_cadence_sensor_ticks" by adding an extra number of pulses.
To establish how proportionally the number of extra pulses must be, I have not made any calculations, I have obtained the optimal values ​​experimentally.

Optimal value detected in standard mode
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 4));"
equivalent to (ui16_cadence_sensor_ticks * 1.06)

Optimal value detected in advanced mode
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 2));"
equivalent to (ui16_cadence_sensor_ticks * 1.25)

The calculation factor of the extra pulses is different in the two modes because the value of "ui16_cadence_sensor_ticks" is different, at the same speed, in advanced mode it is on average the half of the standard one.
I want to highlight that by increasing the calculated value of "ui16_cadence_sensor_ticks_stop", increases the overrun time, decreasing it lacks startup assistance.
I had reports of too fast stops and a case of lack startup assistance.
For this reason, in the next full version I will slightly increase the calculated values.
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 3)));" in standard mode,
"ui16_cadence_sensor_ticks_stop = (ui16_cadence_sensor_ticks + (ui16_cadence_sensor_ticks >> 1));" in advanced mode,
or maybe I'll add editable parameters in the config.h file.
Last edited by mbrusa on Mar 21 2020 9:34am, edited 2 times in total.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

mbrusa   100 W

100 W
Posts: 101
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 21 2020 2:31am

Suggy wrote:
Mar 20 2020 12:30pm
Hi i have updated my firmware with the latest one everything seems to work except my throttle which i like to use i have tried altering the settins in the advanced txt file from zero to one but with no job any help much appreciated i have a tsdz2 48v
With the latest version, on the Italian forum I had confirmation that the throttle works.
Do you use it in street mode? By default it is enabled only in offroad mode.
To enable it also in street mode, set STREET_MODE_THROTTLE_ENABLED to 1.
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 5:17am

Can you point me in the right direction to the latest software and firmware in case i am using the wrong one cheers

Elinx   100 W

100 W
Posts: 233
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Mar 21 2020 5:25am

Suggy wrote:
Mar 21 2020 5:17am
Can you point me in the right direction to the latest software and firmware in case i am using the wrong one cheers
The version on stancecoke github is the latest version with overrunfix and corrected temperature reading.
The difference between mbrusa's version and the one on github is the configurator for basic settings, that is missing with mbrusa's version. Meaning that you must use an text editor for all settings with mbrusa's and only the advanced settings with stancecoke's.
Last edited by Elinx on Mar 21 2020 5:35am, edited 1 time in total.

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 5:34am

Thank you so which version should i use lol

Elinx   100 W

100 W
Posts: 233
Joined: Aug 09 2019 6:58am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Elinx » Mar 21 2020 5:35am

Suggy wrote:
Mar 21 2020 5:34am
Thank you so which version should i use lol
That is on you, both are equal, but stancecoke has all repair inside his distribution and with mbrusa you must replace some files.

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 5:43am

Can you give me a link for both thank you

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 6:31am

I am now trying the stancoke version from github but getting this error when flashing
8A2BB321-1628-4325-B53C-EA8954940099.jpeg
8A2BB321-1628-4325-B53C-EA8954940099.jpeg (381.77 KiB) Viewed 852 times

User avatar
stancecoke   100 kW

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

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by stancecoke » Mar 21 2020 7:48am

Suggy wrote:
Mar 21 2020 6:31am
but getting this error when flashing
Have you read the wiki? It is obvious, that the STVP_CmdLine.exe is in the wrong folder. It has to be in

C:\STMicroelectronics\st_toolset\stvp

Or you have to set the correct path in the flash.bat.

regards
stancecoke

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 9:40am

Finally got it to work flashing i have tried all setting using the latest firmware but throttle still does not work can someone post an image of there settings in the advanced so i can compare

mbrusa   100 W

100 W
Posts: 101
Joined: Dec 11 2019 12:13am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by mbrusa » Mar 21 2020 3:23pm

Suggy wrote:
Mar 21 2020 9:40am
Finally got it to work flashing i have tried all setting using the latest firmware but throttle still does not work can someone post an image of there settings in the advanced so i can compare
Have you read the guide and manual?
Have you enabled throttle and brake sensor?

#define ENABLE_BRAKE_SENSOR 1
#define ENABLE_THROTTLE 1
#define ENABLE_TEMPERATURE_LIMIT 0
Flexible OpenSource firmware for TongSheng TSDZ2 motor and VLCD5 VLCD6 XH18 displays
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 3:57pm

I am using stancecoke latest gui with those settings

Suggy   10 mW

10 mW
Posts: 22
Joined: Mar 06 2020 6:57am

Re: Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Post by Suggy » Mar 21 2020 4:14pm

Just an update finally working throttle i had not enabled brake sensor doh
Sorry to everyone being a pain

Post Reply