Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

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?

7162adebca7db96e098888b083e410c6o.png
 
Thanks m8 worked a treat up the volts in advanced settings to overvolt 4.35
Everything works great
 
mbrusa said:
maximusdm said:
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:
// 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:
// 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!
 
josafrik said:
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 ...
 
mbrusa said:
josafrik said:
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.
 
josafrik said:
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
 
stancecoke said:
josafrik said:
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
 
I saw some burning controllers on the other thread.. is this related to the v4.0 of the compiler? :shock:
 
emr said:
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

HTB1NDGXXND1gK0jSZFKq6AJrVXal.jpg


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_2.JPG
 
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 said:
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
 
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
 
wagon-on-the-Lagan said:
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.
 
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

NetbeansClone.PNG

NetbeansProjectExplorer.PNG

How to add parameters to the GUI I've explained a few pages before:
https://endless-sphere.com/forums/viewtopic.php?f=30&t=98281&start=750#p1527683

regards
stancecoke
 
wagon-on-the-Lagan said:
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:

https://endless-sphere.com/forums/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-firmware/TSDZ2_wiki/wiki/How-to-install-brake-sensors#HWB_hidden_wire_brakes_sensor
 
stancecoke said:
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 ...
 
wagon-on-the-Lagan said:
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.
https://endless-sphere.com/forums/viewtopic.php?p=1540873#p1540763
 
mbrusa said:
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:
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
 
mbrusa said:
After several attempts, now no errors, only warnings.

:thumb:

most warnings are imported, but not used libraries. You can simply delete those rows. So your self built GUI is working now?
I'm looking foreward to see your improved configurator!

regards
stancecoke
 
Back
Top