TSDZ2 OSF for all displays, VLCD5-VLCD6-XH18, LCD3, 860C-850C-SW102.

:bigthumb: :bigthumb: :bigthumb:
mbrusa said:
Thanks for the compliments.
In October I resumed development, the voltage calibration is already done and other improvements as well.
But the priority is for the stock display version, then the 860C version will follow.
 
mbrusa said:
Thanks for the compliments.

Hello mbrusa,
I want to join the crowd ;)
I can only agree with all the praise for your software. The TSDZ2 with the stock firmware is a nifty little machine already, but it really shines with yours. And the configurator makes everything really easy for dummies like me.

As you are back to programming I want to share my experience and measurements.

I have three touring bikes with different gearhubs (I am kind of a gearhub guy ;).
My motor is 36V and the battery is 36V too. (Display is VLCD6)
The biggest nuisance with the stock firmware was that the assistance all but vanished when pedalling with cadence higher than 65.

With version v20.1C.1 this was gone, and I did not even activate field weakening.
Everything was smoother and quieter too and switching gears of a SturmeyArcher (which is switching very quickly and nicely) worked better too.
So far I used power mode only (no power boost) and I am totally happy with that.

I have a second bike with an Alfine11 gearhub. This one is not switching so well if there is still some thrust on the chain and v20.1C.1 takes too long for my taste to reduce the thrust to get a decent switching experience with Alfine11.
So I tried version v20.1C.3new for stock displays. That is a big improvement and with deceleration set to 100% it works like a charm. The same is true with a Rohloff gearhub.

I did not ride very much (about 100km up to now) and I did not have any stability problems with version v20.1C.3new.
In hilly terrain it might be different but not many hills here in northern Germany.

So far there was only one issue. I tried to measure the ‘Pedal torque ADC step’ value. But with VLCD6 that proved to be tricky. I changed the ‘Time to menu items (0.1s)’ value to 100 for easier button presssing. But after switching to the procedure for measuring the ‘Pedal torque ADC step’ there was a problem.
With v20.1C.1 the value in the display increased too slowly. The display switched back before reaching ’20’. Therefore I used a lower weight (14kg) and only then ‘walk assist’ reached ’14’ in time but the display showed the result only for tenth of a second. I got 68 as a result , I am not sure this is correct.
With v20.1C.3new (same settings, except deceleration set to 100) the value was - surprisingly - increasing faster and I could get a measurement for 20 kg. But again the result was shown only for a very short time. I got 42 as a result (;)
As I understand it the ‘Pedal torque ADC step’ value is needed only for the calculation of human power and otherwise acts as a general parameter to scale assist levels. So I kept it at the default 67 for both bikes.

A very big thank from my side for the great work!
 
I tried for quite some time to adjust the assistance levels to get a good gradation of levels. I wanted to have a comparable experience with both bikes, but that was not easy to do as one is a recumbent and the other is not.
On the other hand I measured the min max ADC values and found that one sensor has a low range and the other a large one.
ADC offset 195 —> ADC max 268 —> Range 73
ADC offset 155 —> ADC max 300 —> Range 145

I entered these values and activated ‘Torque sensor calibrated’ but did not get similar results in both bikes. Only after raising the assist levels for the low range sensor bike quite a bit the experience of the bikes became more similar.

It would be great to know more about the way the assist function is calculated, at least for the power assist function.
Something in the form of the excel sheet you provided for the power boot would be great. An alternative could be formulas used for calculating the motor current (or PWM duty cycle?) from ADC values.

As the sensors are obviously quite different I had no idea which detail had which effect.
To get to the bottom of things I decided to measure the torque-ADC-relationship as precisely as possible.

First I measured the ADC offset. This depends on the position of the pedals. Turning the axis results in a change of the value. There is a maximum position and about 180° opposed it is in minimum position. The difference is quite noticeable. (193-197 and 152-157)
The max offset position produces higher ADC values throughout the whole torque range up to the maximum and the difference increases. (264-272 and 291-308)
The result is that in one revolution the ADC value changes from 264 to 272 and back when pedalling with super high torque (thrust on the pedal).

Here are the full measurements for both sensors/motors [all measurements at room temperature]
Interestingly the display switched between different ADC values for some data points. Sometimes with a difference higher than 1. (Like 185-187-185-…) In these cases I used the average of the values.
Measurements-TSDZ2_sensors.png

Left is the measurement (green/blue is one sensor and red/orange the other one of course).
On the right side I rescaled the low range sensor results so that the ranges match. (maybe this can be done by adjusting ‘Pedal torque ADC step’?)
Obviously there is no simple scaling that would transform my low range sensor into something like my large range sensor.

The large range sensor shows a nice linear slope up to about 28 Nm. That translates to ≈220W human power with cadence 75/min.
Above that the slope is much flatter.

After adjusting for range the low range sensor starts out with a much higher slope that flattens gradually. The result is a boost when pedalling with low torque.
 
Hi Olie, welcome to the experimenters.
Attention: With v20.1C.3-NEW for stock displays, there is a potential risk of mosfet burn.
I understand that there are many improvements over v20.1C.1, including the deceleration ramp, but better not take the risk.
The calibration procedure is also better with v10.1C.3, but if you want to measure the torque value at multiple points with different weights, better to use another method(also with v20.1C.1).
Set in the configurator:
Data 1 = 6 (adc torque sensor)
Time to displayed data 1 = 0 (unlimited)
Number of data dispayed at lights on = 1
Turning on the lights you will have the adc torque sensor value on the display without time limits.
To get more stable values, it is best to take a short ride before doing the calibration.

Those who have more than one bike immediately realize that the torque sensors are all different, both in terms of range and curve, unfortunately it is well known.
Regarding the graphs you posted, the values ​​to be used are not the measured ones, but those of the range (measured value - offset value), the curves must all start from zero.
Calibration is used to amplify the values ​​of sensors with limited range, as you have assumed in the graph on the right. But the curves will always be different.
However, you can change the amplification by changing the value of "Pedal torque adc max", decreasing the value, the amplification increases, and vice versa.
 
mbrusa said:
Attention: With v20.1C.3-NEW for stock displays, there is a potential risk of mosfet burn.
I understand that there are many improvements over v20.1C.1, including the deceleration ramp, but better not take the risk.
I know, but took the risk anyway. If I kill my controller I can live with that.
But changing gears is so much better and my gearhub is much more expensive than a controller.
mbrusa said:
The calibration procedure is also better with v10.1C.3, but if you want to measure the torque value at multiple points with different weights, better to use another method(also with v20.1C.1).
Set in the configurator:
Data 1 = 6 (adc torque sensor)
Time to displayed data 1 = 0 (unlimited) ...
That is what I did. But for measuring the ‘Pedal torque ADC step’ this does not work, or does it? It is a different procedure.
mbrusa said:
Those who have more than one bike immediately realize that the torque sensors are all different, both in terms of range and curve, unfortunately it is well known.
Regarding the graphs you posted, the values ​​to be used are not the measured ones, but those of the range (measured value - offset value), the curves must all start from zero.
Sure, but I wanted to show the raw data. The graphs show what is really going on with the sensors when you pedal with different thrust (torque).
And the zero point can be chosen by calibration, so it is somewhat arbitrary.
Some of the stability problems might arise from the fact that the ADC values depend on angle. Together with temperature drift the zero point might not always actually produce 'zero.'
mbrusa said:
Calibration is used to amplify the values ​​of sensors with limited range, as you have assumed in the graph on the right. But the curves will always be different.
However, you can change the amplification by changing the value of "Pedal torque adc max", decreasing the value, the amplification increases, and vice versa.
"Pedal torque adc max" decides the amplification? Or is it the difference "Pedal torque adc max" - "Pedal torque adc offset" ?
What is the role of "Pedal torque adc step"? It has no influence on amplification?

Thanx Olie
 
Olie said:
I know, but took the risk anyway. If I kill my controller I can live with that.
But changing gears is so much better and my gearhub is much more expensive than a controller.
I understand, you chose the least damage :D
The important thing is to be aware.
That is what I did. But for measuring the ‘Pedal torque ADC step’ this does not work, or does it? It is a different procedure.
For the calibration of "Pedal torque adc step" there is only the procedure described in the manual.
Sure, but I wanted to show the raw data. The graphs show what is really going on with the sensors when you pedal with different thrust (torque).
And the zero point can be chosen by calibration, so it is somewhat arbitrary.
Some of the stability problems might arise from the fact that the ADC values depend on angle. Together with temperature drift the zero point might not always actually produce 'zero.'
It is true, the zero point is the most delicate aspect of calibration.
The adc value of the torque sensor is very unstable, not only due to the pedal position and the temperature, there can also be a mechanical drift in a short time (minutes), which is usually recovered after a pause (hours) and can be a mechanical drift in a long time (months) that is no longer recovered.
Furthermore, when switched on, some sensors reach a stable value quickly, while others very slowly, the expected initial time may not be enough.

For this reason, in the v20.1C * versions, with calibration enabled, I had foreseen a fixed zero point (offset value), while with calibration disabled the zero point is acquired at each power up.
Fixed zero point was not a good idea, periodic calibration is required.
With a motor, I found myself after six months, the "Pedal torque adc offset" and "Pedal torque adc max" values ​​both higher of 30 points.
In the next version "Pedal torque adc offset" will always be acquired when switched on.
"Pedal torque adc max" decides the amplification? Or is it the difference "Pedal torque adc max" - "Pedal torque adc offset" ?
What is the role of "Pedal torque adc step"? It has no influence on amplification?
It is the difference between "Pedal torque adc max" - "Pedal torque adc offset" that decides the amplification.
Decreasing the value of "Pedal torque adc max" decreases the range and consequently increases the amplification.
While with "Pedal torque adc offset", you can change the sensitivity at the start, decreasing the value increases the sensitivity, increasing the value decreases the sensitivity.
I realized that these settings are not very intuitive, in the next version there will be two specific parameters for starting sensitivity and range amplification.

"Pedal torque adc step" also affects amplification, only in "Power assist" mode and partially "Hybrid assist" mode.
The value obtained from the calibration is used to calculate the correct ratio between the assistance factor% and the human power, and the value of the human power to be shown on the display.
 
Hilo said:
I flashed version v20.1C.1

The motor keeps running without pedaling, as if the throttle is working, but I did not install the throttle.
This is the second time, this time I am sure it is wrong.
Fortunately, it can be stopped by the VLCD6 power button.
Now that's interesting - I have had the same problem in that:
> about 15 miles into a ride and as I approached a bend, I stopped pedalling but noticed the motor was still running, albeit quite slowly and with not much power
> I was able to stop the bike with my standard v-brakes (not ebrakes), bend down and power the bottle battery off/on and all was well.
> I raised this on the UK Pedelec forum (link) and another user (FrodoBaggins) also reported experiencing the same.

Other info:
> Running V20.1c.1 flashed using the standard Java configurator.
> My setup - 250w, 36v TSDZ2 running at 25kph pedal assist, VLCD6 display, no ebrakes or throttle
> battery was maybe 25% discharged
> ambient temperature was around 12degC and the motor had not been worked hard (so no heat build-up) and ridden in ECO mode throughout the ride
> bike speed at time of issue was maybe 10-15kph

Is this phenomenon the one referred to as 'Ghost pedalling' in this post here?
 

Attachments

  • Phantom.jpg
    Phantom.jpg
    123.5 KB · Views: 1,947
Hi everyone,

I have read a lot of the recent posts but they couldn't help in solving my issue.
I bought, about 3 weeks ago, a tsdz2 pack with 850c display.
This afternoon I tried flashing the 2021 850C display (didn't know there were different versions at that time) with Casainho's OSF v1.1 with a diy bootloader box. It worked i guess, but of course the display wouldn't even turn on after that.

I then learned about mrbrusa's fork and tried to update again with the bootloader, tried different versions of the 850c 2021 bootloader version, but none brought the display back to life.

I got a hint some people had success using SWD programming. So I gave it a shot, with several firmware versions too. But no success either. Even if everything seems to be writing correctly

I'm not seeing anything fried on the display's board.

Only weird thing i see is after programming, if i unplug and replug the ST-LINK USB or disconnect the display and reconnect it to the ST-LINK, the whole program gets shifted by one slot, i.e. one line of data is being added at the beginning of the firmware, and the rest is being shifted by one adress. I tried enabling write protection for all adresses but it didn't change a thing.

I dont' want to have to buy another display :( I hope you guys can help. Let me know if you need more info.
Many thanks for all the work
 
Sorry for took so many time to link this project on the wiki. Finally I did a relevant update to the project and so finally I added links to other projects - I removed from the wiki the references to SW102 and 850C/860C displays!



I were betting on TSDZ2 fully wireless (and I reused this project mobile app) using a wireless remote but I found it was very frustrating having only a LED to give feedback for user, like to see battery SOC user would need to count LED blinks.
I decided to move back again for very small display but reusing the TSDZ2 wireless hardware + using the SW102 display firmware we did developed, so the final result is a DIY simple display that still has Bluetooth and ANT communications, that works for tiny 0.96 and small 1.3 inches 128x64 OLED displays like SW102. It is easy to repair as also easy to customize with some extra electronics so it can be reused on other devices, like adding CANBUS communication so it can work with more recent Bafang motors or popular EScooters like Xiaomi M365: https://opensourceebike.github.io/

 
bikes4two said:
Now that's interesting - I have had the same problem in that:
> about 15 miles into a ride and as I approached a bend, I stopped pedalling but noticed the motor was still running, albeit quite slowly and with not much power
> I was able to stop the bike with my standard v-brakes (not ebrakes), bend down and power the bottle battery off/on and all was well.
> I raised this on the UK Pedelec forum (link) and another user (FrodoBaggins) also reported experiencing the same.

Other info:
> Running V20.1c.1 flashed using the standard Java configurator.
> My setup - 250w, 36v TSDZ2 running at 25kph pedal assist, VLCD6 display, no ebrakes or throttle
> battery was maybe 25% discharged
> ambient temperature was around 12degC and the motor had not been worked hard (so no heat build-up) and ridden in ECO mode throughout the ride
> bike speed at time of issue was maybe 10-15kph

Is this phenomenon the one referred to as 'Ghost pedalling' in this post here?
Motor spinning without pedaling (phantom pedaling) is a known problem.
It is rare and is also present in all previous versions of OSF for stock displays, only those.
There was a bug in the communication code with the display, that could have been the cause, but after the modification the problem remained.
I have checked many times, for now I have not found anything else.
We talk about it here:
https://github.com/emmebrusa/TSDZ2-Smart-EBike-1/issues/10

In the new version I am testing, I have added some controls that should stop the motor when there are variables with incompatible values. They are attempts.
 
mbrusa said:
With a motor, I found myself after six months, the "Pedal torque adc offset" and "Pedal torque adc max" values ​​both higher of 30 points.
That is quite a drift! Obviously this will easily produce instabilities.
Or this is more of a deformation of the sensor geometry?
In the next version "Pedal torque adc offset" will always be acquired when switched on.
While the angle drift will still be there this is a good idea. :thumb:
It is the difference between "Pedal torque adc max" - "Pedal torque adc offset" that decides the amplification.
Decreasing the value of "Pedal torque adc max" decreases the range and consequently increases the amplification.
This was my expectation.
While with "Pedal torque adc offset", you can change the sensitivity at the start, decreasing the value increases the sensitivity, increasing the value decreases the sensitivity.
Yeah, but decreasing offset will create stability problems. (And therefore will not be possible in future versions, right?)
I am right to expect a safety margin there? Meaning that an offset, like i.e. 155, will only generate motor current if ADC>165 or so?
How big is that margin?
I realized that these settings are not very intuitive, in the next version there will be two specific parameters for starting sensitivity and range amplification.
Sound like another good idea! :bigthumb:
"Pedal torque adc step" also affects amplification, only in "Power assist" mode and partially "Hybrid assist" mode.
That is clear from the manual.
The value obtained from the calibration is used to calculate the correct ratio between the assistance factor% and the human power, and the value of the human power to be shown on the display.
This is the least intuitive part of the interface. There is a 'double calibration‘.
Amplification depends on range (max-min) and additionally on 'Pedal torque adc step' which is somehow calculated from a measuring procedure with another thrust (weight).
Why not just measure ADC with a specific weight (i.e. 20 kg<->33 Nm) and use that as input for calibration?
[Maybe 15kg<->25Nm gives even better results, see graphs]

In any case I would rather do this by hand than by a procedure involving a lot of button pressing (VLCD6) that gives a display flash I can only see for a second and that in this second is showing two different values before shutting off.
Is there a formula for 'Pedal torque adc step'? [If for instance using m=15kg]
I would expect
'Pedal torque adc step' = (ADC_15kg - ADC_0) / C_15kg = (ADC_15kg - ADC_0) / (C · 15kg)
All that I need would be the value of C.
But maybe the margin form above is involved too?

Very much looking forward to the new versions ;)
But I am very happy with what I have already
Thanks Olie
 
mbrusa said:
modl said:
...
I dont' want to have to buy another display :( I hope you guys can help. Let me know if you need more info.
Many thanks for all the work
Unfortunately I don't have an 850C display.
There was user Zadou1989 who had a similar experience.
https://endless-sphere.com/forums/viewtopic.php?f=30&t=110682&p=1672678#p1672678
It seems he has solved it. Try to contact him.

Ok I contacted him, thank you for your reply.

In the meantime I decided to order the parts for your DIY screen project. Looking forward to assembling this. Thanks for your work
 
modl said:
Ok I contacted him, thank you for your reply.

In the meantime I decided to order the parts for your DIY screen project. Looking forward to assembling this. Thanks for your work
A clarification, the DIY screen project, is not mine but of casainho, also for the motor controller you will have to use its OSF version.
Your negative experience is a confirmation that the 850C 6 pin displays of the TSDZ2 kit are not flashable from the connector and maybe not even with swd.
For those with this display, I recommend trying the OSF version for stock displays, without flashing the display.
It should work, otherwise you can revert to the stock version (backup before flashing).
 
Olie said:
...
This is the least intuitive part of the interface. There is a 'double calibration‘.
Amplification depends on range (max-min) and additionally on 'Pedal torque adc step' which is somehow calculated from a measuring procedure with another thrust (weight).
Why not just measure ADC with a specific weight (i.e. 20 kg<->33 Nm) and use that as input for calibration?
[Maybe 15kg<->25Nm gives even better results, see graphs]

In any case I would rather do this by hand than by a procedure involving a lot of button pressing (VLCD6) that gives a display flash I can only see for a second and that in this second is showing two different values before shutting off.
Is there a formula for 'Pedal torque adc step'? [If for instance using m=15kg]
I would expect
'Pedal torque adc step' = (ADC_15kg - ADC_0) / C_15kg = (ADC_15kg - ADC_0) / (C · 15kg)
All that I need would be the value of C.
But maybe the margin form above is involved too?

Very much looking forward to the new versions ;)
But I am very happy with what I have already
Thanks Olie
The choice of two calibrations was forced, there is no link between them, they were added at different times.
The weight calibration is the same present in the 20beta1 version for LCD3 that I used as a basis for my versions.
The purpose is to calculate the human power to be displayed and the ratio between human power and motor power (assistance level%).
With the standard displays this calibration is not necessary, I believe that no one displays the human power, moreover with the calibration of the range the assistance% is no longer correct.
The other calibration, I added it when I tried my second motor, I realized that the range of the torque sensor was half of the first motor.
Even if improperly, it was possible to use "Pedal torque adc step" to amplify the assistance, but only in "Power assist" mode.
With the other modes it was not possible, even with the assistance parameters at the maximum value it did not reach the maximum power.
For this I added the second calibration to amplify the range of the torque sensor.
This calibration works in all modes and is independent of the weight calibration.
The weight calibration procedure is complicated due to the limitations of the display, the Java configurator came later.
Now I could enter the corresponding weight and torque values ​​in the configurator, but it is not important.
One thing I could do is an estimated "Pedal torque adc step" calculation without doing the calibration, it is already on the 860C display, it would be just a copy and paste. I'll think about it.
 
mbrusa said:
modl said:
Ok I contacted him, thank you for your reply.

In the meantime I decided to order the parts for your DIY screen project. Looking forward to assembling this. Thanks for your work
A clarification, the DIY screen project, is not mine but of casainho, also for the motor controller you will have to use its OSF version.


Oh yes indeed, my bad !
 
mbrusa said:
modl said:
Ok I contacted him, thank you for your reply.

In the meantime I decided to order the parts for your DIY screen project. Looking forward to assembling this. Thanks for your work
A clarification, the DIY screen project, is not mine but of casainho, also for the motor controller you will have to use its OSF version.
Your negative experience is a confirmation that the 850C 6 pin displays of the TSDZ2 kit are not flashable from the connector and maybe not even with swd.
For those with this display, I recommend trying the OSF version for stock displays, without flashing the display.
It should work, otherwise you can revert to the stock version (backup before flashing).


I received a response from apt with their stock version of the firmware for my screens S/N, here is a copy of their mail:

Hello

Please try firmware in attachment, we had to change some components because of Material shortage this year.

Best regards.

Johnny


If anyone is interested in the file please let me know. Display seems to be from a batch from july 2021
 
So I tried the firmware and the screen still won't turn on. I was wondering if the jtag/swd pinout could be different as well? Is there a way to test this ?

I also took a picture of the main chip which seems different from this one https://raw.githubusercontent.com/OpenSourceEBike/Color_LCD/master/Bafang_color_LCD_850C/Bafang_850C_board-01.jpg
 

Attachments

  • 850c 2021 board.jpg
    850c 2021 board.jpg
    206.2 KB · Views: 1,527
  • 850c 2021 chip.jpg
    850c 2021 chip.jpg
    219.4 KB · Views: 1,527
Hi

Can the latest TSDZ2 mid drives be flashed with custom firmware.
I read somewhere that the latest ones can't be flashed.
 
Hi all,
I've got everything together to carry out the Initial SW102 firmware install. Following the github instructions for SW102 first install Windows, I've opened the sw102 soldered the wires on and connected to the ST-LINK.
Ive un zipped the programming files to SW102_First_Install_Windows" folder, but all the links to the required sw102-full-x.y.z.hex file are broken so I can't flash the firmware.
I don't know if this file has intentially been removed but without it, it iseems no longer possible to flash new SW102 displays unless I'm being dense and missing something.
Ive spent the last three days searching for any version of the sw102-full-x.y.z.hex file, can somebody please post or send me a working link to a version of this file so I can get started.
Thanks.
Edit: I managed to download sw102-full-0.19.11.hex using the wayback machine. Display is now flashed and running the simulator :D
 
does the software also work for the p860c display? is this a new version? there is an 860c and a p860c at Ali ......

MFG Michael
 
chilau2000 said:
Hi

Can the latest TSDZ2 mid drives be flashed with custom firmware.
I read somewhere that the latest ones can't be flashed.

Not if they have the new controller in them.
If it's a new motor with the old style controller (like PSWPower are still selling), then it's all good.
 
Back
Top