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

Electric Motors and Controllers
buba   10 kW

10 kW
Posts: 540
Joined: Aug 31 2018 12:36am

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

Post by buba » Aug 05 2019 8:58am

casainho wrote:
Aug 05 2019 8:30am
buba wrote:
Aug 05 2019 7:00am
But word programming would be possible to implement on the controller as we are starting from scratch.
Please do not implement on the motor controller the saving of configurations because:

- as we saw on KT-LCD3, that has the same memory size as the motor controller and is very small, after adding many features the KT-LCD3 memory is full and no more features can be added and/or will need to be removed, as it happens right now

- there is absolutely no need to store the configurations on the motor controller, instead, the LCDs as 850C has 16x times more memory (512 kbytes VS 32 kbytes) and so they can store it without any worry

- we need to increase the configurations, probably is more important to implement a specific package that is transferred at startup and there is a confirmation to LCD about this. And the configurations can be a structure, that can be placed on an array as happens now and after do a memcpy() of the array to a structure as I implemented recently on 850C firmware
Of course! Was just thinking out loud.
Last edited by buba on Aug 05 2019 9:04am, edited 1 time in total.
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 540
Joined: Aug 31 2018 12:36am

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

Post by buba » Aug 05 2019 9:02am

cnrd wrote:
Aug 05 2019 8:33am
buba wrote:
Aug 05 2019 7:46am

Could you reset everything and see if that helps?

------------------------

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to factory defaults" under General Setup

Step 3: Increment the number until the screen is blank/turns off

Step 4: When the screen is blank/off, hold the ONOFF button for a couple of seconds. This is important!

Step 5: Release the ONOFF button

Step 6: Power on...
Hey thanks

Unfortunately nothing seems to help, I did also try flashing the alpha2, nothing.

The motor works fine with marcoq 0.3.5 and the stock display, so the motor does work.

I think that I may have messed up the wiring, I cut the male connector off a bafang 1-to-4 cable and soldered on a female connector, using the following mapping:

Bafang - TSDZ2
Brown - Blue
Orange - Red
Green - Brown
White - Green
Yellow - Yellow
Red - White
Blue - Orange
Black - Black

Used this picture for bafang pinout: https://electricbike.com/forum/filedata ... 1541800588

I also put a female connector on the KT-LCD3 with the following mapping:
Wire color - Solder pad
Yellow - Red
Blue - Blue
Red - Black
Black - Green
Green - Yellow

I had to do this as the stock bafang display pinout does not match the KT-LCD3.

Are these correct? Or is there a guide somewhere that I missed on how to create the cable?
Sorry, it was a long time ago I connected everything and I am not the best to help with these kind of things but:

https://github.com/OpenSource-EBike-fir ... D-to-TSDZ2

Maybe someone else here on the thread can help?
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 9:07am

cnrd wrote:
Aug 05 2019 8:33am
buba wrote:
Aug 05 2019 7:46am

Could you reset everything and see if that helps?

------------------------

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to factory defaults" under General Setup

Step 3: Increment the number until the screen is blank/turns off

Step 4: When the screen is blank/off, hold the ONOFF button for a couple of seconds. This is important!

Step 5: Release the ONOFF button

Step 6: Power on...
Hey thanks

Unfortunately nothing seems to help, I did also try flashing the alpha2, nothing.

The motor works fine with marcoq 0.3.5 and the stock display, so the motor does work.

I think that I may have messed up the wiring, I cut the male connector off a bafang 1-to-4 cable and soldered on a female connector, using the following mapping:

Bafang - TSDZ2
Brown - Blue
Orange - Red
Green - Brown
White - Green
Yellow - Yellow
Red - White
Blue - Orange
Black - Black

Used this picture for bafang pinout: https://electricbike.com/forum/filedata ... 1541800588

I also put a female connector on the KT-LCD3 with the following mapping:
Wire color - Solder pad
Yellow - Red
Blue - Blue
Red - Black
Black - Green
Green - Yellow

I had to do this as the stock bafang display pinout does not match the KT-LCD3.

Are these correct? Or is there a guide somewhere that I missed on how to create the cable?
Are the e-brakes maybe activated?
It might be worth cutting the Green Cable on the TSDZ2 motor side to eliminate it (i run it this way with no e brakes)

https://github.com/OpenSource-EBike-fir ... D-to-TSDZ2
Last edited by perryscope on Aug 05 2019 9:15am, edited 3 times in total.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

mspider65   100 µW

100 µW
Posts: 7
Joined: Aug 04 2019 2:10pm

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

Post by mspider65 » Aug 05 2019 9:08am

casainho wrote:
Aug 05 2019 8:30am

- there is absolutely no need to store the configurations on the motor controller, instead, the LCDs as 850C has 16x times more memory (512 kbytes VS 32 kbytes) and so they can store it without any worry
Hi Casainho,
It was not my intention to raise an issue.
In any case i was talking about the few parameters like motor_temperature_min/max, motor_type, battery_max_current etc.. which have an impact on the operation of the engine and that are already managed by the Controller Firmware.
They are now about 50/60 bytes and the controller data memory can handle up to 1024 bytes.
I also thought that it would have been safer for the controller to already have the correct configuration at startup, instead of waiting for the configuration data to be sent from the LCD.

cnrd   10 mW

10 mW
Posts: 25
Joined: Apr 12 2019 5:47am

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

Post by cnrd » Aug 05 2019 9:20am

perryscope wrote:
Aug 05 2019 9:07am
cnrd wrote:
Aug 05 2019 8:33am
buba wrote:
Aug 05 2019 7:46am

Could you reset everything and see if that helps?

------------------------

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to factory defaults" under General Setup

Step 3: Increment the number until the screen is blank/turns off

Step 4: When the screen is blank/off, hold the ONOFF button for a couple of seconds. This is important!

Step 5: Release the ONOFF button

Step 6: Power on...
Hey thanks

Unfortunately nothing seems to help, I did also try flashing the alpha2, nothing.

The motor works fine with marcoq 0.3.5 and the stock display, so the motor does work.

I think that I may have messed up the wiring, I cut the male connector off a bafang 1-to-4 cable and soldered on a female connector, using the following mapping:

Bafang - TSDZ2
Brown - Blue
Orange - Red
Green - Brown
White - Green
Yellow - Yellow
Red - White
Blue - Orange
Black - Black

Used this picture for bafang pinout: https://electricbike.com/forum/filedata ... 1541800588

I also put a female connector on the KT-LCD3 with the following mapping:
Wire color - Solder pad
Yellow - Red
Blue - Blue
Red - Black
Black - Green
Green - Yellow

I had to do this as the stock bafang display pinout does not match the KT-LCD3.

Are these correct? Or is there a guide somewhere that I missed on how to create the cable?
Are the e-brakes maybe activated?
It might be worth cutting the Green Cable on the TSDZ2 motor side to eliminate it (i run it this way with no e brakes)

https://github.com/OpenSource-EBike-fir ... D-to-TSDZ2
I plugged in some ebrakes, and when activating them the ebrake icon shows up, so I woldn't think so. I did try with the brakes in but still no power.

But in my case I could probably just desolder the white and green connectors, from what I'm reading the brakes activate on high?

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 9:27am

cnrd wrote:
Aug 05 2019 9:20am
perryscope wrote:
Aug 05 2019 9:07am
cnrd wrote:
Aug 05 2019 8:33am
buba wrote:
Aug 05 2019 7:46am

Could you reset everything and see if that helps?

------------------------

Step 1: Go to the Configuration Menu

Step 2: Go to the "Reset to factory defaults" under General Setup

Step 3: Increment the number until the screen is blank/turns off

Step 4: When the screen is blank/off, hold the ONOFF button for a couple of seconds. This is important!

Step 5: Release the ONOFF button

Step 6: Power on...
Hey thanks

Unfortunately nothing seems to help, I did also try flashing the alpha2, nothing.

The motor works fine with marcoq 0.3.5 and the stock display, so the motor does work.

I think that I may have messed up the wiring, I cut the male connector off a bafang 1-to-4 cable and soldered on a female connector, using the following mapping:

Bafang - TSDZ2
Brown - Blue
Orange - Red
Green - Brown
White - Green
Yellow - Yellow
Red - White
Blue - Orange
Black - Black

Used this picture for bafang pinout: https://electricbike.com/forum/filedata ... 1541800588

I also put a female connector on the KT-LCD3 with the following mapping:
Wire color - Solder pad
Yellow - Red
Blue - Blue
Red - Black
Black - Green
Green - Yellow

I had to do this as the stock bafang display pinout does not match the KT-LCD3.

Are these correct? Or is there a guide somewhere that I missed on how to create the cable?
Are the e-brakes maybe activated?
It might be worth cutting the Green Cable on the TSDZ2 motor side to eliminate it (i run it this way with no e brakes)

https://github.com/OpenSource-EBike-fir ... D-to-TSDZ2
I plugged in some ebakes, and when activating them the ebrake icon shows up, so I woldn't think so. I did try with the brakes in but still no power.

I did have something similar to this to this some time ago when I was switching between Marcos build and 0.18.x at the time.

As a sanity check i went back to stock, confirmed that was working then installed the opensource firmware over the top of that. That seamed to clear things for me. I did however have a backup of the program, data and option sections that my motor came with that i could flash with stlink so I know it was exactly as stock.

You could also try writing all 0's first to clear the flash before uploading the opensource firmware ( mentioned above a few posts back by Buba viewtopic.php?f=30&t=93818&start=2900#p1485248)
Empowered people support rider and trustee
www.empoweredpeople.co.uk

casainho   1.21 GW

1.21 GW
Posts: 3520
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Aug 05 2019 9:28am

mspider65 wrote:
Aug 05 2019 9:08am
They are now about 50/60 bytes and the controller data memory can handle up to 1024 bytes.
I also thought that it would have been safer for the controller to already have the correct configuration at startup, instead of waiting for the configuration data to be sent from the LCD.
Seems you are counting with the EEPROM but for manage it, there will be used programing bytes, the ones that are not used yet but Buba did mention to implement.

It is safe to not start the motor until the configuration package arrive from the LCD.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

cnrd   10 mW

10 mW
Posts: 25
Joined: Apr 12 2019 5:47am

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

Post by cnrd » Aug 05 2019 9:51am

perryscope wrote:
Aug 05 2019 9:27am
cnrd wrote:
Aug 05 2019 9:20am
perryscope wrote:
Aug 05 2019 9:07am
cnrd wrote:
Aug 05 2019 8:33am


Hey thanks

Unfortunately nothing seems to help, I did also try flashing the alpha2, nothing.

The motor works fine with marcoq 0.3.5 and the stock display, so the motor does work.

I think that I may have messed up the wiring, I cut the male connector off a bafang 1-to-4 cable and soldered on a female connector, using the following mapping:

Bafang - TSDZ2
Brown - Blue
Orange - Red
Green - Brown
White - Green
Yellow - Yellow
Red - White
Blue - Orange
Black - Black

Used this picture for bafang pinout: https://electricbike.com/forum/filedata ... 1541800588

I also put a female connector on the KT-LCD3 with the following mapping:
Wire color - Solder pad
Yellow - Red
Blue - Blue
Red - Black
Black - Green
Green - Yellow

I had to do this as the stock bafang display pinout does not match the KT-LCD3.

Are these correct? Or is there a guide somewhere that I missed on how to create the cable?
Are the e-brakes maybe activated?
It might be worth cutting the Green Cable on the TSDZ2 motor side to eliminate it (i run it this way with no e brakes)

https://github.com/OpenSource-EBike-fir ... D-to-TSDZ2
I plugged in some ebakes, and when activating them the ebrake icon shows up, so I woldn't think so. I did try with the brakes in but still no power.

I did have something similar to this to this some time ago when I was switching between Marcos build and 0.18.x at the time.

As a sanity check i went back to stock, confirmed that was working then installed the opensource firmware over the top of that. That seamed to clear things for me. I did however have a backup of the program, data and option sections that my motor came with that i could flash with stlink so I know it was exactly as stock.

You could also try writing all 0's first to clear the flash before uploading the opensource firmware ( mentioned above a few posts back by Buba viewtopic.php?f=30&t=93818&start=2900#p1485248)
Just tested walk assist, didn't work, I'm starting to feel like one of my solder spots are not up to snuff.

Can anyone confirm that Vin is the same as PL?

As it feels like the motor isn't actually turning on.

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 10:15am

cnrd wrote:
Aug 05 2019 9:51am

Just tested walk assist, didn't work, I'm starting to feel like one of my solder spots are not up to snuff.

Can anyone confirm that Vin is the same as PL?

As it feels like the motor isn't actually turning on.
Yes 'Vin' on the TSDZ2 is the pin that detects the full battery voltage and turns on the motor as a result, Bafang name this 'PL'

You should see full battery voltage on this wire when the screen is switched on.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

shaddi   100 mW

100 mW
Posts: 43
Joined: May 30 2018 3:20pm

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

Post by shaddi » Aug 05 2019 11:10am

casainho wrote:
Aug 05 2019 8:30am
- there is absolutely no need to store the configurations on the motor controller, instead, the LCDs as 850C has 16x times more memory (512 kbytes VS 32 kbytes) and so they can store it without any worry
I don't think so. There are some config-variables that are always the same and you don't need to change them often. Wheel perimeter, motor current limits ect. I think the motor should be runnable without a display after setting these parameters up once.

casainho   1.21 GW

1.21 GW
Posts: 3520
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Aug 05 2019 11:39am

shaddi wrote:
Aug 05 2019 11:10am
I think the motor should be runnable without a display after setting these parameters up once.
Technically that would be possible but would also compromise the implementation of future new features as also possible need corrections/maintenance of current features (for the reasons I did explain).

Current project is to run TSDZ2 with feature rich LCDs like 850C and SW102 Bluetooth. On SW102 Bluetooth for instance, the developers seek to send data to Strava.

Having the TSDZ2 running without LCD is another project -- need to have other developers for developing and maintain that project.
Developer of the Flexible OpenSource firmware for EBike motor controllers (TSDZ2 and KT) and LCDs (KT-LCD3 and Bafang 850C color LCD).

If you like my work, please consider making a donation. I am being using the donations to buy needed resources for my developments. My paypal: casainho AT gmail.com.

cnrd   10 mW

10 mW
Posts: 25
Joined: Apr 12 2019 5:47am

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

Post by cnrd » Aug 05 2019 11:48am

perryscope wrote:
Aug 05 2019 10:15am
cnrd wrote:
Aug 05 2019 9:51am

Just tested walk assist, didn't work, I'm starting to feel like one of my solder spots are not up to snuff.

Can anyone confirm that Vin is the same as PL?

As it feels like the motor isn't actually turning on.
Yes 'Vin' on the TSDZ2 is the pin that detects the full battery voltage and turns on the motor as a result, Bafang name this 'PL'

You should see full battery voltage on this wire when the screen is switched on.
Hmm what should I try at this point? Redo all the soldering?

One thing I just noticed, I put the throttle on the marcoq firmware, after using the throttle, I could no longer use the pedals to activate the motor.

Anyone have a link to the stock firmware? As I could try flashing that, to reset everything.

andrea_104kg   100 W

100 W
Posts: 148
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Aug 05 2019 12:49pm

I have a big problem. When i load controller file i see a long 'address 0xxxxx isi out of range' . I can programming but when start the lcd3 not work all field are light. Why? I traied to fill with zero but nothing change.

nbdriver   100 mW

100 mW
Posts: 37
Joined: Jul 31 2015 4:38am
Location: Belgium

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

Post by nbdriver » Aug 05 2019 2:17pm

Hi everyone, so much has changed since my last visit. buba what a work you've done to make this firmware more Advanced than it already was :shock: . I can't beleive that i now have all these functions on this motor that i bought more than 3 years ago. Thank you very much for that.

I am about to try the latest version but the files are .ihx and not .hex files as usual. I tried to open them with ST-Visual programmer, and it seems to work as an .hex file. But i wan't to be sure this is the way to go (Because .ihx is not listed in the dropdown box, have to selec "all files")

Thank you very much for your help.

Rafe   10 W

10 W
Posts: 91
Joined: Oct 16 2018 5:56pm

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

Post by Rafe » Aug 05 2019 2:30pm

Buba

Im still having a problem getting my head around cadence mode, surely there is more than a cadence input from the way it is behaving.

I'm running on a Nexus 8 speed hub gear and 48v motor, 52 volt battery Max 18 amps and 800 watts set. To get any decent response I need the cadence assist set at 90 and more. Go up a gentle slope near my home at 10mph in 3rd gear it starts off with decent assist and soon settles to about 11 watts assist and then I change gear to 6 or 8 and suddenly I've nearly got 300 watts assist and to maintain 10mph I am ghost pedalling. Going back down the slope everything seems normal in any gear with hardly any assist. Then as I turn into the rutted lane up to my place pedalling very slowly in gear 8 the assist is suddenly 500 watts or more (which I don't want :) ). Is there also a wheel speed and torque input into this mode?

buba   10 kW

10 kW
Posts: 540
Joined: Aug 31 2018 12:36am

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

Post by buba » Aug 05 2019 3:01pm

andrea_104kg wrote:
Aug 05 2019 12:49pm
I have a big problem. When i load controller file i see a long 'address 0xxxxx isi out of range' . I can programming but when start the lcd3 not work all field are light. Why? I traied to fill with zero but nothing change.
Have you set the STM8S105x6 on ST Visual Programmer? What version are you trying to load?

If anyone ever gets the "Address our of range..." it will not work as ST Visual Programmer is warning that it could not load the entire hex file on the device. Make sure that you have picked the right device: STM8S105x6.

Sorry for the late reply, you have maybe already sorted it out by now!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 540
Joined: Aug 31 2018 12:36am

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

Post by buba » Aug 05 2019 3:09pm

nbdriver wrote:
Aug 05 2019 2:17pm
Hi everyone, so much has changed since my last visit. buba what a work you've done to make this firmware more Advanced than it already was :shock: . I can't beleive that i now have all these functions on this motor that i bought more than 3 years ago. Thank you very much for that.

I am about to try the latest version but the files are .ihx and not .hex files as usual. I tried to open them with ST-Visual programmer, and it seems to work as an .hex file. But i wan't to be sure this is the way to go (Because .ihx is not listed in the dropdown box, have to selec "all files")

Thank you very much for your help.
Welcome back and I am excited that you will be testing the 0.20.0! Many improvements over the 0.19.0 and basically more than just a simple update! You really need to try it out to feel the difference. Everything should be improved. And more to come! :wink:

It is okay to use the .ihx. Apologize for not explaining that earlier when I made the 0.20.0 available for testing. Should be packed to .hex but will work fine.

Hope you will like the 0.20.0 Alpha 2!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

buba   10 kW

10 kW
Posts: 540
Joined: Aug 31 2018 12:36am

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

Post by buba » Aug 05 2019 3:23pm

Rafe wrote:
Aug 05 2019 2:30pm
Buba

Im still having a problem getting my head around cadence mode, surely there is more than a cadence input from the way it is behaving.

I'm running on a Nexus 8 speed hub gear and 48v motor, 52 volt battery Max 18 amps and 800 watts set. To get any decent response I need the cadence assist set at 90 and more. Go up a gentle slope near my home at 10mph in 3rd gear it starts off with decent assist and soon settles to about 11 watts assist and then I change gear to 6 or 8 and suddenly I've nearly got 300 watts assist and to maintain 10mph I am ghost pedalling. Going back down the slope everything seems normal in any gear with hardly any assist. Then as I turn into the rutted lane up to my place pedalling very slowly in gear 8 the assist is suddenly 500 watts or more (which I don't want :) ). Is there also a wheel speed and torque input into this mode?
Hmm... So when you configure an assist level multiplier in Cadence Assist it will actually set the target rotational speed of the motor. If the motor rotates slower it will increase power until the rotational speed increases. If the motor rotates faster it will lower the power. So if you change gears this will upset the ratio and you need to change assist level accordingly. The system does not know that the ratio has changed.

Just thought that this implementation works fine on direct drive motors as the ratio is fixed (hub motor) but is maybe not as optimal where the ratio changes with gear shifts. How does the Bafang compare when shifting gears? Have never tried cadence only assist on a mid drive before. How do you configure the Bafang and how does it react when removing the wheel speed sensor? Does it work the same with and without the wheel speed sensor?

We are only looking at cadence in Cadence Assist but I understand why you were surprised by the difference in assistance!
GitHub: https://github.com/leon927
PayPal: leonstor at bredband.net

cnrd   10 mW

10 mW
Posts: 25
Joined: Apr 12 2019 5:47am

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

Post by cnrd » Aug 05 2019 3:32pm

perryscope wrote:
Aug 05 2019 10:15am
cnrd wrote:
Aug 05 2019 9:51am

Just tested walk assist, didn't work, I'm starting to feel like one of my solder spots are not up to snuff.

Can anyone confirm that Vin is the same as PL?

As it feels like the motor isn't actually turning on.
Yes 'Vin' on the TSDZ2 is the pin that detects the full battery voltage and turns on the motor as a result, Bafang name this 'PL'

You should see full battery voltage on this wire when the screen is switched on.
Hey something hit me, should Rx and Tx be swapped?
As in TSDZ2 brow wire to bafang green and TSDZ2 yellow to bafang yellow.

shaddi   100 mW

100 mW
Posts: 43
Joined: May 30 2018 3:20pm

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

Post by shaddi » Aug 05 2019 3:34pm

casainho wrote:
Aug 05 2019 11:39am
shaddi wrote:
Aug 05 2019 11:10am
I think the motor should be runnable without a display after setting these parameters up once.
Technically that would be possible but would also compromise the implementation of future new features as also possible need corrections/maintenance of current features (for the reasons I did explain).

Current project is to run TSDZ2 with feature rich LCDs like 850C and SW102 Bluetooth. On SW102 Bluetooth for instance, the developers seek to send data to Strava.

Having the TSDZ2 running without LCD is another project -- need to have other developers for developing and maintain that project.
hm, i still don't get it. The code is already there, why is there a need for another project or somebody to maintain this special scenario?

If i get it right, the eeprom is filled with some default variables if the first byte is not "our key". And these variables are loaded at every bootup. As soon as the display is sending its data, all these variables are overwritten. The function eeprom_write_if_values_changed is still commented out. I think this is just a design flaw. Why do we have to write the actual assist-level to the eeprom?

Thats why i opened the Ticket #30 at github back than... Imho there is still a need to split the variable in two separate ones. One for persistent data that can be written to the eeprom and the second one for "runtime data" like the current assit level, or light-status or stuff like that...

Or did i miss something else here?

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 3:59pm

cnrd wrote:
Aug 05 2019 3:32pm
perryscope wrote:
Aug 05 2019 10:15am
cnrd wrote:
Aug 05 2019 9:51am

Just tested walk assist, didn't work, I'm starting to feel like one of my solder spots are not up to snuff.

Can anyone confirm that Vin is the same as PL?

As it feels like the motor isn't actually turning on.
Yes 'Vin' on the TSDZ2 is the pin that detects the full battery voltage and turns on the motor as a result, Bafang name this 'PL'

You should see full battery voltage on this wire when the screen is switched on.
Hey something hit me, should Rx and Tx be swapped?
As in TSDZ2 brow wire to bafang green and TSDZ2 yellow to bafang yellow.

You can try that but the fact you said you were seeing the data from the motor sensors. (cadence and torque) would suggest the serial coms are working fine. is that definitely the case? i did have issues with tx and rx wires being wrong on my screen but it would not get past showing all the lcd elements showing.

maybe its posible you have one way serial motor to screen?
Empowered people support rider and trustee
www.empoweredpeople.co.uk

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 4:20pm

buba wrote:
Aug 05 2019 3:23pm
Rafe wrote:
Aug 05 2019 2:30pm
Buba

Im still having a problem getting my head around cadence mode, surely there is more than a cadence input from the way it is behaving.

I'm running on a Nexus 8 speed hub gear and 48v motor, 52 volt battery Max 18 amps and 800 watts set. To get any decent response I need the cadence assist set at 90 and more. Go up a gentle slope near my home at 10mph in 3rd gear it starts off with decent assist and soon settles to about 11 watts assist and then I change gear to 6 or 8 and suddenly I've nearly got 300 watts assist and to maintain 10mph I am ghost pedalling. Going back down the slope everything seems normal in any gear with hardly any assist. Then as I turn into the rutted lane up to my place pedalling very slowly in gear 8 the assist is suddenly 500 watts or more (which I don't want :) ). Is there also a wheel speed and torque input into this mode?
Hmm... So when you configure an assist level multiplier in Cadence Assist it will actually set the target rotational speed of the motor. If the motor rotates slower it will increase power until the rotational speed increases. If the motor rotates faster it will lower the power. So if you change gears this will upset the ratio and you need to change assist level accordingly. The system does not know that the ratio has changed.

Just thought that this implementation works fine on direct drive motors as the ratio is fixed (hub motor) but is maybe not as optimal where the ratio changes with gear shifts. How does the Bafang compare when shifting gears? Have never tried cadence only assist on a mid drive before. How do you configure the Bafang and how does it react when removing the wheel speed sensor? Does it work the same with and without the wheel speed sensor?

We are only looking at cadence in Cadence Assist but I understand why you were surprised by the difference in assistance!
Hi Buba,

The bafang motor is somewhat different in how it feels to ride. the Assist levels are set to fix the maximum power and set cadence speed to run at, so as you move up the assistance levels you are increasing the cadence in set amounts.

Its nice for cruising but you do tend to use the assist levels with the gears more, change up gears and sometimes you have to drop the assist level to lower the cadence to suite.
If you remove the speed sensor it makes no difference at all to how the motor reacts, I know this for sure at i had to ride over 200KM with no speed sensor the other week after my tyre melted the speed cable sensor wire right through!

changing gear is somewhat vicious! and a gear sensor really helps to calm this down, or using the gentle ebrake method to activate the ebrake when changing gear without pulling the lever enough to actually brake.

all in the bafang rides in a very constant fashion, providing a set amount of power continuously as long as you pedal, but if you want to change cadence you have to increase the assist level or you will be pushing against the motor.

These are my settings in the bafang config tool on my towing bike running a BBS 02 (350W motor running up to 20A so 720W peak but does not feel as powerful at the TSDZ2 at 500W) This is not connected to the bike just looking at the config file offline.
bafang config tool.PNG
bafang config tool.PNG (30.8 KiB) Viewed 214 times
you can see how I have changed the cadence speed to increase with the power.
(wow cannot believe the config file on my motor is over two years old!)
bafang config tool 2.PNG
bafang config tool 2.PNG (29.25 KiB) Viewed 214 times
bafang config tool 3.PNG
bafang config tool 3.PNG (24.25 KiB) Viewed 214 times
Empowered people support rider and trustee
www.empoweredpeople.co.uk

bruwie   1 mW

1 mW
Posts: 13
Joined: Mar 02 2017 3:12pm
Location: Lower Saxony,Germany

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

Post by bruwie » Aug 05 2019 4:42pm

I have a little problem.
In the Odometer Field (Main Screen Setup 7/1) the motor temperature is not displayed. In the Temperature field (Main Screen Setup 10/1) the temperature is displayed. However, I would like to use this field for the 10/2 Battery state of charge in percent. Do others have the same problem or have I set something wrong?
Thank you
TSDZ2 36 Volt 350 Watt with motor temperature sensor, LCD3, Batterypack 36 Volt 23 Ah, no throttle and brakesensors

perryscope   100 W

100 W
Posts: 102
Joined: Jan 06 2019 4:29pm
Contact:

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

Post by perryscope » Aug 05 2019 4:56pm

bruwie wrote:
Aug 05 2019 4:42pm
I have a little problem.
In the Odometer Field (Main Screen Setup 7/1) the motor temperature is not displayed. In the Temperature field (Main Screen Setup 10/1) the temperature is displayed. However, I would like to use this field for the 10/2 Battery state of charge in percent. Do others have the same problem or have I set something wrong?
Thank you

Actually yes , Not tried this before but on 0.20.0 Alpha 2 I have the same issue. cannot select option 7 to show temperature in Odometer field.
Empowered people support rider and trustee
www.empoweredpeople.co.uk

andrea_104kg   100 W

100 W
Posts: 148
Joined: Mar 05 2018 5:51pm

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

Post by andrea_104kg » Aug 05 2019 5:26pm

buba wrote:
Aug 05 2019 3:01pm
andrea_104kg wrote:
Aug 05 2019 12:49pm
I have a big problem. When i load controller file i see a long 'address 0xxxxx isi out of range' . I can programming but when start the lcd3 not work all field are light. Why? I traied to fill with zero but nothing change.
Have you set the STM8S105x6 on ST Visual Programmer? What version are you trying to load?

If anyone ever gets the "Address our of range..." it will not work as ST Visual Programmer is warning that it could not load the entire hex file on the device. Make sure that you have picked the right device: STM8S105x6.

Sorry for the late reply, you have maybe already sorted it out by now!
Thank you! In fact I was wrong and used x4 for flash roms!
now everything works perfectly! I did a little test ride:
Power assist works as before only it is even more progressive and sensitive, very beautiful!
Torque assist is for real cyclists, not for me! It seemed to me more tiring but it seems to me much better than the original engine. I think it's the most real emulation of a normal bicycle!
Cadence mode does not interest me, not because of the lack of respect for your work, but because I have 3 other bikes with hub engines :-) and I don't want another one.
Also to work very little on the road I use a little trick: I put street mode at 350w, I use 9 levels (max 5x), when I use level 9 I have the advantage of a very light pedal (5x) but with power limited to 350w. It is sufficient for medium climbs with zero fatigue and great battery saving. It's better than the hub and even better than the Specialized Turbo Levo.
I thought it was impossible to improve the excellent version 19 but you did it!
There is a slight resistance backwards to the ignition which then disappears after a few rides.
Emtb: I don't like it, I think that tsdz2 is already emtb because of its intrinsic characteristics.
However an exceptional job .... thanks!

Post Reply