TSDZ2 48v 2020 new firmware

Electric Motors and Controllers
Elinx   10 kW

10 kW
Posts: 653
Joined: Aug 09 2019 6:58am

Re: TSDZ2 48v 2020 new firmware

Post by Elinx » Jun 10 2021 2:04pm

casainho wrote:
Jun 10 2021 1:48pm
....No, pin 7 and pin 8 are not shorted. My current guess is that they assembled some MPC6021 batch units knowing they are instead MCP6022 -- I think this is possible, maybe the MPC6021 factory sold them this "special" units.
Everything is possible, but I can't imagine that the factory does this, because this would be problematic if you sell these.
It could be possible that another unknown single op-amp would fit there too.

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 10 2021 2:16pm

I just finished the notes for the shunt resistor input value, I added to pins.h file:

Image
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

abrainer   1 mW

1 mW
Posts: 18
Joined: Dec 11 2020 12:29pm

Re: TSDZ2 48v 2020 new firmware

Post by abrainer » Jun 10 2021 2:47pm

casainho wrote:
Jun 10 2021 1:05pm
So, if the opamp is really MCP6021, then pin 1 and pin 8 would be unconnected, but we see they are not... most probably the opamp is the MCP6022 and not the MPC6021, or am I missing something??
I was also puzzled by the name of this OPA. The circuit is clearly for a dual OPA (MCP6022). Perhaps they are mislabelled OPAs that could be bought cheaply.

Elinx   10 kW

10 kW
Posts: 653
Joined: Aug 09 2019 6:58am

Re: TSDZ2 48v 2020 new firmware

Post by Elinx » Jun 10 2021 4:30pm

abrainer wrote:
Jun 10 2021 2:47pm
....The circuit is clearly for a dual OPA (MCP6022). Perhaps they are mislabelled OPAs that could be bought cheaply.
That could be possible indeed, if only used for a closed market, but mostly in that case the wrong text is sanded away.

Akita   100 mW

100 mW
Posts: 46
Joined: Apr 29 2021 10:20am

Re: TSDZ2 48v 2020 new firmware

Post by Akita » Jun 11 2021 2:11am

casainho wrote:
Jun 10 2021 2:16pm
I just finished the notes for the shunt resistor input value, I added to pins.h file:

Image
Can't find your Paypal.
What's the name?

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 11 2021 4:18am

So, there are 3 dual opamps. 2 of them are the MCP6022 and one of them is the LM258. This gives a total of 6 opamps available.

I just checked the MCP6022 near the shunt resistor and I found:
1. one opamp is in the no inverting configuration with the gain of 11, measuring the shunt resistor (can only measure positive current values, just like on the V1 hardware).
2. other opamp is in the inverting configuration with the gain of -10, measuring also the shunt resistor, but has also an offset of 2.5 volts, meaning it can measure both positive and negative values.

What is strange is that I can see the other MCP6022 with gain of -10 and 2.5V offset, for sure measuring the 2 of 3 phase current resistor voltage. BUT, I also see the LM256 with gain of -10 and 2.5V offset, measuring the other 1 of 3 phase current resistor voltage.

So, why would they use two MCP6022 and a LM256 to do the same function, while they could use instead the same MCP6022 or the same LM256??

Here a picture of the circuit:
Image
Akita wrote:
Jun 11 2021 2:11am
Can't find your Paypal.
What's the name?
It is on my signature.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 11 2021 5:14am

// LM258
// opamp pins 1, 2 and 3, is configured with as a unity gain buffer, providing at output a 2.5 volts signal (probably for the offset voltage used on the other opamps measuring the phase currents)

As we can see on this LM258, pin 1 and 2 are shorted.
Pin 3 has 2.5 volts, provided by the 2 near resistors, both with same resistance and dividing by half the 5 volts:
Image
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 11 2021 5:55am

casainho wrote:
Jun 11 2021 4:18am
So, why would they use two MCP6022 and a LM256 to do the same function, while they could use instead the same MCP6022 or the same LM256??
Well, because I was wrong. LM256 as one opamp working as unity gain buffer, providing at output a 2.5 volts signal for the other opamps with a voltage offset of 2.5 volts.
The other opamp of LM256 is for amplification of the signal related to the torque sensor.

The MCP6022 seems to have like 10x more frequency bandwidth then the LM256, so yes, makes sense that MCP6022 is used for the phase currents and LM256 for the more slow signal like the torque sensor.
Last edited by casainho on Jun 11 2021 6:18am, edited 1 time in total.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 11 2021 6:12am

@abrainer, on your notes about the pins, you refer that there are inputs for measurements of shunt resistor and also to the 3 motor phases resistor, although I just find measurements to only 2 motor phase resistor:
- LM258:
1. opamp working as unity gain buffer, providing at output a 2.5 volts signal for the other opamps using a voltage offset of 2.5 volts.
2. amplification of the signal related to the torque sensor.

- MCP6022 1 (near shunt resistor):
1. shunt resistor measurement, amplification factor 10, 2.5 volts offset
2. shunt resistor measurement, amplification factor -11

- MCP6022 2:
1. yellow phase resistor measurement, amplification factor 10, 2.5 volts offset
2. blue phase resistor measurement, amplification factor 10, 2.5 volts offset

Could be a mistake of you? because if so, how could you make the motor working with such big mistake in terms of FOC currents calculation??

Image
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

abrainer   1 mW

1 mW
Posts: 18
Joined: Dec 11 2020 12:29pm

Re: TSDZ2 48v 2020 new firmware

Post by abrainer » Jun 11 2021 7:51am

casainho wrote:
Jun 11 2021 6:12am
@abrainer, on your notes about the pins, you refer that there are inputs for measurements of shunt resistor and also to the 3 motor phases resistor, although I just find measurements to only 2 motor phase resistor:
I am pretty sure that the pinout is correct, otherwise the Infineon FOC control would not work. On the top side there are 3 shunts directly at the source pins of the lower fets for the phase current measurement. The shunt for the total current measurement is on the bottom.
I remember that the trace routing for the current measurement for the green phase was difficult to find.
The FOC control runs cleanly even with the setting "Direct FOC Startup", only from the start the motor has little power, which is normal. Hall sensors are not connected. The Hall sensors are necessary for a powerful start.
The only problem with the Infineon Lib is the unsafe state at motor stop. Otherwise I would have already made tests with the bike. But this way it is too dangerous because the controller will probably not survive this state with the battery.
As I said, I know very little about motor control, but I'm trying to learn more.
I am glad that you have started the project with the new controller and try to be helpful whenever I have a little time.

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 11 2021 8:11am

abrainer wrote:
Jun 11 2021 7:51am
casainho wrote:
Jun 11 2021 6:12am
@abrainer, on your notes about the pins, you refer that there are inputs for measurements of shunt resistor and also to the 3 motor phases resistor, although I just find measurements to only 2 motor phase resistor:
I am pretty sure that the pinout is correct, otherwise the Infineon FOC control would not work. On the top side there are 3 shunts directly at the source pins of the lower fets for the phase current measurement. The shunt for the total current measurement is on the bottom.
I remember that the trace routing for the current measurement for the green phase was difficult to find.
The FOC control runs cleanly even with the setting "Direct FOC Startup", only from the start the motor has little power, which is normal. Hall sensors are not connected. The Hall sensors are necessary for a powerful start.
The only problem with the Infineon Lib is the unsafe state at motor stop. Otherwise I would have already made tests with the bike. But this way it is too dangerous because the controller will probably not survive this state with the battery.
As I said, I know very little about motor control, but I'm trying to learn more.
I am glad that you have started the project with the new controller and try to be helpful whenever I have a little time.
Yes, you are correct, my mistake to follow the track. The thing is that FOC can also be implemented with only 2 phase current sensors so I was not sure about what I was thinking.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Akita   100 mW

100 mW
Posts: 46
Joined: Apr 29 2021 10:20am

Re: TSDZ2 48v 2020 new firmware

Post by Akita » Jun 12 2021 1:14am

casainho wrote:
Jun 11 2021 4:18am
So, there are 3 dual opamps. 2 of them are the MCP6022 and one of them is the LM258. This gives a total of 6 opamps available.

I just checked the MCP6022 near the shunt resistor and I found:
1. one opamp is in the no inverting configuration with the gain of 11, measuring the shunt resistor (can only measure positive current values, just like on the V1 hardware).
2. other opamp is in the inverting configuration with the gain of -10, measuring also the shunt resistor, but has also an offset of 2.5 volts, meaning it can measure both positive and negative values.

What is strange is that I can see the other MCP6022 with gain of -10 and 2.5V offset, for sure measuring the 2 of 3 phase current resistor voltage. BUT, I also see the LM256 with gain of -10 and 2.5V offset, measuring the other 1 of 3 phase current resistor voltage.

So, why would they use two MCP6022 and a LM256 to do the same function, while they could use instead the same MCP6022 or the same LM256??

Here a picture of the circuit:
Image
Akita wrote:
Jun 11 2021 2:11am
Can't find your Paypal.
What's the name?
It is on my signature.
I have tried these names and get the answer.
We can not find paypal.me/jorgecasa. Try entering his or her mobile number or email address.
We can not find paypal.me. Try entering his or her mobile number or email address.
We can not find jorgecasa. Try entering his or her mobile number or email address.

abrainer   1 mW

1 mW
Posts: 18
Joined: Dec 11 2020 12:29pm

Re: TSDZ2 48v 2020 new firmware

Post by abrainer » Jun 12 2021 6:54am

Akita wrote:
Jun 12 2021 1:14am
I have tried these names and get the answer.
We can not find paypal.me/jorgecasa. Try entering his or her mobile number or email address.
We can not find paypal.me. Try entering his or her mobile number or email address.
We can not find jorgecasa. Try entering his or her mobile number or email address.
Just write paypal.me/jorgecasa in the address line of your browser and klick the button "send". That works. :wink:

Akita   100 mW

100 mW
Posts: 46
Joined: Apr 29 2021 10:20am

Re: TSDZ2 48v 2020 new firmware

Post by Akita » Jun 12 2021 9:41am

abrainer wrote:
Jun 12 2021 6:54am
Akita wrote:
Jun 12 2021 1:14am
I have tried these names and get the answer.
We can not find paypal.me/jorgecasa. Try entering his or her mobile number or email address.
We can not find paypal.me. Try entering his or her mobile number or email address.
We can not find jorgecasa. Try entering his or her mobile number or email address.
Just write paypal.me/jorgecasa in the address line of your browser and klick the button "send". That works. :wink:
No matter how hard I try, I will not succeed.
May ask for help from a knowledgeable Paypal user.

Beli   100 mW

100 mW
Posts: 45
Joined: Dec 07 2020 5:08pm

Re: TSDZ2 48v 2020 new firmware

Post by Beli » Jun 12 2021 4:24pm

Akita wrote:
Jun 12 2021 9:41am
No matter how hard I try, I will not succeed.
Don't understand the problem...
If you just use the given web address you get to:
https://www.paypal.com/paypalme/jorgecasa

Akita   100 mW

100 mW
Posts: 46
Joined: Apr 29 2021 10:20am

Re: TSDZ2 48v 2020 new firmware

Post by Akita » Jun 13 2021 12:59am

Beli wrote:
Jun 12 2021 4:24pm
Akita wrote:
Jun 12 2021 9:41am
No matter how hard I try, I will not succeed.
Don't understand the problem...
If you just use the given web address you get to:
https://www.paypal.com/paypalme/jorgecasa
Thanks!
Perfect.

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 17 2021 8:56am

First I would like to thank you to @abrainer for the help to get https://enerprof.de/ sending me a TSDZ2 motor that does not work but I will be able to use for development. I just got a Fedex notification, I should receive it next week.

I found SimpleFOC code and Arduino shield, that is a C++ code and is easy to understand. Seems to have a big community thanks for it be an Arduino shield and C++ firmware, and easier to understand than other complex FOC firmwares like VESC. This firmware runs on slow Arduinos (from AVR to ARM) as also on the popular STM32F103, which makes the chinese boards like hoverboards or some ebikes controllers (if not STM32F103, very similar ones).

I must say that if there is an easy to use / understand and popular OpenSource FOC library, maybe it can be better than the original Infineon library... I am still looking at it and see what I can learn :-)

https://simplefoc.com/
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 17 2021 9:01am

casainho wrote:
Jun 17 2021 8:56am
First I would like to thank you to @abrainer for the help to get https://enerprof.de/ sending me a TSDZ2 motor that does not work but I will be able to use for development. I just got a Fedex notification, I should receive it next week.

I found SimpleFOC code and Arduino shield, that is a C++ code and is easy to understand. Seems to have a big community thanks for it be an Arduino shield and C++ firmware, and easier to understand than other complex FOC firmwares like VESC. This firmware runs on slow Arduinos (from AVR to ARM) as also on the popular STM32F103, which makes the chinese boards like hoverboards or some ebikes controllers (if not STM32F103, very similar ones).

I must say that if there is an easy to use / understand and popular OpenSource FOC library, maybe it can be better than the original Infineon library... I am still looking at it and see what I can learn :-)

https://simplefoc.com/
Oh no, the Infineon has OpenSource support for the Arduino to their XMC microcontrollers!! So, maybe we can just use this motor controller as an Arduino and then just install and use the SimpleFOC library!!

https://github.com/Infineon/XMC-for-Arduino
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

mxlemming   1 kW

1 kW
Posts: 395
Joined: Jul 17 2020 7:56am

Re: TSDZ2 48v 2020 new firmware

Post by mxlemming » Jun 17 2021 3:23pm

This is not a good FOC implementation. It is not deterministic, has no concept of interrupt priority, and doesn't have a way to implement the break state.

It's also not really verified and tested for efficiency etc, whereas the infineon one is and results in excellent efficiency.
casainho wrote:
Jun 17 2021 9:01am
casainho wrote:
Jun 17 2021 8:56am
First I would like to thank you to @abrainer for the help to get https://enerprof.de/ sending me a TSDZ2 motor that does not work but I will be able to use for development. I just got a Fedex notification, I should receive it next week.

I found SimpleFOC code and Arduino shield, that is a C++ code and is easy to understand. Seems to have a big community thanks for it be an Arduino shield and C++ firmware, and easier to understand than other complex FOC firmwares like VESC. This firmware runs on slow Arduinos (from AVR to ARM) as also on the popular STM32F103, which makes the chinese boards like hoverboards or some ebikes controllers (if not STM32F103, very similar ones).

I must say that if there is an easy to use / understand and popular OpenSource FOC library, maybe it can be better than the original Infineon library... I am still looking at it and see what I can learn :-)

https://simplefoc.com/
Oh no, the Infineon has OpenSource support for the Arduino to their XMC microcontrollers!! So, maybe we can just use this motor controller as an Arduino and then just install and use the SimpleFOC library!!

https://github.com/Infineon/XMC-for-Arduino
Why can't everything be easy...

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 18 2021 5:22pm

mxlemming wrote:
Jun 17 2021 3:23pm
This is not a good FOC implementation. It is not deterministic, has no concept of interrupt priority, and doesn't have a way to implement the break state.

It's also not really verified and tested for efficiency etc, whereas the infineon one is and results in excellent efficiency.
Ok, I could understand that the code can works with hall sensors but only uses angle values of 360 / 6, there is not interpolation and not even any sensorless. But the code supports angle reading using encoders and magnetic sensors, which are not used on the ebike motors I know.
Anyway, I did learn somethings looking at the code. I am pretty sure they will keep improving the library but their focus seems more gimbals motors and not ebike motors.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Akita   100 mW

100 mW
Posts: 46
Joined: Apr 29 2021 10:20am

Re: TSDZ2 48v 2020 new firmware

Post by Akita » Jun 19 2021 5:53am

@casainho
When do you think there may be a new firmware where I can set the maximum speed?
Now it is locked to a maximum of 25 km/h.

casainho   100 GW

100 GW
Posts: 5395
Joined: Feb 14 2011 2:43pm

Re: TSDZ2 48v 2020 new firmware

Post by casainho » Jun 19 2021 1:50pm

Akita wrote:
Jun 19 2021 5:53am
@casainho
When do you think there may be a new firmware where I can set the maximum speed?
Now it is locked to a maximum of 25 km/h.
Alone as I am now, I think at least more 3 months. I was father for the second time, 2 weeks ago.
- EBike wireless standard: wireless motor, wireless cycling GPS display Garmin Edge and wireless remote with wireless brake sensor
- TSDZ2 FAQ: issues and repairs, etc
- TSDZ2 OpenSource firmware

Developer of OpenSource knowledge and technology for ebikes: Wireless EBike standard ANT+ and Bluetooth, TSDZ2 OpenSource firmware, KT motor controllers and displays: Bafang 850C color, SW102 Bluetooth and KT-LCD3.

Please consider a donation to help developments: paypal.me/jorgecasa

Astroid   1 µW

1 µW
Posts: 1
Joined: Jun 19 2021 4:06pm

Re: TSDZ2 48v 2020 new firmware

Post by Astroid » Jun 20 2021 7:10am

Elinx wrote:
Jun 10 2021 2:04pm
casainho wrote:
Jun 10 2021 1:48pm
....No, pin 7 and pin 8 are not shorted. My current guess is that they assembled some MPC6021 batch units knowing they are instead MCP6022 -- I think this is possible, maybe the MPC6021 factory sold them this "special" units.
Everything is possible, but I can't imagine that the factory does this, because this would be problematic if you sell these.
It could be possible that another unknown single op-amp would fit there too.
These are MCP602I, "I" chips, not 1. https://ww1.microchip.com/downloads/en/ ... 21314g.pdf

Elinx   10 kW

10 kW
Posts: 653
Joined: Aug 09 2019 6:58am

Re: TSDZ2 48v 2020 new firmware

Post by Elinx » Jun 20 2021 8:22am

Astroid wrote:
Jun 20 2021 7:10am
......

These are MCP602I, "I" chips, not 1.
Well noticed :) That explaines the confusion

Image
MCP602.jpg
MCP602.jpg (23.73 KiB) Viewed 306 times

gfmoore   100 W

100 W
Posts: 124
Joined: May 01 2021 4:48pm

Re: TSDZ2 48v 2020 new firmware

Post by gfmoore » Jun 21 2021 10:41am

casainho wrote:
Jun 19 2021 1:50pm
I was father for the second time, 2 weeks ago.
Congratulations. All the best to you and yours :D

Post Reply