Maintanence TSDZ2 Motor projects

TongSheng TSDZ2 what Firmware options are there?

If you have seen any of my other blog articles on the TSDZ2 Mid drive motor you will know that I have been testing this motor with multiple different firmware’s over the last year or so. I have linked through to the open source GitHub pages for this, but as time has moved on its maybe not quiet as clear as it once was as to the options available for this motor. So In this post I wanted to summarise the different paths you can now take when changing the firmware on your own TSDZ2 motor.

So Lets start at the beginning and talk about what tools you will need to make any firmware changes to your Motor..

Tools needed.

In order to upgrade the firmware on your TSDZ2 motor you will first need to either purchase or build your own programming cable.

Unfortunately I have not yet found a UK or indeed european seller of the cables but you can find some worldwide sellers such as and however these are based in the US and as such once you add delivery you are looking at around $50 for the cable.

DIY option.

Its clear from the sellers above that these are exactly the same cable you can make yourself if you are confident with a soldering iron and testing the pinout of cables.

Here is my cable and pinout diagram..

( I purchased a tsdz2 speed sensor extension cable to cut off the 6 pin plug)

TIP:- make the cable as short as posible as you can have issues with volt drop anything longer! and then to connect to your PC/ laptop use a standard USB extension cable.

As you can see you will need a ST-Link v2 USB programmer these are easy to come by on ebay or AliExpress for about £4, but word of warning the pinouts are not all the same so check the image carefully! I have a second unit that even when wired correctly to its labelled pinout will not work, so maybe stick to those that show the same pinout as the above example?

All in you should be able to make your own cable for under £15 if you have some heat shrink to hand.


With the exception of the Original screen open source firmware ( we will come onto that later) all of the programming of the TSDZ2 is done using one tool from ST labs called st visual programmer STVP-STM32 (email registration is needed and link sent to email address – no cost)

After downloading and installing the software and drivers the first thing you will be prompted to do is choose the ST chip you wish to communicate with. so select the following options when prompted.

Once done you should be presented with the main screen

If all has gone well you should now be able to click on the Read -> All tabs menu to read the current configuration of your tsdz2 motor.

There are 3 tabs of data memory, ‘Program Memory ‘, ‘Data Memory’ and ‘Option Bytes’. if the read has been successful you should now see these areas full of data. I would recommend at this stage you save each tab to a file using the File -> Save option so you have a copy of your motors stock firmware should you ever what to revert it to how it was.

So for example you select the program tab, and save that at ‘my-stock-firmware-program-tab.hex ( choose the intel hex format) then choose the data tab and save that tab as my-stock-firmware-data-tab.hex, and the same for the option tab.

You can now start playing with the different firmware options….

Stock Firmware upgrades

So this blog post is all about upgrading the firmware to the new opensource variants isn’t it?

Well yes that’s to come but before the opensource firmwares were developed one of the fist things that was discovered with the TSDZ2 was that many of the different variants of the motor that were sold as 250w,350w,500w and even 750w were the exact same hardware but used slightly different firmware. In fact in many case the difference is one or two bytes changed that record the voltage and current the motor uses.

So in many cases customers who purchased a ‘250w’ motor could simply install the firmware for a 500w motor and unlock the intended power of the motor.

So if you are looking to simply unlock your motor and keep the original screen and use a stock firmware this is the simplist option for you.

A full list of fantastic instructions and a link to the original stock firmware files look here on

please note they also cover the stlink cable and software, they use the original stlink v2 device which works in the same way but looks somewhat different to the clones you will find online like the one above)

Bring on the Open Source Firmware!

Ok you have got this far, and maybe you like me have experimented with upgrading your firmware to the unrestricted stock firmware but now you want to see what the opensource community has to offer. what do you need to know?

well first think to ask yourself is are you happy to change the screen and potentially cut up and re-solder some cables to mate a new screen with the motor?

If you are against this level of hacking then a safe option is to try out the custom firmware threat developed by the user ‘Marco’ that is specifically designed to work with the origional TongSheng screens like the VLCD5,VLCD6 and xh18. This will only require you to reprogram the motor using the stvp-tool above, but no other physical changes to the cable.

Stock screen firmware fork

So a little out of order as this version of the opensource firmware is indeed a fork of the original work done by Casainho, but I wanted to mention it first as its most likely to appeal to people who are looking to try out custom firmware on there own TSDZ2 for the first time.

For all the information on how to use this firmware take a look at the wiki here.

This firmware uses a specially developed Java tool that allows you to choose all the settings you require to compile a special pre-configured firmware for your motor and screen. This is needed as the original screen is not reprogrammed and so only basic settings can be made using it.


I have been testing this fork for a while now and I have to say for a simple upgrade its very good. You don’t get all the extra information the larger screens provide, but using the windows java tool is really easy and quick to make changes save profiles and upload to the motor. So if you are looking at switching over from the stock firmware and are not quite ready to make new cables and buy new screens this is an excellent first step!


It can take a little while to get the software setup but if you follow the guide its all explained and there is plenty of help on the forum.

You can find the Endless Sphere forum that covers all of this firmware development here

And if you want to take a look at the code repository it is available here

I have to admit I have not used Marcos build for some time and it has developed hugely since I did last test it, so I think it offers some great features for those people who don’t want to change any cables and screens etc and want a quick way to revert back to stock firmware if needed. A great option for all tsdz2 owners on stock firmware!

OpenSource-Ebike-firmware / Colour_LCD by Casainho

This is the original and still current opensource Firmware developed by Casainho but integrating many features and ideas from other contributors, it has developed significantly since it was first created.

Originally the development focused on the use of the KT LCD3 screen which worked very well but had a fundamental issue in that it only had a small amount of memory which meant that some features could simply not be added to it without removing other features. There were some very clever hacks developed to make best use of the memory to get around this limitation as much as possible but ultimately the decision was made to start developing the firmware around screens that offered much more programming space and the new features would work on. So in the current form only the following screens are supported.

Bafang 850C, 860C and the sw102.

So if you wish to use the very latest and greatest version of the Opensource software, you will need to purchase and wire up one of these screens to use it.

Its also worth understanding that in order to use the screen it also needs to have customer firmware installed and this has its own software and installation paths.

Note the sw102 screen is initially tricky to write firmware too as it needs to be physically opened to gain access to the programming pins.

The initial hard wired programming steps are here

Once programmed you can seal it up again and from then on upgrade over Bluetooth! which is great.

I have opened 4 units to date and have a technique that works for me but its not as easy to open as the KT-LCD3 and the Bafang 850/860C screens can now be programmed with the correct hardware without opening at all.

The Main Wiki that covers all instructions on installation and features is here

Latest built firmware for upload is available here

The Endless Sphere Forum for all discusions on this current firmware is here

You will find mentions of the older firmware’s that did support the KT-LCD3 screen within the forum and in some of the setup guides, this is no longer valid for the current builds but still very useful for those that are interesting in using this screen and are happy not to be using the very latest version.

So why would you want to still use the KT-LCD3 screen or indeed any of the older Firmware versions?

Ok, the simple answer is if you are new to the opensource firmware then either of the two options above would be ideal. I myself am using the very latest build of Casainho’s firmware with a sw102 screen on my own bike and its fantasic. However as by now i’m sure you are aware we use the tsdz2 for a few adapted charity bikes and each of these has its own special requirements. Back end of 2019, we were working with the then beta version 19 of the firmware that was primarily being built by a user called Buba, and at the time he did some fantastic experimental work on different power modes for the TSDZ2. so you could choose to power the motor in either in Toque only mode, cadence only mode or the traditional power mode ( mixture of cadence and torque). For one of our specific riders who rides with a prosthetic leg, the Cadence only mode was an ideal solution that fixed the hunting the motor would experience in any torque based modes. Now truth be told we have not been able to test the latest firmware’s to see if this is still the case, but having these options was a great feature for us.

Luckily this fork was still kept and there is now a dedicated page for instructions here

The last release was v0.20.0-beta. 1

I ran this release for several months on my own bike without issue and its what’s running on ‘Bob’ the adapted trike, so its the firmware I personally recommend for the most flexible options for power delivery.

Buba also added a cool light feature that would link into the e-brakes to change from flashing to solid when braking!

Its also the last firmware that supports the awesome eMTB Assist mode, which is a blast for tricky climbing and general mountain bike tracks ( very responsive)

Hopefully that helps new comers navigate the current ( April 2020) options for adding opensource firmware to your TSDZ2. I’m sure there will be future developments, and I will try to add those as they happen, but feel free to add comments if you think I have missed any areas. I did not want to replicate the information that is already out there too much but rather give a overall navigation to the relevant webpages.

16 comments on “TongSheng TSDZ2 what Firmware options are there?

  1. Pingback: Experimenting with the TongSheng TSDZ2 Mid drive system Part 1 – Empowered People

  2. Thank you for this!

    I have bought the ST Link and am now just awaiting a speed sensor cable. I intend to keep the VLCD5 screen but am looking forward to seeing how close the new firmware makes the riding experience to my friends Steps equipped Ridgeback.

    Am already finding the range of the TDZ to be very good with a 14.5Ah battery but will gladly take further improvements.


    • Neil Perry @ Empowered People

      Ahh good to hear! Hopefully you will like the new firmware, the latest build for the stock screens is very solid and has lots of options to how it responds. I would suggest you try the emtb option. Also with the cable for the ST Link be sure to make it short and use a usb extension. I had issue with a cable that was only 15cm long but it worked when only 5cm long. Really seams to matter for some reason.


      • Okay will bear in mind thankya. I did not know their were different options for the stock screen build. I had a quick look at it when building the bike a few months ago so will have to investigate further.


      • Yes With the stock screen and motor you can use a special fork of the OpenSource firmware that has lots of options. have a look at the ‘Stock screen firmware fork’ section in this article above. you will need the ST link to update the firmware and the java tools that the guide links to but once setup its actually very easy to tick some options and upload with a single click ( like starting within the eMTB mode), then revert back if needed or try something else and upload. Tip you don’t need to run the tsdz2 with the speed sensor in while testing) so you can leave it unplugged if you are repeatable uploading , quick ride, and trying something else) the speed sensor cable can be a bit stiff when its new so its nice not to have to keep plugging it back in 10 times in a row!


      • Okay thank you for the tips.

        May I ask re: the other displays you are using – are the battery gauges any more accurate? If there is one negative about the stock display…the battery gauge is pretty useless


      • Neil Perry @ Empowered People

        Yes with the other screens you can choose to display a battery guage in percentage so you know you have say 38% left. Seams quite accurate maybe drops off a bit quick under 20% but it does not jump around as much under load there are settings for the battery resistance to help filter that out.


      • Ah okay. Food for thought for the future.


  3. Just an update for you – have done the deed and done a forum post on the forum >>> where I will add for details as I fine tune it. Have linked this blog post in it & I hope you don’t mind?

    Thank you again for this post and for recommending the eMTB map. I was impressed by the original setup for what is just a universal kit but am bowled over by the improvement the new firmware gives. I am going to tweak it further to soften it a bit as the take up of drive is a bit too eager in the lowest setting. Really enjoying it though!

    Liked by 1 person

    • Neil Perry @ Empowered People

      Hi Isla, ah great to hear. you are more than welcome to mention us on pedelecs forum! Yes I found aswell that the stock settings for the open source firmware did not match my torque sensor very well and it was generaly a bit keen. So I recommend you calibrate the torque sensor if you can. Details here for firmware version 1.0.0 and up. I have just uploaded to 1.1.0 today to test a few new tweaks like dial trip meters and it’s reset my torque cues so I will need to input those again myself :).

      Liked by 1 person

      • Ah greta okay – thanks for the tip – I will have a look at that!


      • Neil, have I read it wrong or do I need one of the other displays to calibrate the sensor?


      • Neil Perry @ Empowered People

        Ahh sorry if you use the stock screen and special firmware for it then you don’t need to calibrate the torque sensor. That only cameras in for firmware version 1.0.0 and IP camera that uses the 850c,860c or sw102 screens. Sorry I forget which screen you were using.


      • Ah no worries! Will just play around with the parameters then.


  4. Hi. I have the sw102 display and I’m trying to pair it with my tsdz2 motor. I plugged it in but it didn’t really work. As I expected the combination of tongsheng motor and bafang display won’t work. So can I somehow update the tsdz2’s controller firmware to match the display. I don’t really know what to do, so I would like to hear if someone has tips for me.

    Thanks in advance


    • Hi,

      in order to us ethe SW102 display you will need to use the Opensource Firmware on the TSDZ2. It will not work with the standard stock firmware. As well as flashing your motor you will also have to open and flash the SW102 display as this will be likely running its stock firmware for a bafang motor. this is all explained on the Github pages I link to here

      Have a look at the ‘OpenSource-Ebike-firmware / Colour_LCD by Casainho‘ section I have links to all the information.

      Personally having used the sw102 screen for some time with the TSDZ2 I do find that its not as nice to use as the larger 850c/860c screens but has the obvious advantage of being very small. The main issue for most people is the initial setup is a real pain and its easy to slightly damage the plastics and loose the water proof nature.


Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

This site uses Akismet to reduce spam. Learn how your comment data is processed.

%d bloggers like this: