TSDZ2 mid drive with 860C, 850C or SW102 displays only -- Flexible OpenSource firmware (Casainho code only)

EndlessCadence said:
Hi Dirk, compiling the code isn't hard at all. I've made some fixes in the makefile for compiling on Windows, those changes are already in the latest master branch of the project.

1. Install SDCC (https://sourceforge.net/projects/sdcc/files/sdcc-win64/3.6.0/). Make sure to add it to your PATH (option in one of the last screens of the installer... )
2. Git clone the project or download zip file: https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware (make sure to get the master branch)
3. Use any text editor to make the desired firmware changes. Also take note of the motor type you're using (36v/48v).
4. Double-click Start_Compiling.bat to compile the firmware. The resulting main.ihx can be programmed in the controller.
Done but as for development page, because regular users don't need to follow this steps.
 
casainho said:
I don't know the max value, I think it may depend. Please take note of min value at 0 force as also max value.

I wounder if the different TSDZ2 rotation on bicycle frame for every user will make an expressive difference...

I hope I understand you right :)
The human power is always the produt from torque and angular speed:
P = M *(2*Pi*n)
P in Watt
M in Nm
n in rounds per second

the
Regards

Dirk
 
EndlessCadence said:
I don't know which code is yours or others and what can be modified and what not.

It's all open source, just feel free to do what ever you want with the code :wink:
But as casainho is no windows user, he won't care about windows issues when accepting pull requests ... :)

regards
stancecoke
 
casainho said:
I would make instead: ui16_temp = (ui16_temp * ui_pas_cadence_rpm) / 70;

I just tried that and woohoo !!
but unfortunately it only got to 90 cadence and I was hitting the max duty cycle of 254 which ended all my fun :(

I changed it to this which is not as much fun but you can feel some improvement
Code:
//JB
  if (ui8_pas_cadence_rpm > 70)
  {
    ui16_temp = (ui16_temp + (0.4 * (ui8_pas_cadence_rpm - 70)));
  }
 
casainho said:
EndlessCadence said:
Hi Dirk, compiling the code isn't hard at all. I've made some fixes in the makefile for compiling on Windows, those changes are already in the latest master branch of the project.

1. Install SDCC (https://sourceforge.net/projects/sdcc/files/sdcc-win64/3.6.0/). Make sure to add it to your PATH (option in one of the last screens of the installer... )
2. Git clone the project or download zip file: https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware (make sure to get the master branch)
3. Use any text editor to make the desired firmware changes. Also take note of the motor type you're using (36v/48v).
4. Double-click Start_Compiling.bat to compile the firmware. The resulting main.ihx can be programmed in the controller.
Done but as for development page, because regular users don't need to follow this steps.
Some ninor corrections:

you need version 2.7 (as snapshot)
https://sourceforge.net/projects/sdcc/files/snapshot_builds/x86_64-w64-mingw32-setup/
You may need the ST Developement Tools ? You can get it from ST
http://www.st.com/en/development-tools/stvd-stm8.html
Then it was possible to compile, I changed in the Config.h ( for support levels) and in the motor.c

Thanks to all for helping!
In which menue can I set the motor voltage now?

Regards

Dirk
 
Check the Wiki !!
https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/TSDZ2-and-KT-LCD3-advanced-features-with-Flexible-OpenSource-firmwares
 
stancecoke said:
EndlessCadence said:
I don't know which code is yours or others and what can be modified and what not.

It's all open source, just feel free to do what ever you want with the code :wink:
But as casainho is no windows user, he won't care about windows issues when accepting pull requests ... :)

regards
stancecoke
Thanks! I just to try to respect everyone, their code too :D
I'm a Windows user so I'll keep an eye on casainho :p
 
I installed 3.7.2 which was the latest on the list
When I use the new Windows Makefile I get all sorts of errors in eeprom.c so I had to use the old Makefile...
 
Are you sure you've got the latest master branch of the firmware? I've had no major issues compiling this with 3.7.2 except the following warnings:
- make: Interrupt/Exception caught (code = 0xc00000fd, addr = 0x4227d3) -> this one seems to be specific to sdcc 3.7.2??
- ebike_app.c:351: warning 116: left shifting more than size of object changed to zero
- main.c:122: warning 126: unreachable code

I also get a main.ihx (programmable hex file) at the end. You shouldn't experience any eeprom.c issues!

We should fix the warnings in the code soon.
 
casainho said:
EndlessCadence said:
Hi casainho, I've quickly flashed both your 0.4 hex files. Configuration using LCD3 was easy but motor somehow isn't running great with this software. Display shows a constantly varying speed and there is no way I can get it right with repositioning the speed sensor. The speed sensor hasn't been changed during the update. Do you have any idea what could be wrong? The motor also feels a bit rough now but that can be caused by the varying speed sensor. I've also noticed that the PAS max cadence was 0 by default (on the display).
I just tested again and found that issue with the wheel speed. And found that I did a small mistake. As for motor, my seems to run just fine!! Can you test to flash again the firmware and make sure you configured correctly the parameter for 36/48V motor?? (that was the only thing I changed about the motor).
About the PAS max cadence, I just verified (after erase the EEPROM) and I got as default value 110 as expected.

Maybe you need to erase your EEPROM before flashing....

I just uploaded the V0.5 with the corrections for wheel speed.
Unfortunately hex file version 0.5 didn't fix it for me. Just did a quick test. Still the same issue, speed sensor is all over the place and motor assistance feels a bit rough and the motor even makes some slight noises. What was the fix actually? I don't see any real code changes in your latests commits, only updated hex file. Erasing the data memory wasn't easy as it's directly overwritten by the software I suppose. I think this also differs from the previous versions?

I tried both configurations 36v and 48v but can't find any real difference, but again the bike doesn't feel right at all and assistance is wonky so I can't compare really.

Maybe I just go back to the previous version of the firmware, but programming the LCD3 again is a major pain :(
 
EndlessCadence said:
Maybe I just go back to the previous version of the firmware, but programming the LCD3 again is a major pain :(
Leave the programming header connected on LCD3. Yes, try the version that was working until we figure out what is happening to you.
 
EndlessCadence said:
I tried both configurations 36v and 48v but can't find any real difference, but again the bike doesn't feel right at all and assistance is wonky so I can't compare really.
I am developing further and I am getting what say, using pedals I just get assistance at startup but motor works well using throttle.

Also speed is not working correctly, seems that just first 8 bits - 25.5km/h is working and after that restarts from 0.

I need to fix this, maybe tomorrow.
 
casainho said:
EndlessCadence said:
I tried both configurations 36v and 48v but can't find any real difference, but again the bike doesn't feel right at all and assistance is wonky so I can't compare really.
I am developing further and I am getting what say, using pedals I just get assistance at startup but motor works well using throttle.

Also speed is not working correctly, seems that just first 8 bits - 25.5km/h is working and after that restarts from 0.

I need to fix this, maybe tomorrow.
Glad you're able to reproduce the issues! Please don't rush on my account, I can wait :wink:

I used my unassisted bike for a nice ride tonight which worked perfect but was a bit sweaty :D
 
casainho said:
I am developing further and I am getting what say, using pedals I just get assistance at startup but motor works well using throttle.
Also speed is not working correctly, seems that just first 8 bits - 25.5km/h is working and after that restarts from 0.
I need to fix this, maybe tomorrow.

Guys,
is it worth creating a 'BETA' branch for anything that needs testing and move it to the master after its tested ?
 
Hi,
I flashed V05 yesterday with the changes in config.h and did a 5 km test ride

The motor was working well and smooth , nothing to complain from my side except of the speed issue.

Code:
// you can tune LCD assist level

#define ASSIST_LEVEL_0      0.0
#define ASSIST_LEVEL_1      0.4
#define ASSIST_LEVEL_2      0.8
#define ASSIST_LEVEL_3      1.5
#define ASSIST_LEVEL_4      3.0
#define ASSIST_LEVEL_5      6.0

This firts much better for me, because when using the bike going to work I need 70 km 380 wh range. So I cannot spend more than 120 w at around 25 km/h and the rest I need to pedal. Thats why the 25 km/h is limiter needed by me !

Regards

Dirk
 
Hi,

I tried the new opensource firmware the 0.5 version, and it's awesome much more efficient, stronger and the cadence is around 90-95 rpm with a 48V motor and battery, and stock settings. Thanks casainho to made this, with the new firmware it's feel like I have a new motor. Can you help me with the light control implementation, this feature is really important to me because my lights are already wired to the tsdz2 speed sensor. Unfortunately I can't code but I can test it, I saw there is a branch called lights is it possible that if I flash the firmware from that branch the lights are already working? And I found a strange issue, if I set in the configuration screen under 2: battery state of charge in watts/hour and change the following two settings to one, after I switch off the screen all setting is resetting to the default.
0: enable/disable show of battery state of charge in percentage
1: battery state of charge increment or decrement
I don't now this is only occur at me me or it's a bug.
 
Dirko you don’t need the speed limiter. Just set power to 150w and it won’t use more than that. Use the middle button and top button together :)
 
jbalat said:
Dirko you don’t need the speed limiter. Just set power to 150w and it won’t use more than that. Use the middle button and top button together :)

Maybe I did not discribe the need good enough:
When I limit the engine to 150 w
then I need to adjust this with every hill (up and down). This is not nice to drive.
Upwards I need more Power; downwards less. But overall it is about 100 -150W
Is it possible to take the funktion from the KT Controller firmware, which I hope has the same root?

Best Regards

Dirk
 
Hi everyone, I've started with implementing the speed limiter because I need it myself as well. I would like to invite everyone to deliver some input for this functionality at: https://github.com/OpenSource-EBike-firmware/TongSheng_TSDZ2_motor_controller_firmware/issues/14
 
EndlessCadence said:
Hi everyone, I've started with implementing the speed limiter because I need it myself as well.

It's already working in the kunteng firmware, you can just copy-paste the function CheckSpeed from the update_setpoint.c

regards
stancecoke
 
stancecoke said:
EndlessCadence said:
Hi everyone, I've started with implementing the speed limiter because I need it myself as well.

It's already working in the kunteng firmware, you can just copy-paste the function CheckSpeed from the update_setpoint.c

regards
stancecoke
Thanks! I've implemented it already and will test it tonight. My solution is heavily inspired by Dirkro because I think it behaves like many commercial ebikes and could work quite well:

Dirkro said:
all in km/h , it is a (hopefuly) similar to the behavior of Bosch & Yamaha :
The factor is 0.5km/h under "speedlimit" and goes down to 0 linear until two km/h over the speed limit. Then the factor is =0

...
 
EndlessCadence said:
Thanks! I've implemented it already and will test it tonight. My solution is heavily inspired by Dirkro because I think it behaves like many commercial ebikes and could work quite well:

Dirkro said:
all in km/h , it is a (hopefuly) similar to the behavior of Bosch & Yamaha :
The factor is 0.5km/h under "speedlimit" and goes down to 0 linear until two km/h over the speed limit. Then the factor is =0

...

Yes, that's exactly the way it works in the kunteng firmware :wink: I'm looking forward to see how you solved it!

regards
stancecoke
 
stancecoke said:
EndlessCadence said:
Thanks! I've implemented it already and will test it tonight. My solution is heavily inspired by Dirkro because I think it behaves like many commercial ebikes and could work quite well:

Dirkro said:
all in km/h , it is a (hopefuly) similar to the behavior of Bosch & Yamaha :
The factor is 0.5km/h under "speedlimit" and goes down to 0 linear until two km/h over the speed limit. Then the factor is =0

...

Yes, that's exactly the way it works in the kunteng firmware :wink:

regards
stancecoke
Fantastic! I didn't know beforehand but yes it looks the same :D
 
Back
Top