Skip to content

About

Motor Demo Example -> Peripherals are manually configured. Motor_ctrl_lib 3.2 and MotorSuite 2.9.0

Resources

Stars

0 stars

Watchers

0 watching

Forks

Repository files navigation

Motor control demo - RAK-GaN_rev1

This code example demonstrates the sensorless and sensored solutions using Infineon's PSOC Control C3 MCU and Rutronik´s RAK-GaN Board.

  • Sensorless PMSM FOC with 3-shunt
  • Hall sensor-based PMSM FOC
  • Encoder-based PMSM FOC *needs to be testet
  • Hall sensor-based Trapezoidal Block Commutation (TBC) *needs to be testet

[Visit our RSS-Examples on GitHub.]"(https://github.com/RutronikSystemSolutions)"

Requirements

  • ModusToolbox™Download (ModusToolbox™ Setup)

  • Open ModusToolbox™ Setup and install

    • Motor Suite GUI: 2.9.0 or later
    • ModusToolbox™ Tools Package v3.8 or later
      • Motor_ctrl_lib : 3.2 or later (comes with the Tools Package)
  • RAK-GaN_rev1

  • JLINK-SEGGER

  • Programming language: C

Bild

PSOC™ Control C3 MCUs Overview

Supported toolchains (make variable 'TOOLCHAIN')

  • GNU Arm® Embedded Compiler v14.2.1 (GCC_ARM) – Default value of TOOLCHAIN

Hardware setup

RAK-GaN -Hardware Documents

DB42S03 -DB42S03-Datasheet (not included in the Kit)

How to Start

1. Create The Project in an IDE (to work later in source Code)

The ModusToolbox™ tools package provides the Project Creator as both a GUI tool and a command line tool.

Use Project Creator GUI
  1. Open the Project Creator GUI tool.

    There are several ways to do this, including launching it from the dashboard or from inside the Eclipse IDE. For more details, see the Project Creator user guide (locally available at {ModusToolbox™ install directory}/tools_{version}/project-creator/docs/project-creator.pdf).

  2. On the Choose Board Support Package (BSP) page, select a kit supported by this code example. See Supported kits.

    Note: To use this code example for a kit not listed here, you may need to update the source files. If the kit does not have the required resources, the application may not work.

  3. On the Select Application page:

    a. Select the Applications(s) Root Path and the Target IDE.

    Note: Depending on how you open the Project Creator tool, these fields may be pre-selected for you.

    b. Select this code example from the list by enabling its check box.

    Note: You can narrow the list of displayed examples by typing in the filter box.

    c. (Optional) Change the suggested New Application Name and New BSP Name.

    d. Click Create to complete the application creation process.

Use Project Creator CLI

The 'project-creator-cli' tool can be used to create applications from a CLI terminal or from within batch files or shell scripts. This tool is available in the {ModusToolbox™ install directory}/tools_{version}/project-creator/ directory.

Use a CLI terminal to invoke the 'project-creator-cli' tool. On Windows, use the command-line 'modus-shell' program provided in the ModusToolbox™ installation instead of a standard Windows command-line application. This shell provides access to all ModusToolbox™ tools. You can access it by typing "modus-shell" in the search box in the Windows menu. In Linux and macOS, you can use any terminal application.

The following example clones the "Motor control demo" application with the desired name "FOCMotorDemo" configured for the KIT_XMC7200_DC_V1 BSP into the specified working directory, C:/mtb_projects:

project-creator-cli --board-id KIT_XMC7200_DC_V1 --app-id mtb-example-motor-control-solutions --user-app-name FOCMotorDemo --target-dir "C:/mtb_projects"

The 'project-creator-cli' tool has the following arguments:

Argument Description Required/optional
--board-id Defined in the field of the BSP manifest Required
--app-id Defined in the field of the CE manifest Required
--target-dir Specify the directory in which the application is to be created if you prefer not to use the default current working directory Optional
--user-app-name Specify the name of the application if you prefer to have a name other than the example's default name Optional

Note: The project-creator-cli tool uses the git clone and make getlibs commands to fetch the repository and import the required libraries. For details, see the "Project creator tools" section of the ModusToolbox™ tools package user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mtb_user_guide.pdf).

Open the project

After the project has been created, you can open it in your preferred development environment.

Eclipse IDE

If you opened the Project Creator tool from the included Eclipse IDE, the project will open in Eclipse automatically.

For more details, see the Eclipse IDE for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_ide_user_guide.pdf).

Visual Studio (VS) Code

Launch VS Code manually, and then open the generated {project-name}.code-workspace file located in the project directory.

For more details, see the Visual Studio Code for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_vscode_user_guide.pdf).

Keil µVision

Double-click the generated {project-name}.cprj file to launch the Keil µVision IDE.

For more details, see the Keil µVision for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_uvision_user_guide.pdf).

IAR Embedded Workbench

Open IAR Embedded Workbench manually, and create a new project. Then select the generated {project-name}.ipcf file located in the project directory.

For more details, see the IAR Embedded Workbench for ModusToolbox™ user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mt_iar_user_guide.pdf).

Command line

If you prefer to use the CLI, open the appropriate terminal, and navigate to the project directory. On Windows, use the command-line 'modus-shell' program; on Linux and macOS, you can use any terminal application. From there, you can run various make commands.

For more details, see the ModusToolbox™ tools package user guide (locally available at {ModusToolbox™ install directory}/docs_{version}/mtb_user_guide.pdf).

Library Manager update

used SW Libs:

  • motor_ctrl_lib 3.2
  • emeeprom 2.7.0

Click "update"

2. Using MotorSuite as Stand Alone (only for Motor parameter tuning)
  1. start MotorSuite -Projekt --> open -Navigate to the folder: RAK-GaN_MotorDemoGUI
  • Open the project file xxx.imcsp (here are all relevant parameters for the specific Board and Motor)
  1. Flash the .hex file

  2. Select ELF File

  3. Start with tuning

  • [Tuning_Guide_Infineon]

ModusToolbox™ Motor Suite 2.9.0 or later

Launch the GUI

To launch the GUI, double-click on ModusToolbox™ Motor Suite in the Quick Panel.

TODO: Figure 2. Launch ModusToolbox™ Motor Suite

GUI - Getting started

  1. Project --> Open --> navigate to your project --> "GUI_MOTOR_DEMO_3_2_DB42C02" (only makes sense if you are using this Motor)
  2. or create a new one based by clicking on the RAK-GAN Board --> New Project

TODO: Figure 3. Getting started

GUI - Configurator

  1. In the GUI configurator, verify the establishment of J-Link connection in the right bottom corner indicated by the green LED.
  2. if not done via the IDE --> Flash the hex file and open the corresponded elf file.

Flash Firmware option.

  1. Select the Test Bench icon on the left panel to open the Test Bench window.

Figure 4. GUI - Configurator

Note that based on the selected build configuration, the configurator view shows the appropriate block diagrams and parameters.

By selecting each of the parameters in the parameter controls section, the corresponding block diagram for that specific parameter is shown to set that parameter.

To change the firmware parameters, stop the motor first from the test bench view.

There is a toggle switch on the upper right corner of the configurator view window to choose between seeing only basic parameters or advanced parameters.

The GUI can also invoke the firmware to auto-calculate the advanced parameters. See GUI's Help for more information.

GUI - Test Bench

Test Bench provides the option to control and monitor the motor parameters. Ensure the following:

  • Driver button: Enable/disable the drive

  • Potentiometer button:

    • Switch on for speed control of the motor by potentiometer (hardware).

    • Switch off for speed control of the motor by using the "Target Set" slider in the GUI (software).

TODO: Figure 5. GUI - Test Bench

GUI - Oscilloscope

ModusToolbox™ Motor Suite supports a high-speed oscilloscope to monitor any firmware variable. There are four channels available to monitor four variables at a time.
In the oscilloscope window, configure the Divider value and select AutoScale to get the optimum resolution.

Figure 6. GUI - Oscilloscope

Debugging

You can debug the example to step through the code.

In Eclipse IDE

Use the <Application Name> Debug (JLink) configuration in the Quick Panel. For details, see the "Program and debug" section in the Eclipse IDE for ModusToolbox™ user guide.

In other IDEs

Follow the instructions in your preferred IDE.

Using the code example

All Motor and Board related configurations are located in [ParamConfig.h]

All RAK-GaN Board specific integrations are located and documented in /RAK_GAN Folder

Known Issues

Workaround: edit in General.h line 156

Figure 7. Control methods

There are 23 different permutations of control type, control entity, feedback type, and startup methods that are supported, as shown in Figure 8. Additionally, both three-shunt and single-shunt configurations are supported, which result in more flexibility in supporting various applications. Note that you can either include or bypass the current loop when using TBC in TC mode. Bypassing the current loop can address low-cost BLDC applications with no shunts or ADCs.

How to Start with your own Motor-Setup

Here's a quick guide on how to get started with your own motor or setup.

Important Documents

Other resources

Infineon provides a wealth of data at www.infineon.com to help you select the right device, and quickly and effectively integrate it into your design.

Document history

Document title: – Motor control demo - RAK-GaN_rev1

Version Description of change
1.0.0 Code Example based on Motor_ctrl_lib 3.1 and MotorSuite 2.8.1
1.1.0 Andreas Heder RAK-GAN Code Example based on Motor_ctrl_lib 3.2 and MotorSuite 2.9.0

About

Motor Demo Example -> Peripherals are manually configured. Motor_ctrl_lib 3.2 and MotorSuite 2.9.0

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Contributors

Languages