TSDZ2 48v 2020 new firmware

stancecoke said:
casainho said:
Anyway, we should be able to port the firmware of controller V1 to controller V2 and ignore at start that 3 phase currents

:shock: I strongly recomment to analyse the circuit deeply, to understand which ADC_x setup, ADC timing, Timer_x config etc. is needed for doing real FOC. Otherwise you will throw away all your work afterwards.
I don't see any battery current shunt, so you have to read the phase current anyway.

casainho said:
as the sum of the phase currents is equal to the total phase currents that we calculate already on the controller V1 firmware

?! the sum of the phase currents is zero at any time....

regards
stancecoke
A good way can be to try reuse your FOC code as this hardware should be similar to the controller you used. Even the microcontroller is also a Cortex M0.

Yes, my mistake. But I am sure I saw a way on a document to extract the value of battery current from the phase currents... Maybe the sum of ABS of each current, divided by PWM duty-cycle?? Anyway, I will look at it later.
 
casainho said:
But I am sure I saw a way on a document to extract the value of battery current from the phase currents

You have to do the Clark and Park transformations to get the motor current vector id and iq.
The amount of the vector is equal to battery current / duty cycle.

regards
stancecoke
 
In the pinout overview of @abrainer there is an analog input for the battery current?!
5 2.8 Current Total ADC
I think the shunt is on the backside of the PCB...

I started to add the spread information to the github repo:
https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/tree/main/Documentation

I think there is a lot of reading necessary eg. to use the XMC math coprocessor for the transformations.. :?

regards
stancecoke
 
stancecoke said:
In the pinout overview of @abrainer there is an analog input for the battery current?!
5 2.8 Current Total ADC
I think the shunt is on the backside of the PCB...

I started to add the spread information to the github repo:
https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/tree/main/Documentation

I think there is a lot of reading necessary eg. to use the XMC math coprocessor for the transformations.. :?

regards
stancecoke
Great!! And if you can, upload that files like the pictures you linked from somewhere, as also upload that PDF files. The more details we have from the hardware, the better.

I will look at the board when I receive it.
 
stancecoke said:
casainho said:
The more details we have from the hardware, the better.
Which toolchain do you plan to use?! I found the Infineon product DAVE and the platformio solution....

regards
stancecoke
I wish to use the GCC as that is an ARM Cortex M0. Ideally I will reuse a Makefile from NRF52 (TSDZ2 wireless project) and then use Visual Code Studio to build and debug the code, which works very well.
 
casainho said:
I wish to use the GCC as that is an ARM Cortex M0.

Do you know FOC example code for XMC?

https://visualgdb.com/tutorials/arm/infineon/

regards
stancecoke
 
stancecoke said:
casainho said:
I wish to use the GCC as that is an ARM Cortex M0.

Are there any libraries available?! Or do you plan to program on register level?! :shock:

regards
stancecoke
I did not search yet, but I would expect to find them after searching on github.
At least the STM and Nordic, they are popular manufacturers and they provide them as Open source so I expect the same from others.
 
stancecoke said:
casainho said:
and then use Visual Code Studio

sorry for the question, are you really talking about Visual Code Studio a Microsoft product, :shock: or VisualGDB

Platformio has XMC support but this is "Arduino"?! :confused:

regards
stancecoke
Like this: https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/documentation/development-flash_and_debug_firmware.md

 
OK, that will be the first obstacle for many users, if you don't use platformio for things like linker script, makefile etc.... :)

There is a ready to run FOC example for the XMC13 processor, but it's for DAVE/Eclipse, I have no idea how to port it to Visual Studio Code...

regards
stancecoke
 
stancecoke said:
OK, that will be the first obstacle for many users, if you don't use platformio for things like linker script, makefile etc.... :)

There is a ready to run FOC example for the XMC13 processor, but it's for DAVE/Eclipse, I have no idea how to port it to Visual Studio Code...

regards
stancecoke
We only need a project that we can build using the make / Makefile on the command line. Then it should be similar to configure Code Studio, that is very popular is any software developer is probably already familiar and not with a specific software like that from Infineon.
 
stancecoke said:
There is a ready to run FOC example for the XMC13 processor, but it's for DAVE/Eclipse, I have no idea how to port it to Visual Studio Code...
That project seems a standard, it has:
- startup files: startup_XMC1300.S and system_XMC1300.c
- linker script: linker_script.ld
- main.c

What is missing is a Makefile, I would would change the main() to have a while loop, then build that code and use the debugger to see it running, then, keep adding the other source files to the Makefile.

Here a nice Makefile where we specific manually each source file to include on the build: https://github.com/OpenSourceEBike/TSDZ2_wireless/blob/master/EBike_wireless_TSDZ2/firmware/Makefile
 
casainho said:
any software developer is probably already familiar and not with a specific software like that from Infineon
Hm, DAVE is based on Eclipse, as well as the STM32 Workbench and the STM CUBE IDE. I'm very familiar with Eclipse. But if you can set up the project in a way, that it runs out of the box after importing it into Visual Studo Code from github it will be OK :)
If you have to fiddle around for two hours to set up the toolchain correctly, most people will give up before they even start... :shock:

regards
stancecoke
 
stancecoke said:
casainho said:
any software developer is probably already familiar and not with a specific software like that from Infineon
Hm, DAVE is based on Eclipse, as well as the STM32 Workbench and the STM CUBE IDE. I'm very familiar with Eclipse. But if you can set up the project in a way, that it runs out of the box after importing it into Visual Studo Code from github it will be OK :)
If you have to fiddle around for two hours to set up the toolchain correctly, most people will give up before they even start... :shock:
For the TSDZ2 wireless project, using Code Studio, new developers just need to open the project file and everything is ready. Sure, they need to previously install the GCC compiler, OpenOCD, etc.

That 2 hours is a good filter as anyone that plan to develop will need for sure much more than 2 hours!!

I remember to be difficult to install a plugin on Eclipse, for being able to debug for ARM, and then I switched to Code Studio. I still use Eclipse for other projects, like Garmin apps. Comparing both, I really prefer Code Studio because seems to be faster to open and use. Also I can configure much faster the debugger for ARM then in Eclipse.

And I am now experienced to use it for other project tasks like writting the documentation files with live preview:

 
I just added the very initial firmware. It has a Makefile that builds a blink LED code. The Makefile, linkerscipts and startup code were based on this repository: https://github.com/SeanBurford/xmc1100 , which has a few examples including instructions on how to flash and debug using OpenOCD and GDB.

My next steps will be to configure OpenOCD, GDB and Visual Code Studio, and flash and debug this code on the hardware.

Screenshot-from-2021-04-27-08-52-49.png
 
I got the Flashing and Debugging configured on the Visual Code Studio and I wrote a page documenting the process for other developers: https://github.com/OpenSourceEBike/TSDZ2_motor_controller_v2/blob/main/Documentation/how_to_develop.md



Here a creenshot of a debug session of XMC1300 on Linux Ubuntu, using Visual Code Studio, OpenOCD and GDB:
flash_debug.png
 
the second package has arrived, great! unfortunately I cannot program. i can only just test it ....... 🤷🏻‍♂️

Mfg Michael
 
@stancecoke, are you planning to help developing the firmware? if so, are you using or planning to use TSDZ2?

michih. said:
the second package has arrived, great! unfortunately I cannot program. i can only just test it ....... 🤷🏻‍♂️
Yes and you can understand how important it was to have this tools in my hands, how fast I got the very first firmware working, I mean the development process documented and the datasheets for the integrated circuits. I use all the resources I found on the web, I had a lot of help from the other threads already discussing this V2 motor controller as also from other OpenSOurce projects that are already using the not so popular XMC1300 microcontroller.
 
absolutely awesome. I look forward to the first results and try. you can send me files for testing when the time comes. have the 850c display.

MFG Michael
 
casainho said:
@stancecoke, are you planning to help developing the firmware? if so, are you using or planning to use TSDZ2?
I will not use a middrive motor, my highest priority is the absolute silence of the drive, therefore I use BionX direct drives in my bikes, as you know.

I can help with the basic FOC commutation, if help is needed. I strongly recomment to use the DAVE APP configuration tool, that is described in the pdf document (comes with the zip file of the FOC example), to generate the code for the hardware initialization (ADCx, Timerx, Interrupts....). But you have to accept, that you will use some precompiled libs from Infineon. This will save 4 weeks of reading the reference manual....
You can then edit the generated code further in Visual Studio Code.

I've written the whole FOC firmware for the Lishui controllers with STM32 processor from scratch, without using the ST motor control libraries, but that was a very long and rocky road :wink:

regards
stancecoke

DAVE APP configurator.JPG
DAVE APP configurator_1.JPG
DAVE APP configurator_2.JPG
 
michih. said:
g
absolutely awesome. I look forward to the first results and try. you can send me files for testing when the time comes. have the 850c display.
This can be fast like 1 month if other developers help, other way I would say it will take at least 6 months for me alone. And here is an example: I do not have displays anymore, my last 860C display suddenly stopped to working and as they are very expensive, I will not buy anymore and instead use the wireless board because is much cheaper as also to repair - see that the 860C display that stopped to working has very good looking, seems perfect but unfortunately It is impossible to repair, the only option it buy another one and that is expensive :-(
 
Back
Top