TSDZ2 48v 2020 new firmware

casainho said:
michih. said:
https://www.ebay.de/itm/174321114587

is that the right j-link
Yes, I bought that one although I did not yet tested it. That is just the same concept as the cheap ST-LinkV2 we use to flash TSDZ2 motor controller firmware and the displays firmware.

https://uk.farnell.com/segger/8-08-91-j-link-edu-mini/educational-unit-cortex-m/dp/3106578?st=J-link%20edu

Don't piss about, you can have a genuine, licenced segger j link for less than 20 euros for education purposes. Segger have been nice enough to see the millions of clones and released this cheap version, actual genuine hardware that actually works and gets updates etc.
 
mxlemming said:
casainho said:
michih. said:
https://www.ebay.de/itm/174321114587

is that the right j-link
Yes, I bought that one although I did not yet tested it. That is just the same concept as the cheap ST-LinkV2 we use to flash TSDZ2 motor controller firmware and the displays firmware.

https://uk.farnell.com/segger/8-08-91-j-link-edu-mini/educational-unit-cortex-m/dp/3106578?st=J-link%20edu

Don't piss about, you can have a genuine, licenced segger j link for less than 20 euros for education purposes. Segger have been nice enough to see the millions of clones and released this cheap version, actual genuine hardware that actually works and gets updates etc.
Why I would care about Segger but not about Tongsheng?
 
casainho said:
mxlemming said:
casainho said:
michih. said:
https://www.ebay.de/itm/174321114587

is that the right j-link
Yes, I bought that one although I did not yet tested it. That is just the same concept as the cheap ST-LinkV2 we use to flash TSDZ2 motor controller firmware and the displays firmware.

https://uk.farnell.com/segger/8-08-91-j-link-edu-mini/educational-unit-cortex-m/dp/3106578?st=J-link%20edu

Don't piss about, you can have a genuine, licenced segger j link for less than 20 euros for education purposes. Segger have been nice enough to see the millions of clones and released this cheap version, actual genuine hardware that actually works and gets updates etc.
Why I would care about Segger but not about Tongsheng?

Because you're paying tongsheng for hardware, giving them revenue for their product whereas you're buying knock off segger and using their software, IP... to program the tongsheng.

It's quite different.

Hypothesise that someone takes your source, makes a product with it and locks it down, didn't share the code... you'll be crying "but my gpl v3....".
 
mxlemming said:
casainho said:
mxlemming said:
casainho said:
Yes, I bought that one although I did not yet tested it. That is just the same concept as the cheap ST-LinkV2 we use to flash TSDZ2 motor controller firmware and the displays firmware.

https://uk.farnell.com/segger/8-08-91-j-link-edu-mini/educational-unit-cortex-m/dp/3106578?st=J-link%20edu

Don't piss about, you can have a genuine, licenced segger j link for less than 20 euros for education purposes. Segger have been nice enough to see the millions of clones and released this cheap version, actual genuine hardware that actually works and gets updates etc.
Why I would care about Segger but not about Tongsheng?
Because you're paying tongsheng for hardware, giving them revenue for their product whereas you're buying knock off segger and using their software, IP... to program the tongsheng.

It's quite different.

Hypothesise that someone takes your source, makes a product with it and locks it down, didn't share the code... you'll be crying "but my gpl v3....".
I have a different view, that we are unlocking the ThongSheng motor, changing the different products models of different motor power and battery voltage, so we are damaging ThongSheng business model. Just the same we did when unlocking the EBike displays KT-LCD3, SW102, 850C and 860C.
And we are also using technology with licensing it, like Bluetooth and ANT. And probably others things alike.

So yes, I do not care much about Segger than what I care about the others.

And I really think fighting the climate crisis is above of all this. EBikes and small electric vehicles have a big positive impact, in EU they are GROWING A LOT because users are more conscious about fighting the global warming and climate change.
 
casainho said:
mxlemming said:
casainho said:
mxlemming said:
https://uk.farnell.com/segger/8-08-91-j-link-edu-mini/educational-unit-cortex-m/dp/3106578?st=J-link%20edu

Don't piss about, you can have a genuine, licenced segger j link for less than 20 euros for education purposes. Segger have been nice enough to see the millions of clones and released this cheap version, actual genuine hardware that actually works and gets updates etc.
Why I would care about Segger but not about Tongsheng?
Because you're paying tongsheng for hardware, giving them revenue for their product whereas you're buying knock off segger and using their software, IP... to program the tongsheng.

It's quite different.

Hypothesise that someone takes your source, makes a product with it and locks it down, didn't share the code... you'll be crying "but my gpl v3....".
I have a different view, that we are unlocking the ThongSheng motor, changing the different products models of different motor power and battery voltage, so we are damaging ThongSheng business model. Just the same we did when unlocking the EBike displays KT-LCD3, SW102, 850C and 860C.
And we are also using technology with licensing it, like Bluetooth and ANT. And probably others things alike.

So yes, I do not care much about Segger than what I care about the others.

And I really think fighting the climate crisis is above of all this. EBikes and small electric vehicles have a big positive impact, in EU they are GROWING A LOT because users are more conscious about fighting the global warming and climate change.
Maybe one day tongsheng will be angry, but i doubt it, you're still legitimately posting for their products. If I used Dior make up as paint thinner I don't think Dior would care.

The licence for Bluetooth etc is paid in the hardware, paid by the chip makers. You don't need to relicence for software. If you're knowingly using fake, rip off modules, you shouldn't.

Climate change hippiness doesn't exempt you from law, unfortunately you're still advocating counterfeit goods, where there's a perfectly reasonable alternative.
 
mxlemming said:
mxlemming said:
casainho said:
Why I would care about Segger but not about Tongsheng?
Because you're paying tongsheng for hardware, giving them revenue for their product whereas you're buying knock off segger and using their software, IP... to program the tongsheng.

It's quite different.

Hypothesise that someone takes your source, makes a product with it and locks it down, didn't share the code... you'll be crying "but my gpl v3....".
I have a different view, that we are unlocking the ThongSheng motor, changing the different products models of different motor power and battery voltage, so we are damaging ThongSheng business model. Just the same we did when unlocking the EBike displays KT-LCD3, SW102, 850C and 860C.
And we are also using technology with licensing it, like Bluetooth and ANT. And probably others things alike.

So yes, I do not care much about Segger than what I care about the others.

And I really think fighting the climate crisis is above of all this. EBikes and small electric vehicles have a big positive impact, in EU they are GROWING A LOT because users are more conscious about fighting the global warming and climate change.
Maybe one day tongsheng will be angry, but i doubt it, you're still legitimately posting for their products. If I used Dior make up as paint thinner I don't think Dior would care.

The licence for Bluetooth etc is paid in the hardware, paid by the chip makers. You don't need to relicence for software. If you're knowingly using fake, rip off modules, you shouldn't.

Climate change hippiness doesn't exempt you from law, unfortunately you're still advocating counterfeit goods, where there's a perfectly reasonable alternative.
Anyone is free to buy what they want. I live in Portugal, one of the poorest country of EU and here we have the culture to buy cheap products (I mean not only as individuals but also when we are representing companies). I can legally buy from EBay and I have there cheaper options.

If you are really worried about counterfeit goods, then I think you should look instead to buy an European brand motor like Bosch.
 
casainho said:
mxlemming said:
mxlemming said:
Because you're paying tongsheng for hardware, giving them revenue for their product whereas you're buying knock off segger and using their software, IP... to program the tongsheng.

It's quite different.

Hypothesise that someone takes your source, makes a product with it and locks it down, didn't share the code... you'll be crying "but my gpl v3....".
I have a different view, that we are unlocking the ThongSheng motor, changing the different products models of different motor power and battery voltage, so we are damaging ThongSheng business model. Just the same we did when unlocking the EBike displays KT-LCD3, SW102, 850C and 860C.
And we are also using technology with licensing it, like Bluetooth and ANT. And probably others things alike.

So yes, I do not care much about Segger than what I care about the others.

And I really think fighting the climate crisis is above of all this. EBikes and small electric vehicles have a big positive impact, in EU they are GROWING A LOT because users are more conscious about fighting the global warming and climate change.
Maybe one day tongsheng will be angry, but i doubt it, you're still legitimately posting for their products. If I used Dior make up as paint thinner I don't think Dior would care.

The licence for Bluetooth etc is paid in the hardware, paid by the chip makers. You don't need to relicence for software. If you're knowingly using fake, rip off modules, you shouldn't.

Climate change hippiness doesn't exempt you from law, unfortunately you're still advocating counterfeit goods, where there's a perfectly reasonable alternative.
Anyone is free to buy what they want. I live in Portugal, one of the poorest country of EU and here we have the culture to buy cheap products (I mean not only as individuals but also when we are representing companies). I can legally buy from EBay and I have there cheaper options.

If you are really worried about counterfeit goods, then I think you should look instead to buy an European brand motor like Bosch.

Would it be ok with you if I cloned your firmware repo and re released the whole lot under MIT licence then?
 
mxlemming said:
casainho said:
mxlemming said:
I have a different view, that we are unlocking the ThongSheng motor, changing the different products models of different motor power and battery voltage, so we are damaging ThongSheng business model. Just the same we did when unlocking the EBike displays KT-LCD3, SW102, 850C and 860C.
And we are also using technology with licensing it, like Bluetooth and ANT. And probably others things alike.

So yes, I do not care much about Segger than what I care about the others.

And I really think fighting the climate crisis is above of all this. EBikes and small electric vehicles have a big positive impact, in EU they are GROWING A LOT because users are more conscious about fighting the global warming and climate change.
Maybe one day tongsheng will be angry, but i doubt it, you're still legitimately posting for their products. If I used Dior make up as paint thinner I don't think Dior would care.

The licence for Bluetooth etc is paid in the hardware, paid by the chip makers. You don't need to relicence for software. If you're knowingly using fake, rip off modules, you shouldn't.

Climate change hippiness doesn't exempt you from law, unfortunately you're still advocating counterfeit goods, where there's a perfectly reasonable alternative.
Anyone is free to buy what they want. I live in Portugal, one of the poorest country of EU and here we have the culture to buy cheap products (I mean not only as individuals but also when we are representing companies). I can legally buy from EBay and I have there cheaper options.

If you are really worried about counterfeit goods, then I think you should look instead to buy an European brand motor like Bosch.

Would it be ok with you if I cloned your firmware repo and re released the whole lot under MIT licence then?
Yes, I would be happy as long as it is for some EBike or any other electric vehicle!!
 
@abrainer has added support for the torquesensor and UART printout. I can't check it in hardware, I'm just doing the github service for him :)

https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/commit/144c83043c8f81e7f76056cd12b1cc38b780fb5d

Don't use the command PMSM_FOC_MotorStop(&PMSM_FOC_0); as it leaves the half bridge drivers in an unsafe state. We actually don't know, how to solve that issue...

regards
stancecoke
 
stancecoke said:
@abrainer has added support for the torquesensor and UART printout. I can't check it in hardware, I'm just doing the github service for him :)

https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/commit/144c83043c8f81e7f76056cd12b1cc38b780fb5d

Don't use the command PMSM_FOC_MotorStop(&PMSM_FOC_0); as it leaves the half bridge drivers in an unsafe state. We actually don't know, how to solve that issue...
Great!

Do you think that issue with the half bridges in unsafe state can later be changed manually in the code or is something that we do not have access to?
 
casainho said:
Do you think that issue with the half bridges in unsafe state can later be changed manually in the code

Yes, I think it's an issue with the SVPWM timer setup. But we don't know, what are the right settings, I can't test, as I have no hardware :wink:

https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/blob/37afa6a93d61a12a3c5ae041b63c368f41358354/DAVE_FOC_PROJECT/Dave/Generated/PWM_SVM/pwm_svm_conf.c#L188

regards
stancecoke
 
I got J-Link correctly connected to the motor controller, flashing and debug the blink firmware. Next I will document how to connect it.

Soon I will start playing with the motor but first I need to understand current motor firmware and figure out how I can connect a throttle so I can command the motor.

@stancecoke and @abrainer, can you guys help me on where can I physically connect the throttle as my controllers do not have throttle connection?
And on firmware, where can I see the throttle input being used?
Any considerations I should have to run the motor?

2021-05-13-17-09-18-1.jpg
 
I just updated the documentation:

image.png
 
casainho said:
@stancecoke and @abrainer, can you guys help me on where can I physically connect the throttle as my controllers do not have throttle connection?
And on firmware, where can I see the throttle input being used?
Any considerations I should have to run the motor?
2021-05-13-17-09-18-1.jpg
@casainho, I don't know which pin the throttle is connected to in the stock firmware. The analogue input P2.5 is connected to the pads J7.
See picture:
P2_5_Input.PNG
 
abrainer said:
@casainho, I don't know which pin the throttle is connected to in the stock firmware. The analogue input P2.5 is connected to the pads J7.
See picture:
P2_5_Input.PNG
Thanks!! That position seems similar to controller V1 throttle pad. Do you know if there is any extra analog pad we can use for temperature sensor?

You have this on your notes:
35 | 2.0 | Serial signal on unused pad 1
36 | 2.1 | Input from unused pad 2

One question, do you use this motor on your EBike??
 
Port 2.1 is led out at J1 pin 2. I think the input is usable, but I'm not sure what input circuitry is used. You would have to measure this on the cleaned board.

And yes, I use the new motor in my trekking bike. In my mountain bike I have installed the new controller in the older motor. I grilled the old controller when the battery was not properly connected and had a loose contact. Because I still had a new controller in the cupboard, I installed it.

P2_1_Input.PNG
 
I wrote a simple Makefile to build the code inside DAVE_FOC_PROJECT. I can run and debug the code as seen on the following image. The idea is the tweaks to motor FOC code can be done on DAVE tool and other code can be added manually by us.

My next step is to get brake sensors working (to block FOC initialization, in case something goes wrong and the mosfets are in short circuit) and throttle working to define the motor current.

Screenshot-from-2021-05-17-13-19-06.png
 
casainho said:
I wrote a simple Makefile to build the code inside DAVE_FOC_PROJECT. I can run and debug the code as seen on the following image. The idea is the tweaks to motor FOC code can be done on DAVE tool and other code can be added manually by us.

My next step is to get brake sensors working (to block FOC initialization, in case something goes wrong and the mosfets are in short circuit) and throttle working to define the motor current.

Screenshot-from-2021-05-17-13-19-06.png

Jlink arrived today - will hopefully get my dev env setup tonight. I still don't have much free time at the moment - but when I do I'll split the time between working on the new features for the wireless controller - and porting motor controller code.

Have been thinking about how to manage the two codebases to keep features common with a minimum of legwork;

Idea was to refactor the existing motor controller code slightly - move anything hardware specific out of ebikeapp.c and into a hardware abstraction class that reads things like torque sensor or pas - then make ebikeapp.c part of common firmware... in other words separating all the hardware specific motor control code from the higher level functionality.

I was thinking the interface for motor.c should be simplified to just motor control parameters - such as:

target pwm (with corresponding ramp up/down in units/sec) OR target current (with corresponding ramp up/down in units/sec)
limits for pwm/current/rpm/power - rpm is new, and power may be unnecessary in addition to current.

So that would mean to move any code that adjusts motor current or pwm parameters based on torque or pas values out of motor.c...

Anyway - just thoughts for now - I'm sure once I start work it will become apparent if this is going to work well or not!
 
beemac said:
Have been thinking about how to manage the two codebases to keep features common with a minimum of legwork;

Idea was to refactor the existing motor controller code slightly - move anything hardware specific out of ebikeapp.c and into a hardware abstraction class that reads things like torque sensor or pas - then make ebikeapp.c part of common firmware... in other words separating all the hardware specific motor control code from the higher level functionality.

I was thinking the interface for motor.c should be simplified to just motor control parameters - such as:

target pwm (with corresponding ramp up/down in units/sec) OR target current (with corresponding ramp up/down in units/sec)
limits for pwm/current/rpm/power - rpm is new, and power may be unnecessary in addition to current.

So that would mean to move any code that adjusts motor current or pwm parameters based on torque or pas values out of motor.c...
I see the following disadvantages:

1. 8 bits VS 32 bits microcontroller, meaning the old code is optimized (I mean all the code, not only the motor code) for 8 bits and that would be a limitation (in quality output) for the new motor controller.

2. The compiler SDCC for the old one is more limited and the code is a mess because of that, with all variables global.
 
@abrainer and @stancecoke and other developers,

I have a very simple code that only reads the throttle ADC - I commented all the code for the motor control and the ADC throttle reading, but I added a throttle ADC code that I found on web and works.

Currently my Makefile is as shown bellow and the ADC interrupt and value reading works well, BUT, if I build the DAVE_FOC_PROJECT/Dave/Generated/PMSM_FOC/pmsm_foc_control.c (uncomment that last line shown on the image), the code builds without errors but will not work at all, I put a break point at begin of main but it never gets there :-( -- any idea what can be the cause??

image.png
 
@stancecoke,

I found the code builds and works until I do the PWM_Init():

if (init_status == DAVE_STATUS_SUCCESS)
{
/** Initialization of PWM APP instance PWM_0 */
init_status = (DAVE_STATUS_t)PWM_Init(&PWM_0);
}

For some reason, PWM_Init is making the code failing, it not even goes to main().
CLOCK_XMC1_Init(), UART_Init() and PMSM_FOC_Init(), all of them work, only PWM_Init() make the system fail...

Also now I the project on DAVE seem to fail, meaning we can not change the configurations...
 
casainho said:
I found the code builds and works until I do the PWM_Init():

Hm, @abrainer got his motor spinning with the last commit I pushed to github. So it might be a matter of your compiler settings, I can post the makefiles from the DAVE IDE, if you are interested. But I can't debug, as I have no hardware.

regards
stancecoke
 
stancecoke said:
casainho said:
I found the code builds and works until I do the PWM_Init():

Hm, @abrainer got his motor spinning with the last commit I pushed to github. So it might be a matter of your compiler settings, I can post the makefiles from the DAVE IDE, if you are interested. But I can't debug, as I have no hardware.
I am trying also DAVE and the code also builds there and I can see the original Makefile. This Makefile seems to include other missing Makefiles, right?

A big issue is that I can not change / see anymore the configurations of the project, like I can't see the PWM configurations for instance. Can you please test this on your side?

I also tried a few times to use the debug on DAVE but it doesn't work. I installed the J-Link software and it did even update the J-Link firmware, so it is working. And after this update, it still works as regular with OpenOCD on my Linux.
 
casainho said:
A big issue is that I can not change / see anymore the configurations of the project, like I can't see the PWM configurations for instance

Do you mean the App perspective or the related source code?

for the App perspective go to Window-->Perspective-->Open Perspective-->Other-->DAVE CE

In the generated code, the timer setup for the PWM seems to happen here:
https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/blob/37afa6a93d61a12a3c5ae041b63c368f41358354/DAVE_FOC_PROJECT/Dave/Generated/PWM_SVM/pwm_svm_conf.c#L196

But I have no idea why Infineon calls it "slices" :confused:

regards
stancecoke
 
stancecoke said:
casainho said:
A big issue is that I can not change / see anymore the configurations of the project, like I can't see the PWM configurations for instance

Do you mean the App perspective or the related source code?

for the App perspective go to Window-->Perspective-->Open Perspective-->Other-->DAVE CE
I mean the app configurations, as I can see and edit the sources files. Thanks I will check later.

stancecoke said:
In the generated code, the timer setup for the PWM seems to happen here:
https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/blob/37afa6a93d61a12a3c5ae041b63c368f41358354/DAVE_FOC_PROJECT/Dave/Generated/PWM_SVM/pwm_svm_conf.c#L196

But I have no idea why Infineon calls it "slices" :confused:
Hmmm, so this means that the issue I have with PWM_Init() is not about PWM for motor, as I just saw PWM for motor is on the pwm_svm as you noted.

So, PWM_Init() is used for the torque sensor?

So we have:
- torque sensor: PWM_Init() for coil circuit and ADC read?
- UART_Init() for the display communication
- PMSM_FOC_Init() for motor PWM and FOC

Is that correct? Because If so, I could ignore for now the issue I am having on PWM_Init() and not use the torque sensor, as I am using instead the throttle and that is simple ADC reading. With this I can probably have the motor running.
 
Back
Top