You will need the J-Link and you can buy on Ebay, Aliexpress, etc, for about 4€:
You need to connect J-Link to TSDZ2 motor controller speed sensor connector and for that you can buy on Ebay, etc, a TSDZ2 speed sensor extension cable and use the male connector.
Connect the J-Link wires to the following pins / wires of TSDZ2 motor controller speed sensor connector (note that you will not need to power up the motor controller using the battery as the J-Link (3V3) VCC will power it up enough for programming):
- Black --> GND
- Red --> (3V3) VCC
- Yellow --> SWCLK
- Green --> SWDIO
Screenshot of a debug session of XMC1300 on Linux Ubuntu, using Visual Code Studio, OpenOCD and GDB:
For the firmware development, flash and debug, you can use the OpenSource and free IDE Visual Studio Code. For sure that others will work like the Eclipse.
This guide assumes you are using Linux Ubuntu (if you are on Windows or such, the install process should be similar).
- Add your user to the dialout group: sudo usermod -a -G dialout USER_NAME and reboot
- install Visual Studio Code
- install C/C++ extension (to edit C/C++ source files)
- install Cortex-Debug extension (to be able to debug ARM microcontroller)
- install Task Manager extension (to call makefile and other commands)
- install OpenOCD (to connect to j-link): sudo apt-get install openocd
- install GDB GNU debugger (for debug and connect to OpenOCD): sudo apt-get install gdb-multiarch
- install ARM C/C++ GCC compiler: sudo apt-get install gcc-arm-none-eabi
- install ARM binutils: sudo apt-get install binutils-arm-none-eabi
- install ARM newlib: sudo apt-get install libnewlib-arm-none-eabi
Click on menu File -> Open folder... and select the firmware directory.
Because you installed the Task Manager extension, you should see Task manager icon on the left bar - click on it. The build, clean and Launch OpenOCD tasks should be available.
Start by clicking on the clean to clean the code and then click on the build to build the code.
The clean and build tasks call the make clean and make on the terminal. The tasks configurations are on the file .vscode/tasks.json.
-
Connect the J-Link to the motor controller
-
Click on the task Launch OpenOCD
You will need to click only once. The OpenOCD should connect to the microcontroller and keep active.
The task Launch OpenOCD configuration is on the file .vscode/tasks.json.
- Click Flash and Debug
Click on the debug icon on the left panel and then click on the small green arrow for the Flash and Debug - will flash the firmware on the microcontroller and then start the debug of the firmware.
The Flash and Debug configuration is on the file .vscode/launch.json.