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

Electric Motors and Controllers
kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Oct 14 2018 1:00am

EndlessCadence wrote:
Oct 13 2018 6:48am
kortina wrote:
Oct 13 2018 12:54am
Hi Guys,
Received all of my gear to upgrade my TSDZ2. I have made the cables, flashed the KT-LCD3 OK.

When I attempt to flash my TSDZ2 I get an error:

Code: Select all

> Loading file C:\Users\Michael\Downloads\TSDZ2-v0.13.1.hex in PROGRAM MEMORY area  ...
< File successfully loaded. File Checksum 0x19D1EE
> Programming  PROGRAM MEMORY area...
Error : Problem while trying to Reset swim and device. Apply a Power On Reset
< PROGRAM MEMORY programming completed.
> Verifying PROGRAM MEMORY area...
Error : Problem while trying to Reset swim and device. Apply a Power On Reset
< PROGRAM MEMORY successfully verified.
I have attempted the EEPROM reset:
To use the reset to factory defaults feature (it's no longer necessary to program the data memory!):
- Enter configuration menu 6
- Go to submenu 3
- Press the UP button 10 times, a counter on the display will be incremented anytime you do this
- The display will turn off
- Turn it on again and it will reset your configuration to the factory defaults!
The KT-LCD lights ups, and shows the correct voltage. (52v battery, fully charged showing 57.7).

The issue that I get is that 0 watts of power are applied to the motor.

Any ideas what I can do to finish this off, and get the bike running again?

Kind Regards
Hi kortina, the resets you're talking about aren't related to each other in any way. The EEPROM reset clears your data memory (the firmware configuration). You seem to have issues with the programmer and communication with the device. Is the reset signal (RST) of the programmer properly connected? Basically your device isn't properly programmed right now...

Btw ST Visual Programmer 3.4.1 is the correct tool, you don't need ST Link Utility at all.
Hi EC,

After double and triple checking my cables, I decided to try another laptop... no more errors!

But... Still the same behaviour.

I have flashed to 0.14 (screen and motor), used menu 6,3 and cleared.
Set my details for 52v setup.

I still have no power.

However, if I start pedaling just after switching on, I get a quick burst for about 0.5sec !?

Any ideas what I should try next?

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 1:55am

kortina wrote:
Oct 14 2018 1:00am

I have flashed to 0.14 (screen and motor), used menu 6,3 and cleared.
Set my details for 52v setup.

I still have no power.

However, if I start pedaling just after switching on, I get a quick burst for about 0.5sec !?

Any ideas what I should try next?
What's your distance between speed sensor and magnet? Try a few distances of at least 5mm (up to 1cm?). I had this issue too and my speed on the display quickly jumped to around 99 km/h.

kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Oct 14 2018 4:05am

EndlessCadence wrote:
Oct 14 2018 1:55am


What's your distance between speed sensor and magnet? Try a few distances of at least 5mm (up to 1cm?). I had this issue too and my speed on the display quickly jumped to around 99 km/h.
Hi EC,
I just tested again, played with the sensor. It was reading accurate, then I adjusted it to a bad position, then back to accurate.

It seems fine reading between 0-16km/h that I tested it to.

It almost seems like the issue some users had with a 52v battery on the stock 48v motor (where they get no power until < 55v)?

I am running the 52v (750w) motor, and a 52v battery. (Currently at 57.4 volts).

Should I send you a copy of the 'data memory' tab?
Could the data be corrupt?

Thanks again.

User avatar
jbalat   10 kW

10 kW
Posts: 530
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Oct 14 2018 5:18am

I had similar issues at the start, it’s just bad flashing and mixed memory.

Try using the new 14 firmwares, both lcd and tsdz2
Mine started working properly after I tried the 13beta versions.

Open the stvp and flash the program tab and memory tabs with zeroes.
Then switch back to program tab open the hex file and flash it
Do the same for both motor and lcd

Before you start Make sure you have unplugged your battery and press the on/off button to drain residual voltage from the lcd. Unplug the lcd from the motor too if you can.

Go into config, setup no. Of cells and of course the minimum cutoff voltage and the number of max amps. If these are wrong then you will get nothing. Also use top and middle buttons and make sure you have at least 200w.

If you find there are random values in the wrong menus or the assist levels aren’t setup then it’s another bad flash...
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

User avatar
jbalat   10 kW

10 kW
Posts: 530
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Oct 14 2018 5:22am

Just wanted to report that the temp sensor worked a treat today, i was able to reach 64 degrees going up a slight incline with around 420w. Thanks Casainho :D
Good to know I can keep an eye on the temperature
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 5:57am

jbalat wrote:
Oct 14 2018 5:18am
Also use top and middle buttons and make sure you have at least 200w.
Please don't do this. Leave the target battery power setting (button ON/OFF + UP) to zero, this will you give you the best performance. See the release notes for more details.

Using default settings and only configure the specific battery settings the motor should work great, I've tested this a few times.

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 5:57am

jbalat wrote:
Oct 14 2018 5:18am
Also use top and middle buttons and make sure you have at least 200w.
Please don't do this. Leave the target battery power setting (button ON/OFF + UP) to zero, this will you give you the best performance. See the release notes for more details. I've created the following issue: https://github.com/OpenSource-EBike-fir ... /issues/13

Using default settings and only configure the specific battery settings and motor type (if 36v) the motor should work great, I've tested this a few times.
jbalat wrote:
Oct 14 2018 5:22am
Just wanted to report that the temp sensor worked a treat today, i was able to reach 64 degrees going up a slight incline with around 420w. Thanks Casainho :D
Good to know I can keep an eye on the temperature
Nice!

AZUR   10 W

10 W
Posts: 81
Joined: Apr 05 2018 6:52am

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

Post by AZUR » Oct 14 2018 6:42am

Hi EC,

Last night I was wondering how you can test the engine in the steep mountains if you live in a completely flat country like the Netherlands?

:D :D :D

Or do you live on the border with another more mountainous country?

Regards

:P :P :P

aja   10 W

10 W
Posts: 69
Joined: May 06 2014 2:05pm

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

Post by aja » Oct 14 2018 8:34am

Well my premature excitement has come to an abrupt end ☹️
Haven’t got past the second stage, I.e. flashing the TSDZ2 from the ST Link via the speed sensor...keeps saying Swim comms error. I’ve changed the wires in different pins on the speed sensor (going to TSDZ2) and no change...I read that one has to use the speed sensor extension cable but was reticent to cut it up. I also have a standard speed sensor (not the twin output version), both have 6 pins. Spent a day and a half soldering, resoldering and getting knowhere 😞.
If no other suggestions will have a go at cutting up my speed sensors...in the meantime I’ve flashed the 0.14 release to the LCD3.

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 9:45am

casainho wrote:
Oct 13 2018 2:52pm
EndlessCadence wrote:
Oct 13 2018 2:15pm
:!: Everyone, after a day full of testing I'm confident to release version 0.14.0. You can find it here, including an overview of the changes and open issue(s):
Good work!! I hope to test it on next days.
Thanks! I'm very interested what you think of it after testing.
So, with all the bugs and things we want to implement, I think would be a good investment for you to debug with JTAG, will be faster for inspecting the code "in real time", see the variables values on break points, etc (I guess you are not doing JTAG debug).

To do JTAG debug you don't need any extra hardware, it is just STLinkV2 connected as you have to flash the firmware. In terms of software, I use Eclipse, OpenOCD and GDB and here is a screenshot of STM8 code debug session:

Image

Here are the instructions I wrote for being able to JTAG debug: https://opensourceebikefirmware.bitbuck ... mware.html
You've guessed right :D
I have experience with OpenOCD and GDB from the past but didn't have time yet to try it. I'm that experienced that I don't need debugging :P

Thanks for the instructions, will try it! I'm wondering how you test the behaviour and feel of the bike in a stationary situation? I don't even have throttle... But for debugging configuration and communications (UART) I think it is very useful.

In the meantime I was thinking about the temperature sensor. Can't we use a digital temperature sensor with SPI/I2C or even one wire interface? Maybe you have a drawing or overview of all the free pins of the STM8? For my Bluetooth experiments I also need a way to communicate with the STM8.

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 9:50am

AZUR wrote:
Oct 14 2018 6:42am
Hi EC,

Last night I was wondering how you can test the engine in the steep mountains if you live in a completely flat country like the Netherlands?

:D :D :D

Or do you live on the border with another more mountainous country?

Regards

:P :P :P
LOL :D I can't :P We have some hills here and bridges and viaducts of course.
And when I go to real mountains (Pyrenees, Alps) I take my unassisted road bike with me to enjoy the suffering :P

casainho   100 MW

100 MW
Posts: 2753
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Oct 14 2018 9:59am

EndlessCadence wrote:
Oct 14 2018 9:45am
casainho wrote:
Oct 13 2018 2:52pm
EndlessCadence wrote:
Oct 13 2018 2:15pm
:!: Everyone, after a day full of testing I'm confident to release version 0.14.0. You can find it here, including an overview of the changes and open issue(s):
Good work!! I hope to test it on next days.
Thanks! I'm very interested what you think of it after testing.
So, with all the bugs and things we want to implement, I think would be a good investment for you to debug with JTAG, will be faster for inspecting the code "in real time", see the variables values on break points, etc (I guess you are not doing JTAG debug).

To do JTAG debug you don't need any extra hardware, it is just STLinkV2 connected as you have to flash the firmware. In terms of software, I use Eclipse, OpenOCD and GDB and here is a screenshot of STM8 code debug session:

Image

Here are the instructions I wrote for being able to JTAG debug: 0ⁿhttps://opensourceebikefirmware.bitbucket.io/development/Development_tools--Linux--Step-by-step_tutorial_development_tools--(optional)_Tools_to_debug_the_firmware.html
You've guessed right :D
I have experience with OpenOCD and GDB from the past but didn't have time yet to try it. I'm that experienced that I don't need debugging :P

Thanks for the instructions, will try it! I'm wondering how you test the behaviour and feel of the bike in a stationary situation? I don't even have throttle... But for debugging configuration and communications (UART) I think it is very useful.

In the meantime I was thinking about the temperature sensor. Can't we use a digital temperature sensor with SPI/I2C or even one wire interface? Maybe you have a drawing or overview of all the free pins of the STM8? For my Bluetooth experiments I also need a way to communicate with the STM8.
DS18B20 sensor, and I bought 2 units to test but as you will see on the datasheet, it needs fast timmings to communicate and that would colide with motor control timmings. Also, would be a bit more complex to wire to motor controller so would have an even bigger barrier.
Also, it needs an IO input and there are 2 near the throttle header but those have a low pass filter (capacitor + resistor) so could even not work for fast communications??

So yes, there are 2 digital pins with low pass filters, like if those could be used for gear shift sensor, etc.
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.

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 14 2018 10:46am

casainho wrote:
Oct 14 2018 9:59am
DS18B20 sensor, and I bought 2 units to test but as you will see on the datasheet, it needs fast timmings to communicate and that would colide with motor control timmings. Also, would be a bit more complex to wire to motor controller so would have an even bigger barrier.
Also, it needs an IO input and there are 2 near the throttle header but those have a low pass filter (capacitor + resistor) so could even not work for fast communications??

So yes, there are 2 digital pins with low pass filters, like if those could be used for gear shift sensor, etc.
Are there only two IO's left? That means I have to use the UART for bluetooth (and others) and basically break the connection with the display?

Btw, do you have time to review this PR? https://github.com/OpenSource-EBike-fir ... ke/pull/16
I've created a preprocessor switch/macro to choose between throttle and non-throttle version of the firmware. Release script builds both and the hexfiles (0.14.1) are included as well.

User avatar
jbalat   10 kW

10 kW
Posts: 530
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Oct 14 2018 5:50pm

When will you be releasing the non-throttle version soon ? is it worth me holding off a couple of days from installing ver 14..

BTW I tried setting zero power in version 12 and it gives me zero power LOL.. I guess you just implemented disabling that feature in 14...

Casainho, I got to 78degrees on a casual ride home, it's 26 degrees outside. I had just finished coming up a hill. Btw the display was not flashing ??? should it be ???
Attachments
IMG_20181015_16453.jpg
IMG_20181015_16453.jpg (37.88 KiB) Viewed 460 times
Last edited by jbalat on Oct 15 2018 1:24am, edited 1 time in total.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

User avatar
jbalat   10 kW

10 kW
Posts: 530
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Oct 15 2018 1:20am

BTW I have just loaded up rev 14 and disabled the quick power setting you mentioned. I was able to hit about 625w setting the assist level to 5000w and max current to 18A, this is about right since my battery was down to 37v.
(I would still prefer to use a torque multiplier of 5.0 and quick set the power to 700w instead, rather than relying solely on the assist level for power as well, it feels like I'm playing lotto not knowing what power I'm going to get next)

I have done some changes to up the cadence which works well.

I tried fixing that 2 second delay but changing this line in ebike_app_c did absolutely nothing

Code: Select all

  // now count 2 seconds
    case STATE_STARTUP_PEDALLING:
    if (ui8_rtst_counter++ > 4) // 0.4 seconds JB
    
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 15 2018 1:54am

jbalat wrote:
Oct 15 2018 1:20am
BTW I have just loaded up rev 14 and disabled the quick power setting you mentioned. I was able to hit about 625w setting the assist level to 5000w and max current to 18A, this is about right since my battery was down to 37v.
(I would still prefer to use a torque multiplier of 5.0 and quick set the power to 700w instead, rather than relying solely on the assist level for power as well, it feels like I'm playing lotto not knowing what power I'm going to get next)

I have done some changes to up the cadence which works well.

I tried fixing that 2 second delay but changing this line in ebike_app_c did absolutely nothing

Code: Select all

  // now count 2 seconds
    case STATE_STARTUP_PEDALLING:
    if (ui8_rtst_counter++ > 4) // 0.4 seconds JB
    
Nice! That's some good news. If you download this branch you'll have the non-throttle version (not released yet).
https://github.com/OpenSource-EBike-fir ... le_version

The compile and "compile and flash" scripts build the non-throttle version by default. In the releases folder you can find the precompiled version.

kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Oct 15 2018 4:31am

jbalat wrote:
Oct 14 2018 5:18am


Open the stvp and flash the program tab and memory tabs with zeroes.
Then switch back to program tab open the hex file and flash it
Do the same for both motor and lcd

Before you start Make sure you have unplugged your battery and press the on/off button to drain residual voltage from the lcd. Unplug the lcd from the motor too if you can.

Go into config, setup no. Of cells and of course the minimum cutoff voltage and the number of max amps. If these are wrong then you will get nothing. Also use top and middle buttons and make sure you have at least 200w.

If you find there are random values in the wrong menus or the assist levels aren’t setup then it’s another bad flash...
Thanks jbalat

Still no luck :(


I disconnected the battery, then attempted to turn the system on to drain the residual power.
I disconnected the LCD, then reflashed all zeros (program and data).
I then flashed v14 to the LCD (program)

I then flashed all zeros to the motor (program and data)
I then flashed v14 to the Motor (program)

Reconnected the LCD and Battery, turned on and setup the 52v parameters.

Still no luck, same deal as yesterday... LCD shows voltage, and accurate speed, but no power.

User avatar
jbalat   10 kW

10 kW
Posts: 530
Joined: Nov 10 2012 11:50pm
Location: Melbourne, Australia

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

Post by jbalat » Oct 15 2018 5:18am

That sucks bro. Maybe you can try a few older versions and see how you go. I was in your situation for a while but got it going in the end. Don’t give up.
Please subscribe to my Youtube home page for Quadcopters, FPV and Bike Rides http://www.youtube.com/jbalatutube
My build log here http://endless-sphere.com/forums/viewto ... =6&t=55352
For some cool ebike talk join us on The Best ebike https://www.facebook.com/groups/193581737807033/
Tech talk TSDZ2 Opensource firmware https://endless-sphere.com/forums/viewt ... &start=150
Opensource TSDZ2 Wiki https://github.com/OpenSource-EBike-fir ... _wiki/wiki

EndlessCadence   100 W

100 W
Posts: 217
Joined: Aug 22 2018 4:31am

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

Post by EndlessCadence » Oct 15 2018 5:22am

kortina wrote:
Oct 15 2018 4:31am
jbalat wrote:
Oct 14 2018 5:18am


Open the stvp and flash the program tab and memory tabs with zeroes.
Then switch back to program tab open the hex file and flash it
Do the same for both motor and lcd

Before you start Make sure you have unplugged your battery and press the on/off button to drain residual voltage from the lcd. Unplug the lcd from the motor too if you can.

Go into config, setup no. Of cells and of course the minimum cutoff voltage and the number of max amps. If these are wrong then you will get nothing. Also use top and middle buttons and make sure you have at least 200w.

If you find there are random values in the wrong menus or the assist levels aren’t setup then it’s another bad flash...
Thanks jbalat

Still no luck :(


I disconnected the battery, then attempted to turn the system on to drain the residual power.
I disconnected the LCD, then reflashed all zeros (program and data).
I then flashed v14 to the LCD (program)

I then flashed all zeros to the motor (program and data)
I then flashed v14 to the Motor (program)

Reconnected the LCD and Battery, turned on and setup the 52v parameters.

Still no luck, same deal as yesterday... LCD shows voltage, and accurate speed, but no power.
If I understand correctlty you're able to program the display and controller without issues? Try reading the option bytes tab for the controller? I had an issue with the option bytes (corrupted) once.

casainho   100 MW

100 MW
Posts: 2753
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Oct 15 2018 5:38am

kortina wrote:
Oct 15 2018 4:31am
Reconnected the LCD and Battery, turned on and setup the 52v parameters.

Still no luck, same deal as yesterday... LCD shows voltage, and accurate speed, but no power.
What you mean by no power? For motor to start, you need to use throttle or apply force on pedal for the torque sensor -- maybe some of this parts are failing on your hardware??
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.

kortina   10 mW

10 mW
Posts: 29
Joined: Feb 19 2017 9:24pm

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

Post by kortina » Oct 15 2018 6:05am

casainho wrote:
Oct 15 2018 5:38am
kortina wrote:
Oct 15 2018 4:31am
Reconnected the LCD and Battery, turned on and setup the 52v parameters.

Still no luck, same deal as yesterday... LCD shows voltage, and accurate speed, but no power.
What you mean by no power? For motor to start, you need to use throttle or apply force on pedal for the torque sensor -- maybe some of this parts are failing on your hardware??
No throttle attached. I have taken it for a test ride and applied plenty of torque.
I also used menu 9 to read out the Torque Sensor values, and I can see these move as I apply force.
Strangely 9,0 (ADC Throttle) was jumping between 8 and 9. Is this normal?

How do I clear the options bytes tab?

casainho   100 MW

100 MW
Posts: 2753
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Oct 15 2018 6:15am

kortina wrote:
Oct 15 2018 6:05am
casainho wrote:
Oct 15 2018 5:38am
kortina wrote:
Oct 15 2018 4:31am
Reconnected the LCD and Battery, turned on and setup the 52v parameters.

Still no luck, same deal as yesterday... LCD shows voltage, and accurate speed, but no power.
What you mean by no power? For motor to start, you need to use throttle or apply force on pedal for the torque sensor -- maybe some of this parts are failing on your hardware??
No throttle attached. I have taken it for a test ride and applied plenty of torque.
I also used menu 9 to read out the Torque Sensor values, and I can see these move as I apply force.
Strangely 9,0 (ADC Throttle) was jumping between 8 and 9. Is this normal?

How do I clear the options bytes tab?
Please look at duty-cycle value on menu 9, while you apply torque and report.

Also verify/read the option bytes and make sure they are correct with PWM enable.
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.

vscope   100 mW

100 mW
Posts: 39
Joined: Jun 19 2018 5:42am

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

Post by vscope » Oct 15 2018 7:26am

Hi guys,

i think i found the right thread ;)

i restructured (cleaned) the ebike_control_motor today.
added the safety feature logic at the end.

it compiles but i didnt have to time to test (still in the office)
code is here:
http://www.vscope.at/tsdz2/ebike_app.c
maybe someone wants to look over it an merge it?

cu
vscope

casainho   100 MW

100 MW
Posts: 2753
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Oct 15 2018 8:24am

jbalat wrote:
Oct 14 2018 5:50pm
Casainho, I got to 78degrees on a casual ride home, it's 26 degrees outside. I had just finished coming up a hill. Btw the display was not flashing ??? should it be ???
You should remember that previous code would flash as soon you hit the min limit temperature value and that also indicates it starts to reduce motor/battery current. You can quick test again, you just need to lower limit temperature value to your lower current temperature value.

As we can see, it is easy to get the motor at very high temperatures (inside the motor should be even hot!). I think that looking at your and my values, motor temperature sensor is a must.
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.

casainho   100 MW

100 MW
Posts: 2753
Joined: Feb 14 2011 2:43pm

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

Post by casainho » Oct 15 2018 8:29am

EndlessCadence wrote:
Oct 14 2018 10:46am
Btw, do you have time to review this PR? https://github.com/OpenSource-EBike-fir ... ke/pull/16
I've created a preprocessor switch/macro to choose between throttle and non-throttle version of the firmware. Release script builds both and the hexfiles (0.14.1) are included as well.
The code seems ok to me, and I like it lie being more modular.

Code: Select all

apply_throttle (ui8_throttle, &ui8_startup_enable, &ui8_adc_battery_target_current);

static void apply_throttle (uint8_t ui8_throttle_value, uint8_t *ui8_motor_enable, uint8_t *ui8_target_current)	#if THROTTLE
{
I suggest you to keep the right variable names. You pass the address of ui8_adc_battery_target_current but inside you call it ui8_target_current. On the firmware, there are moments were current is used in amps and others where current is ADC steps. The right name should help to read correctly the code and avoid mistakes.
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.

Post Reply