Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Electric Motors and Controllers
Elinx   100 W

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

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

Post by Elinx » Mar 21 2020 5:04pm

Suggy wrote:
Mar 21 2020 4:14pm
... finally working throttle ...
Sorry to everyone being a pain
:thumb:

Suggy   1 mW

1 mW
Posts: 13
Joined: Mar 06 2020 6:57am

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

Post by Suggy » Mar 22 2020 6:02am

Finally my tsdz2 bike works from a fresh battery charge but ime getting the error on screen E0 8 which is battery over voltage will this do some harm to the motor if i use the bike until the voltage drops from use.
Before the firmware update the motor would struggle to get going until the voltage dropped.

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

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

Post by mbrusa » Mar 22 2020 10:26am

Suggy wrote:
Mar 22 2020 6:02am
Finally my tsdz2 bike works from a fresh battery charge but ime getting the error on screen E0 8 which is battery over voltage will this do some harm to the motor if i use the bike until the voltage drops from use.
Before the firmware update the motor would struggle to get going until the voltage dropped.
Suggy do not think I understand correctly, perhaps because of the translation.
First I will explain E08 then you will confirm me.
Error E08 "overvoltage" is displayed when the battery voltage detected by the controller is higher than expected. The comparison voltage is calculated with BATTERY_CELLS_NUMBER (13 for 48V motor) multiplied LI_ION_CELL_OVERVOLT (4.30 V), if the voltage measured by the controller exceeds this value, the error occurs. It is used only to verify that the number of cells corresponds to that of the connected battery. Check in the advanced.h file the number of cells inserted, if it is correct you can increase the value of LI_ION_CELL_OVERVOLT to 4.35.
It would be better to change the adc conversion factor of the voltage, but it is more complicated.
This error does not limit the operation of the motor, it better explains the problem encountered.

josafrik   1 mW

1 mW
Posts: 11
Joined: Aug 27 2019 1:26pm

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

Post by josafrik » Mar 22 2020 12:58pm

Hello, after having managed to have no errors when connecting the stlink with the stvp program, now when trying to compile the latest firmware I get errors and the process does not continue ...
I have downloaded all the necessary programs in C: ST software, SDCC compiler and firmware

Some help?

Image

Suggy   1 mW

1 mW
Posts: 13
Joined: Mar 06 2020 6:57am

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

Post by Suggy » Mar 22 2020 2:14pm

Thanks m8 worked a treat up the volts in advanced settings to overvolt 4.35
Everything works great

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 23 2020 9:52am

mbrusa wrote:
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.
Your explanations are very clear! Thank you very much!

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

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

Post by mbrusa » Mar 23 2020 10:41am

josafrik wrote:
Mar 22 2020 12:58pm
Hello, after having managed to have no errors when connecting the stlink with the stvp program, now when trying to compile the latest firmware I get errors and the process does not continue ...
I have downloaded all the necessary programs in C: ST software, SDCC compiler and firmware
Some help?
The main.ihx file is not found.
Are you sure that the compilation went well?
In the screen you posted we should see the previous lines ...

josafrik   1 mW

1 mW
Posts: 11
Joined: Aug 27 2019 1:26pm

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

Post by josafrik » Mar 23 2020 12:05pm

mbrusa wrote:
Mar 23 2020 10:41am
josafrik wrote:
Mar 22 2020 12:58pm
Hello, after having managed to have no errors when connecting the stlink with the stvp program, now when trying to compile the latest firmware I get errors and the process does not continue ...
I have downloaded all the necessary programs in C: ST software, SDCC compiler and firmware
Some help?
The main.ihx file is not found.
Are you sure that the compilation went well?
In the screen you posted we should see the previous lines ...
I have tried the compilation again and those lines have appeared ... I don't know why they didn't come out the previous time. It continues to fail and the process does not end.
Image

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Mar 23 2020 1:12pm

josafrik wrote:
Mar 23 2020 12:05pm
I have tried the compilation again and those lines have appeared ...
process_begin: CreateProcess(NULL,....
El sistema no puede encontrat el archivo especificado
The system can't find the sdcc.exe. There seem to be something wrong with your path definitions...
Have you installed sdcc and activated the "Set path" checkbox at the end of the installation procedure?

can you please check your sdcc-version?

@mbrusa can you do the same?
Open a cmd/terminal-window and type sdcc -v

see the other thread...

regards
stancecoke

josafrik   1 mW

1 mW
Posts: 11
Joined: Aug 27 2019 1:26pm

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

Post by josafrik » Mar 23 2020 7:17pm

stancecoke wrote:
Mar 23 2020 1:12pm
josafrik wrote:
Mar 23 2020 12:05pm
I have tried the compilation again and those lines have appeared ...
process_begin: CreateProcess(NULL,....
El sistema no puede encontrat el archivo especificado
The system can't find the sdcc.exe. There seem to be something wrong with your path definitions...
Have you installed sdcc and activated the "Set path" checkbox at the end of the installation procedure?

can you please check your sdcc-version?

@mbrusa can you do the same?
Open a cmd/terminal-window and type sdcc -v

see the other thread...

regards
stancecoke
Thank you very much, that was the problem, I had not activated "set path" checkbox, now I will mount everything and test the bike with the new firmware

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

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

Post by mbrusa » Mar 24 2020 12:30am

stancecoke wrote:
Mar 23 2020 1:12pm
@mbrusa can you do the same?
Open a cmd/terminal-window and type sdcc -v
regards
stancecoke
I use SDCC 3.9.0 with windows 10, never had problems.

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Mar 24 2020 4:29am

mbrusa wrote:
Mar 24 2020 12:30am
I use SDCC 3.9.0 with windows 10, never had problems
Thank you for the feedback! Is anyone using SDCC 4.0.0 already?

regards
stancecoke

josafrik   1 mW

1 mW
Posts: 11
Joined: Aug 27 2019 1:26pm

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

Post by josafrik » Mar 24 2020 4:53am

stancecoke wrote:
Mar 24 2020 4:29am
mbrusa wrote:
Mar 24 2020 12:30am
I use SDCC 3.9.0 with windows 10, never had problems
Thank you for the feedback! Is anyone using SDCC 4.0.0 already?

regards
stancecoke
I forgot to say that I use 4.0.0

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Mar 24 2020 5:45am

josafrik wrote:
Mar 24 2020 4:53am
I forgot to say that I use 4.0.0
Thank you, so hopefully you won't get magic smoke!

regards
stancecoke

thineight   100 W

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

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

Post by thineight » Mar 25 2020 3:02pm

I saw some burning controllers on the other thread.. is this related to the v4.0 of the compiler? :shock:
MTB KTM Ultra 29" - City bike DAYTONA 28"

emr   100 mW

100 mW
Posts: 47
Joined: Apr 22 2018 5:37am

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

Post by emr » Mar 26 2020 2:54am

emr wrote:
Mar 06 2020 7:41am

I found this item, which appears to be what we need for the Gear shift sensing as it connects to the existing VLCD5 brake sensor sockets, but it doesn't appear to use 5v source. Unsure how it can work without the 5v. It also has brake sensors suitable for hydraulic brakes...
https://www.aliexpress.com/item/33060254663.html

Image

I purchased one of these gear sensors and have fitted it near the gear changer on the handlebar. I haven't tested on the road but I can confirm it does turn the motor off momentarily (maybe 0.5 of a second (estimated)) when changing gears on the workstand. I suspect it will be the solution to the IGH issue of needing to stop pedalling to allow the hub to change gears.
GearSensor_1.jpg
GearSensor_1.jpg (52.81 KiB) Viewed 314 times
GearSensor_2.JPG
GearSensor_2.JPG (176.53 KiB) Viewed 314 times

emr   100 mW

100 mW
Posts: 47
Joined: Apr 22 2018 5:37am

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

Post by emr » Mar 26 2020 5:39pm

Firstly, let me say how appreciative I am of the effort that has been put in by all the people involved in the development of the open source software for the TSDZ2. In particular the team who developed the version for the original displays (VLCD5 in my case). So thanks MBrusa for the latest version and Stancecoke for the redesigned configurator and making the open source files available on GitHub.

Now to my question...
I had previously been using the Marcoq configurator and had 'Street mode' enabled as default at startup. When I turned the system on, I would press the lights button to change to E04, which would disable the street mode limits and allow speeds greater than 25kph etc. I have read the 'EN-Manual_display operation-TSDZ2-mb.20beta1.A.pdf' but am unsure how to perform the same process using the MBrusa version available at 'https://github.com/stancecoke/TSDZ2-Smart-EBike'.

emr   100 mW

100 mW
Posts: 47
Joined: Apr 22 2018 5:37am

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

Post by emr » Mar 26 2020 11:20pm

emr wrote:
Mar 26 2020 5:39pm
Firstly, let me say how appreciative I am of the effort that has been put in by all the people involved in the development of the open source software for the TSDZ2. In particular the team who developed the version for the original displays (VLCD5 in my case). So thanks MBrusa for the latest version and Stancecoke for the redesigned configurator and making the open source files available on GitHub.

Now to my question...
I had previously been using the Marcoq configurator and had 'Street mode' enabled as default at startup. When I turned the system on, I would press the lights button to change to E04, which would disable the street mode limits and allow speeds greater than 25kph etc. I have read the 'EN-Manual_display operation-TSDZ2-mb.20beta1.A.pdf' but am unsure how to perform the same process using the MBrusa version available at 'https://github.com/stancecoke/TSDZ2-Smart-EBike'.
I have found that this can be accomplished when in ECO mode by pressing the 'Lights' button once to enter E02, and then pressing the 'Lights' button again, but only after setting the 'ENABLE_SET_PARAMETER_ON_STARTUP' to 1 in the 'Advanced settings'

Cheers Emma

wagon-on-the-Lagan   1 µW

1 µW
Posts: 1
Joined: Mar 16 2020 2:38am

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

Post by wagon-on-the-Lagan » Mar 27 2020 2:27am

Hi Emma,

hope your health is good in these very strange times!!

i just seen your post on ES about gear sensor on Alien Exspress for the TSDZ2 - below is a copy of an Email i sent to Eco -cycles in Nashville USE. im in Belfast ,Northern ireland.

as you will read below i have a cargo bike with an IGH. you mention a ~ 0.5s when shifting, stupid question time; is the bike in question got stock TS firmware, or OSF of some sort onthe display and motor?


anyway, the email:
Im an Electronics design engineer, 20 years’ experience, also designing Dynamo products..
Im also kitted with a decent mechanical workshop too, frame building and CNC..



I obtained a TSDZ2 kit 4 days ago; stock 48v, 500w, vlcd-5, brake and throttle levers included but not using.

I have a TSDz2 on a cargo bike, fitted with a Nexus 8 speed. Im happy with setup, apart from 1 issue.
When climbing uphill, sustained, (total rider, bike and cargo weight of 170kg) I sometimes need to downshift!

I rode the bike non electrified for 3 years until 3 days ago, so habitually to change gear, I ease of pedalling, change gear etc, increase effort again.
But the TSDz2 (stock 48v, 500w, vlcd-5 display) lags too long, still sending power to the nexus hub, which on a steep hill, laden is now still engaged.

If your familiar with shimano IGH’s, they don’t like that one bit, being reverse to most derailler systems. (lets ignore 90’s shimano Nexave).

The poor hub doesn’t get enough time under no load to relieved the spring tension and drop into a (edit) lower gear.

Is there a solution for the Tongshen:
-in the form of a gear shift sensor?
-custom firmware via the OSF to reduce the power delivery “decay” rapidly when I easy of to shift?

I have those brake sensor levers which I considered using the connector, hacking it to one of those bafang gear shift sensors, and goofing the Firmware to stop delivery power for a very brief interlude.

BUT, im sure im not the first to come across this problem?......



thanks,

Bruce Watson,

Founder – Harvolt LTD, Belfast, Northern Ireland.
www.Harvolt.com

emr   100 mW

100 mW
Posts: 47
Joined: Apr 22 2018 5:37am

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

Post by emr » Mar 27 2020 3:20am

wagon-on-the-Lagan wrote:
Mar 27 2020 2:27am
Hi Emma,

as you will read below i have a cargo bike with an IGH. you mention a ~ 0.5s when shifting, stupid question time; is the bike in question got stock TS firmware, or OSF of some sort onthe display and motor?
I have a 48v TSDZ2 with 52v 14s battery. Using the standard VLCD5 display. I have installed the Open Source firmware v20 available from Github...
https://github.com/stancecoke/TSDZ2-Smart-EBike

I took it for a ride today and the functional delay from motor stopping to reapplication of power is about one second. It enables me to continue pedalling while changing gears, although I do reduce my own effort slightly, just as is required with normal unassisted riding with an IGH.

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Mar 27 2020 5:07am

I've added the whole Netbeans project structure for the configurator to github now, so you can easily import it to netbeans. You should fork my repo first and import from your own fork to be able to push your commits back to github.
NetbeansTeam.PNG
NetbeansTeam.PNG (25.48 KiB) Viewed 225 times
NetbeansClone.PNG
NetbeansClone.PNG (16.95 KiB) Viewed 225 times
NetbeansProjectExplorer.PNG
NetbeansProjectExplorer.PNG (21.24 KiB) Viewed 225 times
How to add parameters to the GUI I've explained a few pages before:
viewtopic.php?f=30&t=98281&start=750#p1527683

regards
stancecoke

ilu   10 mW

10 mW
Posts: 34
Joined: Oct 18 2019 10:51am

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

Post by ilu » Mar 27 2020 6:22am

wagon-on-the-Lagan wrote:
Mar 27 2020 2:27am
Is there a solution for the Tongshen:
-in the form of a gear shift sensor?
-custom firmware via the OSF to reduce the power delivery “decay” rapidly when I easy of to shift?

I have those brake sensor levers which I considered using the connector, hacking it to one of those bafang gear shift sensors, and goofing the Firmware to stop delivery power for a very brief interlude.

BUT, im sure im not the first to come across this problem?......
Hi Bruce! Please check the discussion in this thread just a few pages back:

viewtopic.php?f=30&t=98281&start=825#p1533489

Revhers solution is a bit more complicated but apparently works better (shorter cut-off time) for him than using gear sensor in place of a brake sensor, although that is definetely also an option:

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

mbrusa   1 W

1 W
Posts: 52
Joined: Dec 11 2019 12:13am

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

Post by mbrusa » Mar 27 2020 10:56am

stancecoke wrote:
Mar 27 2020 5:07am
I've added the whole Netbeans project structure for the configurator to github now, so you can easily import it to netbeans. You should fork my repo first and import from your own fork to be able to push your commits back to github.
Unfortunately, even changing the version of NetBeans and importing the project, always the same errors ...

jeff.page.rides   10 W

10 W
Posts: 96
Joined: Aug 13 2019 10:16am

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

Post by jeff.page.rides » Mar 27 2020 12:20pm

wagon-on-the-Lagan wrote:
Mar 27 2020 2:27am
Hi Emma,

hope your health is good in these very strange times!!

i just seen your post on ES about gear sensor on Alien Exspress for the TSDZ2 - below is a copy of an Email i sent to Eco -cycles in Nashville USE. im in Belfast ,Northern ireland.

as you will read below i have a cargo bike with an IGH. you mention a ~ 0.5s when shifting, stupid question time; is the bike in question got stock TS firmware, or OSF of some sort onthe display and motor?


anyway, the email:
Im an Electronics design engineer, 20 years’ experience, also designing Dynamo products..
Im also kitted with a decent mechanical workshop too, frame building and CNC..



I obtained a TSDZ2 kit 4 days ago; stock 48v, 500w, vlcd-5, brake and throttle levers included but not using.

I have a TSDz2 on a cargo bike, fitted with a Nexus 8 speed. Im happy with setup, apart from 1 issue.
When climbing uphill, sustained, (total rider, bike and cargo weight of 170kg) I sometimes need to downshift!

I rode the bike non electrified for 3 years until 3 days ago, so habitually to change gear, I ease of pedalling, change gear etc, increase effort again.
But the TSDz2 (stock 48v, 500w, vlcd-5 display) lags too long, still sending power to the nexus hub, which on a steep hill, laden is now still engaged.

If your familiar with shimano IGH’s, they don’t like that one bit, being reverse to most derailler systems. (lets ignore 90’s shimano Nexave).

The poor hub doesn’t get enough time under no load to relieved the spring tension and drop into a (edit) lower gear.

Is there a solution for the Tongshen:
-in the form of a gear shift sensor?
-custom firmware via the OSF to reduce the power delivery “decay” rapidly when I easy of to shift?

I have those brake sensor levers which I considered using the connector, hacking it to one of those bafang gear shift sensors, and goofing the Firmware to stop delivery power for a very brief interlude.

BUT, im sure im not the first to come across this problem?......



thanks,

Bruce Watson,

Founder – Harvolt LTD, Belfast, Northern Ireland.
www.Harvolt.com
I have the same problem on my handcycle. I have purchased a shift sensor but haven't installed it yet. Here's a link from another forum where he has just installed the shift sensor.
viewtopic.php?p=1540873#p1540763

User avatar
stancecoke   100 kW

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

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

Post by stancecoke » Mar 27 2020 12:32pm

mbrusa wrote:
Mar 27 2020 10:56am
Unfortunately, even changing the version of NetBeans and importing the project, always the same errors ...
Hm, strange. Can you post the content of the output window? Have you waited until the end of the "search for projects" process after importing from git?

Code: Select all

ant -f "F:\\Eigene Dateien\\NetBeansProjects\\TSDZ2-Smart-EBike\\tools\\Java_Configurator_Source" -Dnb.internal.action.name=run run
init:
Deleting: F:\Eigene Dateien\NetBeansProjects\TSDZ2-Smart-EBike\tools\Java_Configurator_Source\build\built-jar.properties
deps-jar:
Updating property file: F:\Eigene Dateien\NetBeansProjects\TSDZ2-Smart-EBike\tools\Java_Configurator_Source\build\built-jar.properties
Copying 1 file to F:\Eigene Dateien\NetBeansProjects\TSDZ2-Smart-EBike\tools\Java_Configurator_Source\build\classes
compile:
run:
BUILD SUCCESSFUL (total time: 12 seconds)
regards
stancecoke
NetbeansOutputWindow.PNG
NetbeansOutputWindow.PNG (160.38 KiB) Viewed 183 times

Post Reply