Page 64 of 65

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 10:42am
by casainho
spiked wrote:
Jan 10 2019 10:36am
casainho wrote:
Jan 09 2019 1:34pm
New stable flexible OpenSource firmware v0.17.0, get it here: https://github.com/OpenSource-EBike-fir ... ag/v0.17.0
Thanks, casainho, and all who contributed!

Will give 0.17 a try ASAP in my LCD3.

Do I have to update my motor controller firmware to 0.17? Or are there no changes from 0.16?

Thanks!

Neil
No changes on motor controller side.

I hope it works, as the previous user reported error.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 10:48am
by Rafe
Is 17.0 the wrong file? It loads but the LCD3 display will not flash up afterwards I've had to revert back to 17.0 beta 5


The file size looks too small, smaller than 16.0, buba's 16.1 and all the 17.0 betas


It is the same size as the controller firmware too and LCD3 firmware is usually larger. Also strange is both throttle an non throttle are the same size

https://github.com/OpenSource-EBike-fir ... e/releases

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 11:14am
by spiked
casainho wrote:
Jan 10 2019 10:42am

No changes on motor controller side.

I hope it works, as the previous user reported error.
Thanks, I'll hold off until the 0.17 LCD3 file issues are sorted out.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 2:15pm
by casainho
spiked wrote:
Jan 10 2019 11:14am
casainho wrote:
Jan 10 2019 10:42am

No changes on motor controller side.

I hope it works, as the previous user reported error.
Thanks, I'll hold off until the 0.17 LCD3 file issues are sorted out.
Found the issue and I did uploaded the correct files: https://github.com/OpenSource-EBike-fir ... ag/v0.17.0

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 3:03pm
by Rafe
This new 82.1k 17.0 has gone in no problem at all the old one was only 56.7k cheers :thumb:

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 10 2019 3:07pm
by casainho
Rafe wrote:
Jan 10 2019 3:03pm
This new 82.1k 17.0 has gone in no problem at all the old one was only 56.7k cheers :thumb:
Thanks for the feedback. The previous was just the motor controller firmware, there was an issue with the script that builds all the firmware (that I jist did).

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 4:42am
by stancecoke
casainho wrote:
Jan 09 2019 3:53pm
marcoq, can you please create a new thread for user support to your branch?
Perhaps we could build a Java Tool, that creates the hex-file (e.g. EEPROM.hex) for the EEPROM content and then flashes the file via a batchfile that calls the STVP commandline tool (like it is done for optionbytes and program memory in the existing Java Tool already). This would avoid that the end user has to compile the whole code.

The hex-file structure is quite easy, a "blueprint" can be created by saving the recent state from the Data Memory tab in the ST Visual Programmer (see attachment).

The command in the batch file for writing the EEPROM Data should be:

Code: Select all

STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileData=EEPROM.hex -verbose -no_loop
regards
stancecoke

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 4:50am
by casainho
stancecoke wrote:
Jan 11 2019 4:42am
casainho wrote:
Jan 09 2019 3:53pm
marcoq, can you please create a new thread for user support to your branch?
Perhaps we could build a Java Tool, that creates the hex-file (e.g. EEPROM.hex) for the EEPROM content and then flashes the file via a batchfile that calls the STVP commandline tool (like it is done for opitonbytes and program memory in the existing Java Tool already). This would avoid that the end user has to compile the whole code.

The hex-file structure is quite easy, a "blueprint" can be created by saving the recent state from the Data Memory tab in the ST Visual Programmer.

The command in the batch file for writing the EEPROM Data should be:

Code: Select all

STVP_CmdLine -BoardName=ST-LINK -ProgMode=SWIM -Port=USB -Device=STM8S105x6 -FileData=EEPROM.hex -verbose -no_loop
That is also my suggestion!! On KT motor controllers firmware user needs to build the firmware because there are so many options, like it works with many different motors and sensors. The advantage of TSDZ2 project is that hardware is almost the same for everyone, so the firmware file can be just one and that simplifies a lot the process compared to KT motor controller firmware.

I think stancecoke suggestions are good -- he has very good experience with KT motor controller firmware ;-)

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 5:29am
by casainho
I submitted a talk proposal to Pixel Camp, where I plan to talk about TSDZ2 flexible OpenSource firmware (motor controller and both LCDs). I learn a lot every time I goes there and I find a lot of interested and cool developers, so I am very excited to be there again.

Pixels Camp is the largest technology event in Portugal, consisting of 3 days of non-stop tech, talks, workshops and 48-hour hackathon.

https://pixels.camp

Image

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 1:27pm
by buba
This will be a big one…

I have worked on a couple of new functions, features and overall KT-LCD3 and controller firmware improvements.

Some changes from stable version 0.17.0:
-------------------------------------------------------------------------------------------------------------------------

- Walk assist: works with different power levels adjustable by user. Set the desired power level simply by choosing assist level. There is a new configuration menu where you can enable or disable the function and also set the power values for each and every assist level. Can be activated at speeds below 8 km/h or around 5 mph with DOWN button hold. Based on open loop controller firmware that is settable from the display (KT-LCD3). An open loop controller is the best controller implementation for the walk assist function as it enables slower speeds.

- Cruise function (BETA): this is a great new function for those days you need kind of a “virtual throttle”. When at speeds above 8 km/h or around 5 mph simply hold down the DOWN button and the bike will do the rest. The speed will automatically be maintained. Feedback controller firmware. Great for countries where a real throttle is illegal. Really a fun function!

- Current ramp up: it is now possible to set the current ramp up when the motor is accelerating. Configurable from the display (KT-LCD3) under configuration menu 8: Various. Users can have a longer lasting blue gear by simply slowing down the acceleration or just enjoy a smoother acceleration and feeling. The opposite is possible too: set a faster acceleration if you wish for a quick bike.

- Speed, average speed and max speed: there is a new menu in the main display (KT-LCD3) where users can see the current speed, average speed since power on and peak speed since power on.

- EXPERIMENTAL higher cadence mode for the 48 V motor: there is a new motor type to choose under configuration menu 8: Various. This is a experimental mode for the 48 V motor based on previous values supplied by user Jbalat. Test with caution as this is an experimental function. Have not personally tested this and it is advised to not choose this if not sure what it is. This is where future field weakening modes might end up.

Here is an updated wiki (BETA) with some more information: https://github.com/OpenSource-EBike-fir ... 8.X-(beta)
-------------------------------------------------------------------------------------------------------------------------


Coming updates and improvements (maybe):
-------------------------------------------------------------------------------------------------------------------------

- Walk assist enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.

- Cruise function enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.

- Cruise function with more functionality and function enable/disable switch.

- More average speed functionality.

- Experimental functions with field weakening.

- User ideas.
-------------------------------------------------------------------------------------------------------------------------


Will submit pull request from my fork ( https://github.com/leon927/TSDZ2-Smart-EBike ) and the branch I have been working on as soon as I have tested the changes and feel comfortable with everything safety wise. But just wanted to give an quick update!

This is such a cool and great community, love all the development! As usual, feedback is much appreciated!

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 2:09pm
by elem
- Walk assist enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.
it s a good idea, i have friends with yamaha motor, and walk assist button is a pain, i suggested them to use a simple on/off switch .
Bosh walk assist is good, no timer and big button, easy to use
but activate walk assist and stopping it just with any button is good too, may be the easy way in mountain biking .

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 2:20pm
by markjiizs
I agree that both cruise and walk assist like that would be perfect implementation. I think then the firmware would have everything I want :) :thumb: Thanks for the development and let us know when we can test the firmwares :)

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 5:40pm
by Nick
buba wrote:
Jan 11 2019 1:27pm

- Walk assist enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.
What bothers me most with normal walk assist is if you let loose the down button for just a blink of an eye (which happens quite often to me :cry:) you have to go through the complete procedure "hold the button - wait - walk assist kicks in".
Maybe there is a safety/comfort compromise:
If walk assist is active and you let loose the down button you are able to instantly reactivate walk assist by pressing&hold the button again within f.i. 2 secs. But if this period elapses or you press any other button you have to begin from scratch...

Greetings
Nick

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 5:45pm
by casainho
Nick wrote:
Jan 11 2019 5:40pm
buba wrote:
Jan 11 2019 1:27pm

- Walk assist enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.
What bothers me most with normal walk assist is if you let loose the down button for just a blink of an eye (which happens quite often to me :cry:) you have to go through the complete procedure "hold the button - wait - walk assist kicks in".
Maybe there is a safety/comfort compromise:
If walk assist is active and you let loose the down button you are able to instantly reactivate walk assist by pressing&hold the button again within f.i. 2 secs. But if this period elapses you have to begin from scratch...

Greetings
Nick
Previous experimental implementation from EndlessCadence did that, did filter small/quick button loose so this can be done and was already thought. That code is on the pull request that is not closed yet.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 10:27pm
by Rydon
buba wrote:
Jan 11 2019 1:27pm
This will be a big one…
Great stuff buba!! I can't wait to try it. Thanks!!

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 11 2019 10:33pm
by Rydon
buba wrote:
Jan 11 2019 1:27pm
- Walk assist enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.

- Cruise function enabled without having to hold the DOWN button (maybe not a good idea). Disables immediately if user presses ANY button.

- Cruise function with more functionality and function enable/disable switch.

This is such a cool and great community, love all the development! As usual, feedback is much appreciated!
Pressing any button to disable sounds safe enough. I assume it would also disable on braking if cutoffs installed? That is as good as the way cruise control works on cars.

I also agree on the community comments. :) Kudos to the developers and contributors!

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 12 2019 4:04am
by Rafe
Excellent news Buba, I was only looking at the LCD3 manual a few days ago and thinking it would be great to have all its other functions enabled but not expecting anyone to do it. Just a shame it does not have a battery to store time/date.

As for walk assist or any other function that rotates the wheel without having to hold a button or pedal I would strongly caution against that. The obvious is an accident with the rider not able to switch the motor off, but these bikes also go into crowded public spaces including trains where it is all too easy to have them activated inadvertanly even without the owner present. The finger bounce delay sounds like a good idea though, the same principle as a train driver's dead man handle or button.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 12 2019 7:21am
by e3s
The throttle could be used to control the walk assist

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 13 2019 9:13am
by dameri
I drove for the first time yesterday open source firmaware v017.0. Everything works very well. Better than stock firmaware. Kudos for everyone who has take part to developing.

Now I'm wondering if the main screen in KT-LCD3 can be configured? I don't need time measurement, can I for example put cadence instead, and if I can, please explain how.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 13 2019 11:51am
by samuelsson87
HI!

I have the coaster version of the Tongsheng TSDZ2 and gets a kick from the cranks when releasing torque too fast.

It seems that this is because the controller/firmware is for the non-coaster version. Right? What to do?
Can I flash the controller to the "coaster-version-firmware" or can I solve it with the FOS-firmware?

Regards
David

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 13 2019 2:14pm
by markjiizs
Rafe wrote:
Jan 12 2019 4:04am

As for walk assist or any other function that rotates the wheel without having to hold a button or pedal I would strongly caution against that. The obvious is an accident with the rider not able to switch the motor off, but these bikes also go into crowded public spaces including trains where it is all too easy to have them activated inadvertanly even without the owner present. The finger bounce delay sounds like a good idea though, the same principle as a train driver's dead man handle or button.
If I would go mountainbiking I would put a jetski style kill switch, you can get even reed (magnetic) switch and some piece of metal to attach your magnet. The greatness of open source is in letting people to choose on their own responsibility what they want and what not. I like the idea a lot for scenic long drives where you just want to look around without pushing anything. Analogy with motorbikes, most of the touring ones have a cruise control, that does not mean that there are more accidents, actually it is even good for safety to mantain constant speed...

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 13 2019 7:45pm
by Rydon
samuelsson87 wrote:
Jan 13 2019 11:51am
HI!

I have the coaster version of the Tongsheng TSDZ2 and gets a kick from the cranks when releasing torque too fast.

It seems that this is because the controller/firmware is for the non-coaster version. Right? What to do?
Can I flash the controller to the "coaster-version-firmware" or can I solve it with the FOS-firmware?

Regards
David
As sometimes happens with TongSheng it appears that your controller got flashed with the regular firmware instead of the coaster brake firmware either at the factory or later. The correct controller has a"BK" next to the part number for coaster brake. So you can buy a coaster brake controller or find the firmware and flash it per this site or do the FOS firmware per this site. Any of the above would fix your problem. Before I knew about this issue I put a regular controller on a coaster brake motor and experienced exactly what you describe. :)

How many volts is your motor? I may be able to get the firmware for you.

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 14 2019 2:40am
by shaddi
buba wrote:
Jan 11 2019 1:27pm
- Cruise function (BETA): this is a great new function for those days you need kind of a “virtual throttle”. When at speeds above 8 km/h or around 5 mph simply hold down the DOWN button and the bike will do the rest. The speed will automatically be maintained. Feedback controller firmware. Great for countries where a real throttle is illegal. Really a fun function!
yeeess! Cant wait to test this!
This Function should also be disabled in offroad-mode inactive state if offroad-mode is enabled...

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 14 2019 4:13am
by flufferty
Did anyone try to flash back to stock from the flexible firmware?
I have a 36v motor and a 52v battery, and trying to get back to stock with the 52v-profiles from eyebsickle, left me with the controller thinking the battery is empty. So it wont run. But I used the same profiles before the flexible, successfully.

I made sure to double-check the voltage/amps in eeprom-file before flashing.
Sorry to use this thread but the main question is what do I need to go back to stock from flexible?

1. Flash stock program (-s flash in stm8flash)
2. Flash data eeprom (-s eeprom)

Missing anything?
Do I need to relock or flash the opt?

Re: TSDZ2 mid drive -- Flexible OpenSource firmware for TongSheng TSDZ2 mid drive motor

Posted: Jan 14 2019 9:14am
by perryscope
flufferty wrote:
Jan 14 2019 4:13am
Did anyone try to flash back to stock from the flexible firmware?
I have a 36v motor and a 52v battery, and trying to get back to stock with the 52v-profiles from eyebsickle, left me with the controller thinking the battery is empty. So it wont run. But I used the same profiles before the flexible, successfully.

I made sure to double-check the voltage/amps in eeprom-file before flashing.
Sorry to use this thread but the main question is what do I need to go back to stock from flexible?

1. Flash stock program (-s flash in stm8flash)
2. Flash data eeprom (-s eeprom)

Missing anything?
Do I need to relock or flash the opt?
I did this to test stock firmware on a new battery (I went to 48V Stock). I originally bought the motor as 36V and took a copy of stock firmware before I did anything Program, Data, and Opt.

For me the only way I could get stock (48V) to work was to use the 36V opt backup i originally took. without it my battery would show empty.

This worked well for me, I'm not sure of the opt would be different between stock firmware. Have you got one to try? or has anyone got a 48V/52v stock opt hex file to compare with?

Welcome to share my 36V opt hex file if it would help?