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

I just released the very first working version for Bafang 850C LCD -- follow the guide on wiki to know how to wire to TSDZ2 motor and download and flash the firmware: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-install-the-Flexible-OpenSource-firmware

Note that black vertical lines are due to the mobile camera recording frequency.
2019-07-12-11-53-48-1.jpg
 
Hi everyone

I just bought this motor and I’m waiting for the delivery, I wanna flash the FOS firmware.

Is it possible to flash it using the Kt-lcd5 instead of the kt-lcd3? I think I read about this in this thread before, but I’m not totally sure.
 
casainho said:
I just released the very first working version for Bafang 850C LCD -- follow the guide on wiki to know how to wire to TSDZ2 motor and download and flash the firmware: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-install-the-Flexible-OpenSource-firmware

YEEEEEEAH! I'm ordering an 850C ASAP :D

Thank you for everything, Casainho! You're unstoppable! :bigthumb:
 
Hello,
Thank you so much for all the work.
I wanted to flash the display.
I deactivated the protection but I got an error when importing the firmware.

Fehler.jpg

Under Ubuntu 18.04.2 LTS it works for me

Linux_ok.jpg

Erstes_Bild.jpg
 
Re-post from the TSDZ2 topic:

What function is the ui8_svm_table array supposed to describe?
From my reading on FOC control, I suspect it should have been a sine wave, but it's quite distinctively different.
I've attached a plot of this array to this post.

I've also extracted the relevant code in motor.c calculating the phase PWM outputs, and plotted it for the angles [0-256], and attached it to this post to. I was expecting it to look like 3 sine waves as in the third picture on http://www.wecanie.com/html/support/knowledge/Field_Oriented_Control_FOC.html.

Am I missing something somewhere ?
 

Attachments

  • FOC_Output.png
    FOC_Output.png
    15.8 KB · Views: 1,623
  • SVM_Table.png
    SVM_Table.png
    8.5 KB · Views: 1,623
Frans-willem said:
Re-post from the TSDZ2 topic:

What function is the ui8_svm_table array supposed to describe?
From my reading on FOC control, I suspect it should have been a sine wave, but it's quite distinctively different.
I've attached a plot of this array to this post.

I've also extracted the relevant code in motor.c calculating the phase PWM outputs, and plotted it for the angles [0-256], and attached it to this post to. I was expecting it to look like 3 sine waves as in the third picture on http://www.wecanie.com/html/support/knowledge/Field_Oriented_Control_FOC.html.

Am I missing something somewhere ?
SVM stands for space vector modulation, that is also mentioned on the link you shared.
 
casainho said:
Frans-willem said:
Re-post from the TSDZ2 topic:

What function is the ui8_svm_table array supposed to describe?
From my reading on FOC control, I suspect it should have been a sine wave, but it's quite distinctively different.
I've attached a plot of this array to this post.

I've also extracted the relevant code in motor.c calculating the phase PWM outputs, and plotted it for the angles [0-256], and attached it to this post to. I was expecting it to look like 3 sine waves as in the third picture on http://www.wecanie.com/html/support/knowledge/Field_Oriented_Control_FOC.html.

Am I missing something somewhere ?
SVM stands for space vector modulation, that is also mentioned on the link you shared.

Thanks! I only see SVPWM in the final graphic, and nothing in the text. Hadn't considered SVPWM and SVM to be the same thing, but having googled the term, the plots make a lot more sense!

I'm trying to comb through the code to understand it better before attempting to contribute anything, is it OK if I ask questions like these in this topic every now and then, or could I better send them directly to you over PM/Mail instead ?
 
Frans-willem said:
is it OK if I ask questions like these in this topic every now and then, or could I better send them directly to you over PM/Mail instead ?
Here so others can learn. I also suggest you first to search on Google to find information from this thread.
 
After some time with new version of firmware, it looks like the "no power" issue is still there, but not as pronounced as before.

I think I figured out the way to reproduce it, although not every time.

On red light, with brakes with sensors on and sitting on the bike with feet on the pedals. When I start, there is no power for few seconds and display is slowing 0 watts. With older version of firmware this was more frequent and it was taking more time.
 
casainho said:
... I also suggest you first to search on Google to find information from this thread.
Absolutely will! Just needed some help on which terms to google for. SVM didn't give me any clues, but SVPWM gave me exactly the papers I needed ;)
 
Frans-willem said:
casainho said:
... I also suggest you first to search on Google to find information from this thread.
Absolutely will! Just needed some help on which terms to google for. SVM didn't give me any clues, but SVPWM gave me exactly the papers I needed ;)
I guess comments on the code would work well for you and others alike.
 
hefest said:
After some time with new version of firmware, it looks like the "no power" issue is still there, but not as pronounced as before.

I think I figured out the way to reproduce it, although not every time.

On red light, with brakes with sensors on and sitting on the bike with feet on the pedals. When I start, there is no power for few seconds and display is slowing 0 watts. With older version of firmware this was more frequent and it was taking more time.
That happens to me just like you describe, in v0.19.0.
 
casainho said:
hefest said:
After some time with new version of firmware, it looks like the "no power" issue is still there, but not as pronounced as before.

I think I figured out the way to reproduce it, although not every time.

On red light, with brakes with sensors on and sitting on the bike with feet on the pedals. When I start, there is no power for few seconds and display is slowing 0 watts. With older version of firmware this was more frequent and it was taking more time.
That happens to me just like you describe, in v0.19.0.

Are you guys using Startup Boost? Does it happen with it off?

Have no power issue in the 0.20.0 development but am not using Startup Boost either. Did experience some slow starts in the 0.19.0 though.
 
buba said:
casainho said:
hefest said:
After some time with new version of firmware, it looks like the "no power" issue is still there, but not as pronounced as before.

I think I figured out the way to reproduce it, although not every time.

On red light, with brakes with sensors on and sitting on the bike with feet on the pedals. When I start, there is no power for few seconds and display is slowing 0 watts. With older version of firmware this was more frequent and it was taking more time.
That happens to me just like you describe, in v0.19.0.

Are you guys using Startup Boost? Does it happen with it off?

Have no power issue in the 0.20.0 development but am not using Startup Boost either. Did experience some slow starts in the 0.19.0 though.
I was not using Startup Boost when I got that issue.
 
buba said:
casainho said:
hefest said:
After some time with new version of firmware, it looks like the "no power" issue is still there, but not as pronounced as before.

I think I figured out the way to reproduce it, although not every time.

On red light, with brakes with sensors on and sitting on the bike with feet on the pedals. When I start, there is no power for few seconds and display is slowing 0 watts. With older version of firmware this was more frequent and it was taking more time.
That happens to me just like you describe, in v0.19.0.

Are you guys using Startup Boost? Does it happen with it off?

Have no power issue in the 0.20.0 development but am not using Startup Boost either. Did experience some slow starts in the 0.19.0 though.

I'm using startup boost yes. Will try with boost off once the weather allows.
 
buba said:
fi7ippo said:
I think the best way to adapt the torque sensor to the various users is:

1- Read the rest value of ADC steps during power on and add a low pass filter of one or two ADC steps (for resting value);
2- Create a user parameter that set the ADC value for a know Force applied maybe 30Kg could be a good value for a well calibrated sensor;

Thats all doing this we have everything we need to perfectly calibrate each unit!

1. Already fixed in the new firmware.
2. Nothing to add to your suggestion, will do!

Hi Buba I saw the 0.20.0 wiki, wonderful, You have make a epic job :bigthumb:

Is it safe to compile and test? I read a bit the code and maybe I don't understand well, but on

src/controller/adc.c says

64 // read ADC torque sensor value
65 uint16_t ui16_temp = UI16_ADC_10_BIT_TORQUE_SENSOR;
66
67 // filter the ADC torque sensor value and set to offset variable
68 ui16_filter(&ui16_temp, &ui16_adc_pedal_torque_offset, 9);

what is ui16_temp ?

I've not yet understand what is the difference in the new 4 type motor logic, (torque - pas - cadence - emtb) but I'll try when a beta will available

On the new wiki there is a new parameter scale on menu (9 Motor Controller Setup)

2 Motor acceleration 70%

What scale have the new parameter 2 Motor acceleration? Maybe 100% for 10A/s rump up or what?

Option 3 Pedal torque conversion factor - and 4 Weight on pedal is perfect, wow, wonderful work :thumb: :thumb:

I had some time to swap the torque sensor with a brand new untouched new one, and I can say that the new sensor have a lower range, rest 31-32 maximum about 74 and lower capacity (about 40kg) but I'll post a complete data in a few days!

Among other things I forgot to install the white Teflon thickness before the torque sensor, and I would not damage the sensor windings, so I will have to disassemble it again.
I have also noticed that without this thickness inside it all seems smoother than before when a rubbing noise was heard, I think I will try it without thickness for about fifty km.

Torque thickness.jpg




Thank You Buba, have a nice day!
 
casainho said:
I just released the very first working version for Bafang 850C LCD -- follow the guide on wiki to know how to wire to TSDZ2 motor and download and flash the firmware: https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/How-to-install-the-Flexible-OpenSource-firmware

Note that black vertical lines are due to the mobile camera recording frequency.
2019-07-12-11-53-48-1.jpg

I have flashed my Bafang 850C screen successfully and compared the data on the screen with the firmware bin file so i am 100% its correct. however i cannot get it to power up at all, it's been blank ever since. Can I check if there is no UART to the motor would you see anything on the screen to show an error or would it remain blank?

I am wondering if i have reversed my TX/RX connections from my early experiments, but before i hack my cable i wanted to be sure what should happen if there is no coms to the motor established.

I have been using STM32 St-Link https://my.st.com/content/my_st_com...ent-tools/stm32-programmers/stsw-link004.html windows tool to flash but it all worked as expected. but maybe I have done something wrong during the flash?
STM32 st-link.PNG
 
buba said:
Popo15 said:
buba said:
Popo15 said:
Hello good afternoon Buba, finished riding an engine with Throttle, I confirm that the Throttle does not work with version v.19 beta8 I have tested with previous versions example version Throttle v0.16.0 working, thank you very much for your work.

Hello Popo15,

Have you enabled the throttle in the Configuration Menu under the Motor Controller Setup?

https://github.com/OpenSource-EBike-firmware/TSDZ2_wiki/wiki/Features-and-configurations-for-version-0.19.X#7_Motor_Controller_Setup
good morning, if enabled and it does not work, thank you very much.

Have you set the number to ”2”?

- Motor Controller Setup, Submenu 4

Set to ”2” for the Throttle funtion

(Set to ”1” for Motor Temperature function)

(Set to “0” for no optional function)

And can you check the:

- Advanced Technical Data, submenu 0

... to see if the throttle value changes?

Pop15, just to be 100% sure, I re flashed my motor and LCD3 to 0.19.0 release and ran the factory defaults. after setting motor control setup as above I can confirm the throttle works for me perfectly. Like Buba says, first test is to check if you see throttle values change under the advanced technical menu. if you don't there must be a cable fault and the motor is mot getting a throttle signal. you should see the throttle input value even if you have throttle disabled.
 
good afternoon, ok perryscope solved thanks to Buba, my configuration was wrong, thank you very much. :bigthumb:
 
Popo15 said:
good afternoon, ok perryscope solved thanks to Buba, my configuration was wrong, thank you very much. :bigthumb:

No problem, glad its all working :bigthumb:
 
fi7ippo said:
Hi Buba I saw the 0.20.0 wiki, wonderful, You have make a epic job :bigthumb:

Where is the 0.20 wiki? I'm curious to have a look at it in the meantime... :wink:
Thanks
 
perryscope said:
I have flashed my Bafang 850C screen successfully and compared the data on the screen with the firmware bin file so i am 100% its correct. however i cannot get it to power up at all, it's been blank ever since. Can I check if there is no UART to the motor would you see anything on the screen to show an error or would it remain blank?

I am wondering if i have reversed my TX/RX connections from my early experiments, but before i hack my cable i wanted to be sure what should happen if there is no coms to the motor established.

I have been using STM32 St-Link https://my.st.com/content/my_st_com...ent-tools/stm32-programmers/stsw-link004.html windows tool to flash but it all worked as expected. but maybe I have done something wrong during the flash?
STM32 st-link.PNG

It works for me with STM32 ST-LINK Utility.
Thank you very much for the hint.
The ST Visual Programmer does not accept the firmware.
 
bruwie said:
perryscope said:
I have flashed my Bafang 850C screen successfully and compared the data on the screen with the firmware bin file so i am 100% its correct. however i cannot get it to power up at all, it's been blank ever since. Can I check if there is no UART to the motor would you see anything on the screen to show an error or would it remain blank?

I am wondering if i have reversed my TX/RX connections from my early experiments, but before i hack my cable i wanted to be sure what should happen if there is no coms to the motor established.

I have been using STM32 St-Link https://my.st.com/content/my_st_com...ent-tools/stm32-programmers/stsw-link004.html windows tool to flash but it all worked as expected. but maybe I have done something wrong during the flash?
STM32 st-link.PNG

It works for me with STM32 ST-LINK Utility.
Thank you very much for the hint.
The ST Visual Programmer does not accept the firmware.

That's odd. But glad it's working for you. Would you mind uploading a screenshot of the stm32 st-link main window. Does it look like the bytes are correct for the .bin file. Also did you erase from stm32 st-link or was the screen already flashed?
 
Back
Top