Skip to content

sensiml/psoc6-template-fw

Repository files navigation

SensiML PSoC 6 Template Firmware

This package contains a template project for the CY8CKIT-062S2-43012 and the CY8CKIT-028-SENSE kit using SensiML platform.

Requirements

  • ModusToolbox™ software v3.0 or later (tested with v3.0)
  • PSoC™ 6 Board support package (BSP) minimum required version: 4.0.0
  • Programming language: C
  • Associated parts: All PSoC™ 6 MCU

Supported toolchains (make variable 'TOOLCHAIN')

  • GNU Arm® embedded compiler v10.3.1 (GCC_ARM) - Default value of TOOLCHAIN
  • Arm® compiler v6.13 (ARM)
  • IAR C/C++ compiler v8.42.2 (IAR)

Supported kits (make variable 'TARGET')

Installation

For this demo, you need to:

  1. Download and install ModusToolBox.
  2. Sign up and download the SensiML toolkit by following the Getting Started instructions.

Usage

In order to compile and run the demo project on a CY8CKIT-062S2-43012 board, perform the following steps:

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

In Eclipse IDE for ModusToolbox
  1. Click the New Application link in the Quick Panel (or, use File > New > ModusToolbox Application). This launches the Project Creator 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 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. Optionally, change the suggested New Application Name.

  5. Enter the local path in the Application(s) Root Path field to indicate where the application needs to be created.

    Applications that can share libraries can be placed in the same root path.

  6. Click Create to complete the application creation process.

For more details, see the Eclipse IDE for ModusToolbox User Guide (locally available at {ModusToolbox install directory}/ide_{version}/docs/mt_ide_user_guide.pdf).

In Command-line Interface (CLI)

ModusToolbox provides the Project Creator as both a GUI tool and a command line tool to easily create one or more ModusToolbox applications. See the "Project Creator Tools" section of the ModusToolbox User Guide for more details.

Alternatively, you can manually create the application using the following steps:

  1. Download and unzip this repository onto your local machine, or clone the repository.

  2. Open a CLI terminal and navigate to the application folder.

    On Linux and macOS, you can use any terminal application. On Windows, open the modus-shell app from the Start menu.

    Note: The cloned application contains a default BSP file (TARGET_xxx.mtb) in the deps folder. Use the Library Manager (make modlibs command) to select and download a different BSP file, if required. If the selected kit does not have the required resources or is not supported, the application may not work.

  3. Import the required libraries by executing the make getlibs command.

Various CLI tools include a -h option that prints help information to the terminal screen about that tool. For more details, see the ModusToolbox User Guide (locally available at {ModusToolbox install directory}/docs_{version}/mtb_user_guide.pdf).

In Third-party IDEs
  1. Follow the instructions from the In Command-line Interface (CLI) section to create the application, and import the libraries using the make getlibs command.

  2. Export the application to a supported IDE using the make <ide> command.

    For a list of supported IDEs and more details, see the "Exporting to IDEs" section of the ModusToolbox User Guide (locally available at {ModusToolbox install directory}/docs_{version}/mtb_user_guide.pdf.

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

Operation

Capturing Sensor Data for Labelling

  1. Connect the board to your PC using the provided USB cable through the USB connector.

  2. Open a terminal program and select the KitProg3 COM port. Set the serial port parameters to 8N1 and 1000000 baud

  3. In source/app_config.h, ensure the mode is in DATA_CAPTURE_RUNNING_MODE to start capturing training data

    #define APPLICATION_RUNNING_MODE DATA_CAPTURE_RUNNING_MODE
    

    Optional: The default sensor being used in the Microphone, if you want to capture motion data instead change the SENSOR_SELECT_MODE to SENSOR_MOTION.

  4. Program the board using one of the following:

    Using Eclipse IDE for ModusToolbox
    1. Select the application project in the Project Explorer.

    2. In the Quick Panel, scroll down, and click <Application Name> Program (KitProg3_MiniProg4).

    Using CLI

    From the terminal, execute the make program command to build and program the application using the default toolchain to the default target. You can specify a target and toolchain manually:

    make program TARGET=<BSP> TOOLCHAIN=<toolchain>
    

    Example:

    make program TARGET=CY8CKIT-062S2-43012 TOOLCHAIN=GCC_ARM
    
  5. Open SensiML Data Capture Lab from your Desktop and sign-in with your credentials if needed

  6. Follow the steps outlined here to start capturing data.

  7. To label the data you have captured, follow the steps here.

Training a Model using SensiML

To train a model using captured data, please follow the guide here.

Deploying Knowledge packs to the PSoC62S2 WiFi BT board

For integrating the Knowledge pack to the PSoC62S2 WiFi BT board, follow the steps here