Tsdz2 firmware open source adapted to vlcd5, vlcd6 and xh18

Elinx said:
Till there is a working Gui I have made configuration sections in the English Google translation and improve the layout a bit.
EN-Parameter-Config.h-guide-TSDZ2-mb.20beta1.A.pdf

:thumb: thanks for the EN translation !

However it is not clear how to activate Walk Assist or Cruise mode on VLCD5.. there is just recommendation to check original manual of the display but there isn't such thing..
 
I've added a wiki page with a short installation-guide and links to the related forum discussions:

https://github.com/stancecoke/TSDZ2-Smart-EBike/wiki

Improvements are welcome, any user with a github account can edit the page.

regards
stancecoke
 
elfnino said:
......

:thumb: thanks for the EN translation !

However it is not clear how to activate Walk Assist or Cruise mode on VLCD5.. there is just recommendation to check original manual of the display but there isn't such thing..
Have you seen the display operation manual too? That one I have translated too.

View attachment EN-Manual_display operation-TSDZ2-mb.20beta1.A.pdf

I have both files uploaded for the first time here

Later I have edited and uploaded only the configuration guide two times
1- layout improvement. (the one you have) for editing all config.h settings with notepad.
2 - re-arranged specific for the new Java Configurator GUI which had split the settings into basic and advanced.
 
Hello,

I've been following this wit increasing excitement for a little while. :D Thank you for the hard work!

Can anyone help with this issue? I have my ST-Link connected and all the files installed in C:\
When I press compile in the GUI and after it runs through the compile I get the following error,
"loading file option_no_prot.ihx in option byte image in computer"

Any help appreciated.

Regards,


David
 
DavyWavy66 said:
"loading file option_no_prot.ihx in option byte image in computer"

Ah, again an issue of my .gitignore settings. I just fixed it at github. Please download the repo again, it should work now!
https://github.com/stancecoke/TSDZ2-Smart-EBike/commit/9920098a4251dd72e4d271157c45909c5fe54be1

regards
stancecoke
 
stancecoke said:
DavyWavy66 said:
"loading file option_no_prot.ihx in option byte image in computer"

Ah, again an issue of my .gitignore settings. I just fixed it at github. Please download the repo again, it should work now!
https://github.com/stancecoke/TSDZ2-Smart-EBike/commit/9920098a4251dd72e4d271157c45909c5fe54be1

regards
stancecoke

just awesome stancecoke! thx a lot! :bigthumb:

Like it because based on the casahino-base-repo
 
Elinx said:
stancecoke said:
.....

The configurator works now for the basic settings. I think it is mostly self explanatory.
https://github.com/stancecoke/TSDZ2-Smart-EBike
.......

For people who want to bring the advanced settings into the GUI.......

Till then I have re-arranged the configuration guide for basic and advanced settings.
EN-Configurator -TSDZ2-mb.20beta1.A.pdf

In te section How to assist WALK ASSIST :
Activated with the dedicated button, consult the manual of your display
But in the official VLCD5 manual I could not find any WALK ASSIST or CRUISE dedicated button.. so which button is it ?
 
elfnino said:
...... in the official VLCD5 manual I could not find any WALK ASSIST or CRUISE dedicated button.. so which button is it ?
In settings the name for walkassist is 6km/h on off
 
Elinx said:
elfnino said:
...... in the official VLCD5 manual I could not find any WALK ASSIST or CRUISE dedicated button.. so which button is it ?
In settings the name for walkassist is 6km/h on off

Thanks !
 

Attachments

  • Capture.JPG
    Capture.JPG
    32.7 KB · Views: 4,182
stancecoke said:
DavyWavy66 said:
"loading file option_no_prot.ihx in option byte image in computer"

Ah, again an issue of my .gitignore settings. I just fixed it at github. Please download the repo again, it should work now!
https://github.com/stancecoke/TSDZ2-Smart-EBike/commit/9920098a4251dd72e4d271157c45909c5fe54be1

regards
stancecoke

Hi Stancecoke, I am new on this list and was a little bit lost in this long thread but I appreciate your new wiki and I started to install the softwares. I think that you could mention that the installation is for Windows (which I don't have anymore but can install with VirtualBox). Also you could add a precision and say "download and install a complete version of SDCC (with includes and libraries)". I was willing to keep my C: drive small (the virtual fdi) and got errors on the includes (and libraries). But I have been able to get the main.ihx successfully for a 36V 10.4Ah battery.

Other point, would it be possible to remember, close to the default 45, that in the EU the max speed for a pedelec is 25km/h?

I also have an additional question. As I just bought a ST-Link V2 with a short 4 wires cable, I haven't tested (yet) the electric connection with the TSDZ2 via the 6-pin male connector; but I was wondering if you could add a first menu to your very nice configurator which could help the new user to transmit the original stock firmware of the motor and save it on the C: drive. That initial step would also test the electric connection and wiring.

I read or viewed from early jbalat YouTube videos that 3 panes have to be saved and I can understand that this initial new step could not be easily implemented in your Java configurator.

In any case, I thank you (and the others casaino etc) very much in your efforts to improve and simplify the processing.

Regards,
revher

PS: I haven't tested this new firmware yet and I am still using the stock original firmware which is quite good for me (250W) but I would appreciate if I could read somewhere what are the real major improvements with the open-source. For example why a linear torque curve is clearly better than the original parabolic and if it is so clear why Tongsheng did not adapt it to their stock new motor. The "benefits" that are included in the readme "The motor runs more efficient therefore it becomes more powerful and consumes less energy." and "The ebike will feel more responsive and agile." could be more convincing with a link to a technical reference.

PPS: I have two TSDZ2 motor a first one with a new Vermont E-Jersey German with a VLCD5 and an Aliiexpress adapted to an old bike with an XH18. I would like to change the VLCD5 monitor with a new XH18 monitor. My question is: is it possible to change the monitor keeping the original firmware in place? And if the answer is yes, why should we have to choose between VLCD6, VLCD5 and XH18? Could it be the same firmware in the future? (I know that temperature and new ad-dons could be important).
 
The open source firmware uses "simplified FOC" to drive the motor. That should be more efficient than the standard firmware.

The open source firmware has options to adjust maximum battery current and motor winding currents. This allows the motor to produce higher peak power when needed if the battery is up to it. If however you go to high on those, the motor can overheat. A thermal sensor can measure motor temperature and reduce the current when the motor is overheating.

The Tsdz2 torque sensor is not always working equal well and there output can differ from one motor to another. At the start, it's output increases linear with the pressure on the pedals, but it doesn't stay like that over it's full range. Due to those differences, settings can work fine for one person and not so good for another. The open source firmware tries to compensate for those differences so that the experience becomes equal for everyone.

Finally, there is the startup behavour. Some people like high assistance at takeoff so they are quickly up to speed when a red light becomes green. Others like it more if assistance increases gradually. It's better for the chain and the gearings and it reduces the risks for slipping and accidents. It's obviously also better for battery life.

There are basically 2 major diversions of the open source firmware. One uses the original Tsdz2 displays and has most of the parameters hardcoded in the firmware by editing the config files or using a configurator program and the other uses a reprogrammed kuteng or bafang display and has the options to alter configurations on the fly. Not all revisions work on every display. The kuteng will likely be abandonded due to the limited code size of it's buildin microcontroller. The Bafang 850C is graphical and has a bigger display. It also comes with a higher price card. The Bafang SW102 still needs to be opened for it's initial programming and it's not really designed for that. (It's glued together). It has a buildin bluetooth interface which can become a bonus in the future for smartphone connectivity.
 
revher said:
I appreciate your new wiki and I started to install the softwares.
You are welcome! :D
If you have any approvements for the wiki, just edit it. Anybody with a github account can write to the wiki.

regards
stancecoke
 
stancecoke said:
revher said:
I appreciate your new wiki and I started to install the softwares.
You are welcome! :D
If you have any approvements for the wiki, just edit it. Anybody with a github account can write to the wiki.

regards
stancecoke

I have a github account but I can't see the edit/newpage button on your wiki.
 
obcd said:
The open source firmware uses "simplified FOC" to drive the motor. That should be more efficient than the standard firmware.
...

Thank you, this is exactly what somebody would like to read in Stancecoke's wiki (but I haven't found yet how to write in).
 
revher said:
I have a github account but I can't see the edit/newpage button on your wiki.
Sorry, I had to disable the restriction to collaborators, now is should work!

revher said:
Thank you, this is exactly what somebody would like to read in Stancecoke's wiki (but I haven't found yet how to write in).

You can find all the information in the wiki of the main project, see the link in the readme.md
https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki
I want to keep my wiki main page as simple and self explanatory as possible.
For details that are missing from your eyes, please create a new page.
Perhaps you can create one page for Linux users, we had questions about installing SDCC under Linux several times. I'm not familiar with Linux :wink:

regards
stancecoke
 
stancecoke said:
revher said:
I have a github account but I can't see the edit/newpage button on your wiki.
Sorry, I had to disable the restriction to collaborators, now is should work!
...
For details that are missing from your eyes, please create a new page.
...
regards
stancecoke
Yes your wiki can be edited now, as well as the main wiki too!

I added some details on what version of the Windows SDCC to install and why. A compromise between details and waste of time by installing the compact but useless version. I hope that you are ok. Otherwise, make it shorten.
Regards,
Revher
 
rob42 said:
Thanks for that, I found another option too. In linux (ubuntu 18.04 with SDCC 3.8 I have some related commands

sdasstm8 - -plosgffw main //manipulates symbols etc
sdldstm8 -nf main.lk //linker

I found it all worked by just running `sdldstm8 -nf main.lk` in the src/controller dir after the make process errored. Gave me a main.ihx file which flashed and worked.
Thank you for the hint related to the error due to the unknown stm8-objcopy command. But on OS/X and using the SDCC version installed with homebrew (sdld Linker V03.00 + NoICE + sdld), the -i option (for Intel Hex as (out)file[.ihx]) has to be added, otherwise the main.ihx is not output.
Code:
sdldstm8 -fi main.lk
but it is seems better to use the Makefile_windows which doesn't use the sdlstm8 step because its output is directly main.ihx instead of main.elf

It is not very clean to use a name mentioning ELF and not using it!
ELF_FLAGS = --out-fmt-ihx --debug
instead of --out-fmt-elf --debug
but it works. As said before by someone else, renaming Makefile_windows into Makefile will work for Linux, OS/X and Windows (cygwin).

Regards,
revher
 
stancecoke said:
You can find all the information in the wiki of the main project, see the link in the readme.md
https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki
I want to keep my wiki main page as simple and self explanatory as possible.
For details that are missing from your eyes, please create a new page.
Perhaps you can create one page for Linux users, we had questions about installing SDCC under Linux several times. I'm not familiar with Linux :wink:

regards
stancecoke

Hi,
I haven't flashed the opensource firmware to my TSDZ2 motors because I am still lost about:
- how to backup the original Tongsheng firmwares (program, data, EEprom ?);
- if it is possible to flash them back?
- is there a protection against the flashing?
I think that your former wiki https://github.com/stancecoke/BMSBattery_S_controllers_firmware/wiki/04-The-Java-Tool
gives more information on all these questions and some of them should be added to the current wiki concerning the procedure under Windows https://github.com/stancecoke/TSDZ2-Smart-EBike/wiki.

I have been able to backup the original firmwares with the Unix tools (stm8flash) but I don't know if the Windows procedure (described in the current wiki) can do it.
Also, I have read that the write protection can be deleted from a Unix command but I don't know how to do with the Windows procedure. In particular, I don't know how the file "option_no_prot.ihx" is produced. Also, I think that the file "data.ihx" is empty.

Could someone give some advices before I break the warranty of my motors?
Or am I needlessly too fearful!

Regards,
Revher

PS: I made some changes in the Java, by testing on which OS the configurator is run (Mac OS X or Linux or Windows), and have been able to produce the main.ihx on each of the three OS.
 
revher said:
because I am still lost
Have you read the wiki of the main project? You can find very much information there. Look at the links to bitbucket, too. You can find the original firmware files there also, so you can go back to the stock firmware any time.

As you have managed to read the flash, EEPROM und Optionbytes, the controller was not locked obviously.
There is no special write protection, if you can read it, you can write it, too. It's just a single bit in the option bytes.

The Kuntengs are always Read/Write protected on delivery. Therefore is the "Unlock" button in the GUI to set the needed option bytes.

marcoq and mbrusa always write all three memory areas (Flash, Data, Optionbytes) with the Compile&Flash button, so the user don't have to care about it. The empty data.ihx writes just zeros to the whole EEPROM to avoid trouble with mixing new and old meanings of data in memory adresses.

revher said:
I don't know how the file "option_no_prot.ihx" is produced

?! You don't have to know that :) It's in the repo and there's no need to think about it.
It contains the option bytes and can simply be saved (and then renamed) from the STVP GUI.

Regards
stancecoke
 
Hi all,

I have been able to flash my TSDZ2 250w 36V 10.4ah motor with a firmware produced with Stancecoke Java configurator that I adapted to run on Linux and OS/X. Even with the same config.h and because (probably) the version of the compiler were different the .rel and main.ihx are about of the same size but they are all three different.

As said by Stancecoke, having been able to backup the original 3 firmware binaries on disk, I have been able to restore two of them the Program and Opt but not the Eeprom and it said "Tries exceeded"
Code:
stm8flash -c stlinkv2 -p stm8s105?6 -s eeprom -w TSDZ_orig_eeprom.bin
Determine EEPROM area
Due to its file extension (or lack thereof), "TSDZ_orig_eeprom.bin" is considered as RAW BINARY format!
1024 bytes at 0x4000... Tries exceeded
make: *** [restoreeeprom] Error 255

In fact, I had forgotten to unplug the battery and the error might come from this (?)

I have just had time for a small ride but I noticed a difference. As the TSDZ2 is a coaster brake, I remarked that when I started backward pedaling the motor did not stop as immediately as before. And I remember having seen different versions of the firmware according to the coaster brake or the free wheel version. This was at the download link provided by eco-cycles https://www.eco-ebike.com/blogs/eco-cycles-instructionals/tsdz2-motor-firmware-programming.

But in fact I haven't find, neither in the config.h nor in the advanced.h, a "useful" COASTER_BRAKE definition. I may be wrong because Casainho explains in his last release 20 beta 1 that he started some e-brake when retro-pedaling, but I am probably confused.

So my question is, does the marcok/mbrusa fork make any distinction between both motors, coaster brake or free wheel as eco-cycle made?

Regards,
revher
 
Hi,

I started a wiki page entitled "OS X and Linux installation" but my scripts (compile_20.sh and edit_advanced.sh) and my java patch are still on my computer. Stancecoke could I send them to you or to anyone by mail, in order to test them?

Regards,
revher
 
revher said:
my scripts (compile_20.sh and edit_advanced.sh) and my java patch are still on my computer.
Just fork my repo, upload your changes and send a pull request!

regards
stancecoke
 
I am not well aware of git (but know very well CVS, yes I am old) and github. And for me it is still a waste of disk space to fork an entire repository for just adding two files and a java patch, but I will do it. Not right now but probably during the WE.
Regards,

revher
 
Back
Top