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

What is the exact software you are using?
Plz go to help, about and copy some of the details.

I have a hunch that the link on the wiki to the software is incorrect. I followed details from jbalat on youtube.
 
I ended up installing "ST Visual Programmer 3.4.1"
Installed this from "sttoolset_pack_42.exe" which was inside the zip "en.stvp-stm32.zip"

This came from: https://www.st.com/en/development-tools/stvp-stm32.html

This looks like the tool in the youtube videos.

The wiki page:https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-flash-the-Flexible-OpenSource-firmware-on-KT-LCD3

takes you here: http://www.st.com/content/st_com/en/products/development-tools/software-development-tools/stm32-software-development-tools/stm32-programmers/stsw-link004.html

To get STM32 ST-Link Utility v4.2.0.0
 
kortina said:
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:
> 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.
 
Thankfully I managed to figure it out - the pins connecting the wires to the LCD3 were slotted in but I thought why not press down on them and thankfully that resolved the issue! Step one sorted :D
 
jbalat said:
No worries, btw very dissapointed you still haven’t increased the cadence. I was out doing some mountain biking yesterday on the way home from work and I had to take a run up to get up the hill and noticed the motor did not want to do anything above 95 cadence... if you like I can do those changes for you fairly quickly, now that I’m committed to the temperature sensor I want to get the firmware to a level I’m happy with... sorry I’m selfish that way ;)
I still have to try your settings (can't find them right now...) but I'm afraid to somehow destroy my motor :p
I think we should an experimental motor configuration option to configuration menu 8.0, now there are just two options 36v or 48v battery but we can add a "36v high cadence (experimental)". I'm using a 36v motor as well and I can test this too.
 
Casainho, I've read somewhere that you're using the LM35DZ sensor. Can you explain why?
I see that this type has a range of 0-100 degrees celsius and for instance the LM35A has a range of -55-150 celsius.

@jbalat, which type are you using?

I want to order and install a temperature as well.
 
:!: 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):
https://github.com/OpenSource-EBike-firmware/TSDZ2-Smart-EBike/releases/tag/v0.14.0

I've removed the latest beta releases and I suggest you to upgrade to this version.

I've also updated the documentation, if you find any issues in the documentation please let me know!

I think this version will be a good foundation to further improve the firmware and build new features on.
 
EndlessCadence said:
jbalat said:
No worries, btw very dissapointed you still haven’t increased the cadence. I was out doing some mountain biking yesterday on the way home from work and I had to take a run up to get up the hill and noticed the motor did not want to do anything above 95 cadence... if you like I can do those changes for you fairly quickly, now that I’m committed to the temperature sensor I want to get the firmware to a level I’m happy with... sorry I’m selfish that way ;)
I still have to try your settings (can't find them right now...) but I'm afraid to somehow destroy my motor :p
I think we should an experimental motor configuration option to configuration menu 8.0, now there are just two options 36v or 48v battery but we can add a "36v high cadence (experimental)". I'm using a 36v motor as well and I can test this too.

I think you are using a 48V battery and jbalat is using a 36V battery.

In this forum people says higher battery voltage allows higher cadence.

Maybe you must be aware of this in your tests with Jbalat´s V0.3 version.

Regards
 
AZUR said:
I think you are using a 48V battery and jbalat is using a 36V battery.

In this forum people says higher battery voltage allows higher cadence.

Maybe you must be aware of this in your tests with Jbalat´s V0.3 version.

Regards
Thanks, I did now that ;) I agree with jbalat that the cadence is a bit limited (around 95 RPM?) even on 48v battery, is there even a difference right now? But I also think that this limited cadence isn't noticable for everyone. I'm a road cyclist (unassisted) normally and very used to higher speeds and high cadences (+100 RPM). I think jbalat is a sporty cyclist (trails?) as well :D

@jbalat
Can you create a Github issue with your custom FOC settings? Then I'm happy to create the experimental motor profile for you :D
 
EndlessCadence said:
Casainho, I've read somewhere that you're using the LM35DZ sensor. Can you explain why?
I see that this type has a range of 0-100 degrees celsius and for instance the LM35A has a range of -55-150 celsius.
Hmmm, for some reason I thought the DZ version could measure higher temperate. Anyway, I hope to never got my motor to 100 degrees.
 
EndlessCadence said:
:!: 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.

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:

30-9.png


Here are the instructions I wrote for being able to JTAG debug: https://opensourceebikefirmware.bitbucket.io/development/Development_tools--Linux--Step-by-step_tutorial_development_tools--(optional)_Tools_to_debug_the_firmware.html

Also the advantage is that it works just the same/is the same software tools to debug STM32, as you can see I just flashed and debug the very first code on Bafang Color LCD that has an STM32F103 (a clone version of that STM32):

casainho said:
I connected the STLinkV2 clone to Bafang LCD 850C and I was able to flash and debug (run step by step and add breakpoints) a test firmware that toggles a pin. Here is the debug session on Eclipse:


And the pin signal on oscilloscope:


I am sharing the firmware here: https://github.com/OpenSource-EBike-firmware/Color_LCD/tree/master/Bafang_LCD_850C_firmware

And technical notes about the LCD: https://github.com/OpenSource-EBike-firmware/Color_LCD/wiki/Bafang-850C

As now I have all the wiring from the microcontroller to LCD, next step is try to initialize and write to LCD. The issue is that I don't know which LCD driver it uses... but I guess it is something popular, something that uses 16 data lines + some control lines.

 
EndlessCadence said:
AZUR said:
I think you are using a 48V battery and jbalat is using a 36V battery.

In this forum people says higher battery voltage allows higher cadence.

Maybe you must be aware of this in your tests with Jbalat´s V0.3 version.

Regards
Thanks, I did now that ;) I agree with jbalat that the cadence is a bit limited (around 95 RPM?) even on 48v battery, is there even a difference right now? But I also think that this limited cadence isn't noticable for everyone. I'm a road cyclist (unassisted) normally and very used to higher speeds and high cadences (+100 RPM). I think jbalat is a sporty cyclist (trails?) as well :D

@jbalat
Can you create a Github issue with your custom FOC settings? Then I'm happy to create the experimental motor profile for you :D
EC, as you know, If you test with the battery not fully charged (about 40V) you get the same voltage we get with the 36V battery fully charged (10x4,2=42). Our range is between 29V and 42V.

Regards
 
EC you seriously are not scared you will blow your motor up with my version?, I have probably done almost 1000kms with that version and I have also tested it with 14s up to 128 cadence. I know Casainho says it’s probably not efficient but it’s exactly the same in real life testing just that the motor keeps helping you in the higher rpm whenever you need it. Ideally we want the FOC to ramp linearly from 80 at low rpm to 130 at high rpm/erps this should be a piece of cake to program in.

If your FOC is to high the motor simply loses timing and then you need to change gears. I don’t think it will cause any damage, I got the best value by many tests so this shouldn’t happen.

All the performance ebikes go to 120 now with almost full torque, reviews are brutal and people will stop buying bikes that won’t keep up with the trends.
I just wanted you to give it a quick try so you can compare, that’s all. It gives you a comforting sense of freedom.

Anyway I will look at the latest source and make my changes and see if it compiles. If it works then maybe you can add it as an option.
:shock:

Will be riding Offroad today but won’t get a chance to try the new firmware till tomorrow. Using version 12 to test the temp sensor. Yes I’m also using the DZ version.
 
jbalat said:
EC you seriously are not scared you will blow your motor up with my version?, I have probably done almost 1000kms with that version and I have also tested it with 14s up to 128 cadence. I know Casainho says it’s probably not efficient but it’s exactly the same in real life testing just that the motor keeps helping you in the higher rpm whenever you need it. Ideally we want the FOC to ramp linearly from 80 at low rpm to 130 at high rpm/erps this should be a piece of cake to program in.

If your FOC is to high the motor simply loses timing and then you need to change gears. I don’t think it will cause any damage, I got the best value by many tests so this shouldn’t happen.

All the performance ebikes go to 120 now with almost full torque, reviews are brutal and people will stop buying bikes that won’t keep up with the trends.
I just wanted you to give it a quick try so you can compare, that’s all. It gives you a comforting sense of freedom.

Anyway I will look at the latest source and make my changes and see if it compiles. If it works then maybe you can add it as an option.
:shock:

Will be riding Offroad today but won’t get a chance to try the new firmware till tomorrow. Using version 12 to test the temp sensor. Yes I’m also using the DZ version.
I was just kidding hehe :D
But I need to know which values you've changed exactly. There is this section in the code:

Code:
  // ---------------------------------------------------------------------------------------------------------------------
  // NOTE: EXPERIMENTAL and may not be good for the brushless motor inside TSDZ2
  // Original message from jbalat on 28.08.2018, about increasing the limits on 36V motor -- please see that this seems to go over the recomended values
  // The ui32_l_x1048576 = 105 is working well so give that a try if you have a 36v motor.
  // This is the minimum value that gives me 550w of power when I have asked for 550w at level 5 assist, >36km/hr
  //
  //  remember also to boost the max overdrive erps in main.h to get higher cadence
  // #define MOTOR_OVER_SPEED_ERPS 700 // motor max speed, protection max value | 30 points for the sinewave at max speed
  // ---------------------------------------------------------------------------------------------------------------------

Still valid?
 
I think I am back up to 125 again, as well as the max erps there may also be a max cadence value set somewhere which I also bumped up. So yeah not too many changes

Just been thinking seriously about the temperature sensor installation and the potental for it to cause serious injury or...

For instance if the code sees the signal as a throttle signal as your motor starts heating up then it will lead to an out of control bike.

For this reason I can never use my old code again.

I’m even wondering whether it is worth making standalone No throttle version just in case. Either way this case should be considered with great care when implementing any new features or doing any changes in future.
 
jbalat said:
I think I am back up to 125 again, as well as the max erps there may also be a max cadence value set somewhere which I also bumped up. So yeah not too many changes

Just been thinking seriously about the temperature sensor installation and the potental for it to cause serious injury or...

For instance if the code sees the signal as a throttle signal as your motor starts heating up then it will lead to an out of control bike.

For this reason I can never use my old code again.

I’m even wondering whether it is worth making standalone No throttle version just in case. Either way this case should be considered with great care when implementing any new features or doing any changes in future.
You are right!! Probably it is safe to make a specific version of firmware. Still, it is always possible that user flash the wrong firmware version... -- well, but it is safe then what is now enable/disable temp sensor on LCD3, it is to easy/flexible :)
 
Well I hope version 12 and the new version 14 will be safe. I will let you know tonight about version 12 ha ha wish me luck and safe journey ;)

If I set assist level to zero with full throttle will that cut my power ?
 
EC do you know if the level assist zero will kill all power if throttle is on ?

Ps. Discuss options with Casainho before you decide on a path forward
 
jbalat said:
EC do you know if the level assist zero will kill all power if throttle is on ?

Ps. Discuss options with Casainho before you decide on a path forward
1. Looking at the code I think it doesn't unfortunately. And you don't have ebrakes if I remember correctly...
2. Of course I do but from a safety point of view I think this very important (and easy to do). I didn't look into the temperature readout and limit code yet but didn't casainho already test this?
 
EndlessCadence said:
1. Looking at the code I think it doesn't unfortunately.

Well there is your first safety feature ;)

No I don’t believe in ebrakes for torque assist bikes, none of the big brands are doing this, the fact they even introduced throttle is very disappointing too, if people are choosing throttle option they should have chosen a pas or hub motor.
 
EndlessCadence said:
jbalat said:
EC do you know if the level assist zero will kill all power if throttle is on ?

Ps. Discuss options with Casainho before you decide on a path forward
1. Looking at the code I think it doesn't unfortunately.
2. Of course I do but from a safety point of view I think this very important (and easy to do). I didn't look into the temperature readout and limit code yet but didn't casainho already test this?
This feature of sensor temp reading and motor current reducing due to high temperature works.

The only thing is that user, on LCD3, can disable temp sensor and then firmware will consider throttle signal as a real throttle while it is the temperature sensor......... DANGER
 
jbalat said:
EndlessCadence said:
1. Looking at the code I think it doesn't unfortunately.

Well there is your first safety feature ;)

No I don’t believe in ebrakes for torque assist bikes, none of the big brands are doing this, the fact they even introduced throttle is very disappointing too, if people are choosing throttle option they should have chosen a pas or hub motor.
I fully agree with you. I would advice to not use the temperature sensor for now. I examined the code and I think it will definitely act as throttle :shock:

As said, I'll release a non throttle version tomorrow. Will be a separate hex file with a preprocessor macro in the code to make sure that throttle isn't included at all.

Edit: thanks casainho, glad that it could work for now. I assume you agree with the idea of a separate hex file? :wink:
 
EndlessCadence said:
Edit: thanks casainho, glad that it could work for now. I assume you agree with the idea of a separate hex file? :wink:
Yes I agree.
 
Back
Top