An open API service indexing awesome lists of open source software.

https://github.com/edgeimpulse/mtb-example-edgeimpulse-continuous-motion

Code example for ModusToolbox using the EdgeImpulse firmware for the PSoC 62S2 Pioneer Kit
https://github.com/edgeimpulse/mtb-example-edgeimpulse-continuous-motion

Last synced: about 2 months ago
JSON representation

Code example for ModusToolbox using the EdgeImpulse firmware for the PSoC 62S2 Pioneer Kit

Awesome Lists containing this project

README

        

# EdgeImpulse example of Continuous Motion Recognition using Infineon PSoC 6

Edge Impulse enables developers to create the next generation of intelligent device solutions with embedded machine learning. This repository contains the Edge Impulse firmware for Infineon PSoC 62 43012 Pioneer Kit with IoT SENSE Expansion Kit. This device supports all of Edge Impulse's device features, including ingestion, remote management and inferencing.

## Introduction

This project supports:
* Live inference using the [EdgeImpulse Studio](https://studio.edgeimpulse.com)
* Data ingestion with every sensor of the Infineon IoT Sense Expansion Kit (see Hardware)
- Innertial sensor, BMX160 Accelerometer
- Environmental sensor, DPS310 Barometer + Temperature sensor
- Microphone, Dual PDM Mics
* Sensor Fusion for Inertial and Environmental sensor
* Storing samples on the external NOR Flash using the QSPI inteface

## Requirements

### Software
- Install [ModusToolbox™ software](https://www.infineon.com/modustoolbox) v3.0 or later (tested with v3.0)
- Toolchain in the SDK is GNU Arm® embedded compiler v10.3.1

### Hardware

- Development board: [PSoC 62S2 Wi-Fi BT Pioneer Kit](https://www.infineon.com/cms/en/product/evaluation-boards/cy8ckit-062s2-43012/) (`CY8CKIT-062S2-43012`)
- Evaluation board: [Infineon IoT Sense kit](https://www.infineon.com/cms/en/product/evaluation-boards/cy8ckit-028-sense/) (`CY8CKIT-028-SENSE`)

## Quick start

EdgeImpulse offers a [getting started ML guide for the PSoC 62S2 Pioneer Kit](https://docs.edgeimpulse.com/docs/~/revisions/9dKGATK7EnFnYNRMlqcb/development-platforms/officially-supported-mcu-targets/infineon-cy8ckit-062s2)

## Using the code example

Create the project and open it using one of the following:

In Eclipse IDE for ModusToolbox™ software

1. Click the **New Application** link in the **Quick Panel** (or, use **File** > **New** > **ModusToolbox™ Application**). This launches the [Project Creator](https://www.infineon.com/ModusToolboxProjectCreator) tool.

2. Pick a kit supported by the code example from the list shown in the **Project Creator - Choose Board Support Package (BSP)** dialog.

When you select a supported kit, the example is reconfigured automatically to work with the kit. To work with a different supported kit later, use the [Library Manager](https://www.infineon.com/ModusToolboxLibraryManager) to choose the BSP for the supported kit. You can use the Library Manager to select or update the BSP and firmware libraries used in this application. To access the Library Manager, click the link from the **Quick Panel**.

You can also just start the application creation process again and select a different kit.

If you want to use the application 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. In the **Project Creator - Select Application** dialog, choose the example by enabling the checkbox.

4. (Optional) Change the suggested **New Application Name**.

5. The **Application(s) Root Path** defaults to the Eclipse workspace which is usually the desired location for the application. If you want to store the application in a different location, you can change the *Application(s) Root Path* value. Applications that share libraries should be in the same root path.

6. Click **Create** to complete the application creation process.

For more details, see the [Eclipse IDE for ModusToolbox™ software user guide](https://www.infineon.com/MTBEclipseIDEUserGuide) (locally available at *{ModusToolbox™ software install directory}/docs_{version}/mt_ide_user_guide.pdf*).

In command-line interface (CLI)

ModusToolbox™ software provides the Project Creator as both a GUI tool and the command line tool, "project-creator-cli". The 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™ software 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™ software installation instead of a standard Windows command-line application. This shell provides access to all ModusToolbox™ software 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 "project-creator-cli" tool has the following arguments:

Argument | Description | Required/optional
---------|-------------|-----------
`--board-id` | Defined in the `` field of the [BSP](https://github.com/Infineon?q=bsp-manifest&type=&language=&sort=) manifest | Required
`--app-id` | Defined in the `` field of the [CE](https://github.com/Infineon?q=ce-manifest&type=&language=&sort=) 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


The following example clones the "[EdgeImpulse Continuous Motion recognition](https://github.com/edgeimpulse/mtb-example-edgeimpulse-continuous-motion)" application with the desired name "ContinuousMotion" configured for the *CY8CKIT-062S2-43012* BSP into the specified working directory, *C:/mtb_projects*:

```
project-creator-cli --board-id CY8CKIT-062S2-43012 --app-id edgeimpulse-example-continuous-motion-recognition --user-app-name ContinuousMotion --target-dir "C:/mtb_projects"
```

**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™ software user guide](https://www.infineon.com/ModusToolboxUserGuide) (locally available at *{ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf*).

To work with a different supported kit later, use the [Library Manager](https://www.infineon.com/ModusToolboxLibraryManager) to choose the BSP for the supported kit. You can invoke the Library Manager GUI tool from the terminal using `make library-manager` command or use the Library Manager CLI tool "library-manager-cli" to change the BSP.

The "library-manager-cli" tool has the following arguments:

Argument | Description | Required/optional
---------|-------------|-----------
`--add-bsp-name` | Name of the BSP that should be added to the application | Required
`--set-active-bsp` | Name of the BSP that should be as active BSP for the application | Required
`--add-bsp-version`| Specify the version of the BSP that should be added to the application if you do not wish to use the latest from manifest | Optional
`--add-bsp-location`| Specify the location of the BSP (local/shared) if you prefer to add the BSP in a shared path | Optional


Following example adds the CY8CPROTO-062-4343W BSP to the already created application and makes it the active BSP for the app:

```
library-manager-cli --project "C:/mtb_projects/ContinuousMotion" --add-bsp-name CY8CPROTO-062-4343W --add-bsp-version "latest-v4.X" --add-bsp-location "local"

library-manager-cli --project "C:/mtb_projects/ContinuousMotion" --set-active-bsp APP_CY8CPROTO-062-4343W
```

In third-party IDEs

Use one of the following options:

- **Use the standalone [Project Creator](https://www.infineon.com/ModusToolboxProjectCreator) tool:**

1. Launch Project Creator from the Windows Start menu or from *{ModusToolbox™ software install directory}/tools_{version}/project-creator/project-creator.exe*.

2. In the initial **Choose Board Support Package** screen, select the BSP, and click **Next**.

3. In the **Select Application** screen, select the appropriate IDE from the **Target IDE** drop-down menu.

4. Click **Create** and follow the instructions printed in the bottom pane to import or open the exported project in the respective IDE.


- **Use command-line interface (CLI):**

1. Follow the instructions from the **In command-line interface (CLI)** section to create the application.

2. Export the application to a supported IDE using the `make ` command.

3. Follow the instructions displayed in the terminal to create or import the application as an IDE project.

For a list of supported IDEs and more details, see the "Exporting to IDEs" section of the [ModusToolbox™ software user guide](https://www.infineon.com/ModusToolboxUserGuide) (locally available at *{ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf*).

## Troubleshooting

### BMX160 chip ID

This project includes a modified version of the BMI160 library in order to have the expected CHIPID for the BMX160(0xD8) accelerometer on board the IoT SENSE Expansion Kit. The CHIPID was updated at BMI160_CHIP_ID in the `bmi160_defs.h` file.