Page 1
Motor Control User Guide Reference Design User Guide AX58400 Motor Control User Guide Revision 2.20 December 20 , 2024 rch 14 , 2020 rch 14 , 2020 rch 14 , 2020 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
2. Added PID gain objects in 0x2000~0x3FFF area in Section 9-1. 3. Added AX58400 pinout patch description in Section 4-2. 4. Added AX58400 MC Workbench patch description in Section 4-3. 5. Added Section 12 - Firmware Architecture. 6. Added Section 13 - Tuning the PID gain values with TwinCAT.
Firmware Architecture ................... 54 13-1 Dual Core Shared Modules .................. 54 13-2 CM7 Core Modules ....................56 13-3 CM4 Core Modules ....................56 Tuning the PID Loop Gains with TwinCAT ............57 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 4
14-4 Create Scope Project in TwinCAT ................ 59 14-5 Position Loop Gain Value Manual Tuning in TwinCAT ......... 62 14-6 Speed Loop Gain Value Manual Tuning in TwinCAT ........... 63 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
1. Introduction Reference Design User Guide This document introduces how to setup entire environment for motor control application on AX58400-TSB-1 with ST X-NUCLEO-IHM08M1. The demo application of EtherCAT master side develops using PLC (Programmable Logic Controller) language through BECKHOFF TwinCAT engineering (XAE). The IDE relies on Microsoft Visual Studio 2010 / 2013.
ST MotorControl Workbench6 version 6.2.1 (for development only) You can download the MotorControl Workbench here. Figure 2-2 ⚫ STM32CubeMX version 6.12.1 (for development only) You can download the STM32CubeMX here. Figure 2-3 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 10
You can download the STM32CubeProgrammer here. Figure 2-6 ⚫ SSC Tool V5.13 (for development only) You can download the SSC Tool from EtherCAT Technology Group (ETG) here Figure 2-7 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 11
For more details, please refer to the link below and the following chapter. STMicroelectronics official link: https://www.st.com/en/ecosystems/x-nucleo-ihm08m1.html ⚫ MOTION TECH BL60M24D8E00430080 Motor x 1 For more details, please refer to the link below. MTM official link: http://www.motiontech.com.tw/ Figure 2-9 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 12
AX58400 Motor Control User Guide Reference Design User Guide Table 2-1 Table 2-2 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 13
AX58400 Motor Control User Guide Reference Design User Guide Table 2-3 ⚫ 24VDC/8A Power Supply x 1 Figure 2-10 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
AX58400 Motor Control User Guide 3. Board Description Reference Design User Guide 3-1 AX58400-TSB The AX58400-TSB is a development board for AX58400 IC and has below components: CON2 CON1 CON3 CON4 Figure 3-1 ◼ J1: ICE header connector, used to connect STLINK-V3MINI.
Please based on below table to connect all necessary equipment. Table 4-1 If your environment is set up ready, it should look like this. Encoder +24VDC U, V, W EtherCAT Cable Figure 4-1 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Assume the STM32CubeMX has been installed successfully, and if the developer would like to get a more suitable pinout view of AX58400 on STM32CubeMX, please follow the steps below to achieve this. Step 1: Open the below files with text editor and modify the “STMMX_ROOT” as your STM32CubeMX installation path.
Figure 4-4 Also, if you want go back to original state, please performing the un-patch file below. AX58400_MCWB_Patch_vXXX\AX58400_MCWB_UnPatch.cmd This step requires the additional installation of the “AX58400 MCWB Patch” package. Please contact Notice: ASIX’s Technical Support (support@asix.com.tw) for further support.
In order to keep the corrected reference path in BSP, please save the project folder in the path below. BSP_ROOT\SampleCode\ Figure 5-1 Step 2: Select SM-PMSM 24V motor, X-NUCLEO-IHM08M1 power board and NUCLEO-H755ZI control board. Figure 5-2 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 20
Step 4: Setup remanning property tabs as the setting in MC Workbench project file below. BSP_ROOT\SampleCode\Ax58400_MotorControl\Ax58400_MotorControl.stwb6 Step 5: Generates the source code with the CubeMX v6.12.1 and select Firmware Package Version v1.11.1. Figure 5-4 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Change TIM1 pins, from PA8, PA9 and PA10 to be PE9, PE11 and PE13. (To select the PA8 pin, hold down Ctrl + left mouse button, then drag it to the PE9 pin.) Figure 5-7 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 22
Firstly, set PH0 & PH1 pins to “Reset State”, then add the pins as below. Reference Design User Guide Figure 5-8 Step 6: Modify “Pinout & Configuration > Timer > TIM1” settings as highlighted in red. Figure 5-9 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 23
Step 8: Enable “Pinout & Configuration > Connectivity > SPI3” on CM4 with the setting as highlighted in red. Figure 5-11 Step 9: Enable “Pinout & Configuration > Connectivity > UART4” on CM4 and “UART7” on CM7. Figure 5-12 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 24
AX58400 Motor Control User Guide Step 10: Modify the NVIC1 setting as below. Reference Design User Guide Figure 5-13 Figure 5-14 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 25
AX58400 Motor Control User Guide Step 11: Modify the NVIC2 setting as below. Reference Design User Guide Figure 5-15 Figure 5-16 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
5-4 Generate Source Code in STM32CubeMX Step 1: In “Project Manager > Project” page, extended the minimum heap size to 0x1000 on CM4, and select Firmware Package as “STM32Cube FW_H7 V1.11.1”. Figure 5-18 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 27
Step 3: In “Project Manager > Advanced Settings” page, disable initial code generation of SPI3, TIM6 and TIM7 on CM4 core. Figure 5-20 Step 4: Generates the source code. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Step 3: Add the Share Memory declaration for CM4. ⚫ For Keil MDK IDE As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\MDK-ARM\stm32h755xx_flash_CM4.sct Figure 5-22 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 29
Step 4: Add the Share Memory declaration for CM7. ⚫ For Keil MDK IDE As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\MDK-ARM\stm32h755xx_flash_CM7.sct Figure 5-24 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 30
Reference Design User Guide Figure 5-25 Step 5: Modify source code on CM4 core. As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\CM4\Src\main.c Figure 5-26 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 31
Reference Design User Guide Figure 5-27 Step 6: Modify source code on CM7 core. As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\CM7\Src\main.c Figure 5-28 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 32
As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\CM7\Src\stm32h7xx_mc_it.c Reference Design User Guide Figure 5-29 As highlighted in the figure below, modify file content in the path: BSP_ROOT\SampleCode\Ax58400_MotorControl\CM7\Src\mc_task.c Figure 5-30 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Due to the ETG Slave Stack Code (SSC) license limitation, the user must re-generate the source code by the SSC tool locally, about how to get the SSC tool and how to generate targeted source code, please refer to the user guide as below. BSP_ROOT\Document\AX58x00_SSC_Tool_Configuration_Import_UserGuide_vXXX.pdf Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Click on “Project > Options for Target ‘xxxx’… > Utilities > Settings”, then select “Flash Download” page to add “Programming Algorithm” as the value below. Figure 5-33 For CM4 core: Start = 0x08100000, Size = 0x00100000 For CM7 core: Start = 0x08020000, Size = 0x000E0000 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 36
Switch to Ax58400_MotorControl_CM7 project, then exclude the source from target build as the figure below. Reference Design User Guide Figure 5-36 Now, entire building procedure has done for Keil MDK IDE. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 37
Add Virtual Folder: Right click on target project and select “New > Folder”, then enter new folder name and select “Folder is not located in the file system (Virtual Folder)” to create a folder. Figure 5-38 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 38
Find setting on “Project > Properties > C/C++ Build > Settings > Tool Settings > MCU/MCP GCC Compiler > Include paths”, then add paths as the figure below. Figure 5-41 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 39
For CM7 core: ../../../../../Tools/FileInfoAdder Ax58400_MotorControl_CM7.bin ../../../For_TwinCAT/FoE/AX58400_MotorControl_CM7.efw -ft 1 Now, entire building procedure has done for STM32CubeIDE. So far, the entire project source has been ready for building firmware binary. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Step 1: Double clicks the project file as below path to open project. BSP_ROOT\SampleCode\Ax58400_MotorControl\STM32CubeIDE\.project Step 2: Execute “Build All” under “Menu Bar > Project” to build CM4 & CM7 firmware binary files. Figure 6-2 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Motor Control User Guide 6-2 Download Bootloader Firmware Reference Design User Guide Step 1: Open STM32CubeProgrammer utility and connect to the AX58400-TSB board via STLINK-V3MINI programmer. Step 2: Select the “Erasing & Programming” page, then click “Browse” button to select bootloader firmware binary file in the path below.
For STM32CubeIDE: Step 1: Select target project and click “Menu bar > Run > Run As > STM32 C/C++ Application” to download CM4 & CM7 application firmware respectively. Figure 6-6 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 43
Motor Control User Guide ⚫ Using STM32CubeProgrammer Utility: Step 1: Similarly, please ensure the utility has connected to target AX58400-TSB board. Reference Design User Guide Step 2: Select the “Erasing & Programming” page, then click “Browse” button to select CM7 application firmware file in the path below.
AX58400 Motor Control User Guide 7. Basic Operation of TwinCAT Reference Design User Guide Please refer to Section 3 of “AX58x00_TwinCAT_UserGuide” for more details. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
AX58400 Motor Control User Guide 8. PLC Application Reference Design User Guide Please refer to Section 5 of “AX58x00_TwinCAT_UserGuide” for more details. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
The .efw file is dedicate use for FoE transfer, it’s a firmware binary file with 32-bytes header pre-fix. Every time the project build done, the .efw file will auto be generated in the path below by “FileInfoAdder.exe” utility. BSP_ROOT\SampleCode\Ax58400_MotorControl\For_TwinCAT\FoE\AX58400_MotorControl_CM4.efw BSP_ROOT\SampleCode\Ax58400_MotorControl\For_TwinCAT\FoE\AX58400_MotorControl_CM7.efw Figure 9-1 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Step 4: If the firmware upgrading is complete successfully, the pop up dialog will appear as the figure below. Figure 9-4 Step 5: Similarly, upgrading the CM7 application firmware by select the file as path below. BSP_ROOT\SampleCode\Ax58400_MotorControl\For_TwinCAT\FoE\AX58400_MotorControl_CM7.efw Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Tx pdo mapping of csp/csv Position actual value Velocity actual value Modes of operation display Mapped objects: 0x1A01 PDO Mapping RECORD Tx pdo mapping of csp Statusword Position actual value Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
14bytes input and 14bytes output, under this setting, the minimum DC cycle time can down to 100us. Figure 11-1 Without frame lost and Tx/Rx error at Master side. Figure 11-2 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 52
AX58400 Motor Control User Guide Also, without detected SM-Event Missed, Cycle Time Too Small and Sync Error at Slave side. Reference Design User Guide Figure 11-3 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Step 3: Select “Clock Configuration” page, then modify the setting as highlighted in red as below. Figure 12-2 Step 4: Re-generate the source code, then re-build the target and upgrade the firmware as mentioned previously. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Motor Control User Guide 13. Firmware Architecture Reference Design User Guide Below figure shows the simple software architecture of AX58400 Motor Control Reference Design. All the firmware modules could be classified three parts as below. ⚫ Dual Core shared modules ⚫...
Every supported mode in CiA402 has been implemented as a single module, common functions and definitions are implemented in cia402 module. ⚫ EtherCAT Slave Stack Code (SSC) This stack is generated by ETG’s SSC tool. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
14-2 Link New Objects to Data Structure in CM4 Step 1: Add new members in CiA402_OBJ_T data structure, notes each data type must be same as the new objects on “AX58400_MotorControl.xlsx”, like this. Figure 14-2 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Step 1: Add new objects index for write operations as below. Figure 14-4 Step 2: Add new objects index for read operations as below. Figure 14-5 Step 3: Re-build the project and update new firmware into AX58400. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Please follows the steps below to do this. Figure 14-6 Here selects the “Scope YT Project” then click “OK” button to complete the scope creation. Figure 14-7 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 60
Please follows the steps below to do this. Reference Design User Guide Figure 14-8 Figure 14-9 Here we create a new plot axis to display speed response curve. Figure 14-10 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 61
Reference Design User Guide Figure 14-11 Figure 14-12 So far, the scope is ready to record the process data, we can start to tuning the position and speed loop gains. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
“drive_parameters.h” file, then re-build and upgrade the firmware. Figure 14-14 If the tuning is complete, please turn off the “CSP ON/OFF” switch and wait for the motor stop. Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Similarly, switch back to “CoE-Online” function tab to adjust SpdKpGain and SpdKiGain until satisfying the application requirement. Figure 14-15 Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Page 64
(4) You may not alter, modify, copy or otherwise misappropriate any ASIX electronic product, whether in whole or in part. ASIX Electronics shall not be liable for any loss incurred by you or a third party as a result of altering, modifying, copying or otherwise misappropriating ASIX Electronics products.
Page 65
No part of this document may be reproduced or transmitted in any form or by any means, electronic or mechanical, including photocopying and recording, for any purpose, without the express written permission of ASIX. ASIX may make changes to the product specifications and descriptions in this document at any time, without notice.
Page 66
AX58400 Motor Control User Guide Reference Design User Guide 4F, No.8, Hsin Ann RD., Hsinchu Science Park, Hsinchu, Taiwan, R.O.C. TEL: +886-3-5799500 FAX: +886-3-5799558 Email: support@asix.com.tw Web: https://www.asix.com.tw Copyright (C) 2021-2024 Reserved by ASIX Electronics Corporation, All Rights Reserved.
Need help?
Do you have a question about the AX58400 and is the answer not in the manual?
Questions and answers