Skip to content

This code example demonstrates how to interface Infineon's S2GO RADAR BGT60LTR11 board with PSoC6™ via SPI using Eclipse IDE for ModusToolbox™. This code demonstrates the procedure to detect target motion and direction, as well as raw internal ADC readings.

Infineon/cce-mtb-psoc6-bgt60ltr11-spi-interface

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

S2GO RADAR BGT60LTR11 SPI mode using PSoC™ 6 MCU

Disclaimer: This is a community code example (CCE) released for the benefit of the community users. These projects have only been tested for the listed BSPs, tools versions, and toolchains documented in this readme. They are intended to demonstrate how a solution / concept / use-case can be achieved on a particular device.

This code example demonstrates how to interface Infineon's S2GO RADAR BGT60LTR11 board with PSoC6™ via SPI using Eclipse IDE for ModusToolbox™. This code demonstrates the procedure to detect target motion and direction, as well as raw internal ADC readings.

Provide feedback on this code example.

Requirements

  • ModusToolbox™ software v2.4.0 (tested with v2.4.0)

    Note: This code example version requires ModusToolbox™ software version 2.4 and may not be compatible with other versions

  • Board support package (BSP) minimum required version: 3.0.0

  • Programming language: C

  • Associated parts: All PSoC™ 6 MCU

Supported toolchains (make variable 'TOOLCHAIN')

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

Supported Sensor Boards

S2GO RADAR BGT60LTR11

Supported kits (make variable 'TARGET')

Hardware setup

This example requires the Infineon's S2GO RADAR BGT60LTR11 to be interfaced with PSoC™ 6 MCU using one of the supported kits.

Note: The PSoC™ 6 Bluetooth® LE pioneer kit (CY8CKIT-062-BLE) and the PSoC™ 6 Wi-Fi Bluetooth® pioneer kit (CY8CKIT-062-WIFI-BT) ship with KitProg2 installed. The ModusToolbox™ software requires KitProg3. Before using this code example, make sure that the board is upgraded to KitProg3. The tool and instructions are available in the Firmware Loader GitHub repository. If you do not upgrade, you will see an error like "unable to find CMSIS-DAP device" or "KitProg firmware is out of date".

Use jumper wires to establish a connection between S2GO RADAR BGT60LTR11 and the PSoC™ 6 Wi-Fi Bluetooth® pioneer kit as mentioned below.

  1. Connect 3.3V of sensor to 3V3 supply on the kit.
  2. Connect GND of sensor to GND of the kit.
  3. Connect the SPI lines - MOSI, MISO, CLK and CS of the sensor to P10[0], P10[1], P10[2], P10[3] respectively.
  4. Connect P_det and T_det to P9[0] and P9[1] of kit respectively.

Software setup

Install a terminal emulator if you don't have one. Instructions in this document use Tera Term.

This example requires no additional software or tools.

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 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. (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 (locally available at {ModusToolbox™ software install directory}/ide_{version}/docs/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.

This tool has the following arguments:

Argument Description Required/optional
--board-id Defined in the <id> field of the BSP manifest Required
--app-id Defined in the <id> 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

The following example will clone the "Hello world" application with the desired name "MyHelloWorld" configured for the CY8CKIT-062-WIFI-BT BSP into the specified working directory, C:/mtb_projects:

project-creator-cli --board-id CY8CKIT-062-WIFI-BT --app-id mtb-example-psoc6-hello-world --user-app-name MyHelloWorld --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 (locally available at {ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf).

In third-party IDEs

Use one of the following options:

  • Use the standalone Project Creator 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, and then import the libraries using the make getlibs command.

    2. Export the application to a supported IDE using the make <ide> 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 (locally available at {ModusToolbox™ software install directory}/docs_{version}/mtb_user_guide.pdf).

Operation

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

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

  3. Program the board using one of the following:

    Using Eclipse IDE for ModusToolbox™ software
    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. The default toolchain and target are specified in the application's Makefile but you can override those values manually:

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

    Example:

    make program TARGET=CY8CPROTO-062-4343W TOOLCHAIN=GCC_ARM
    
  4. After programming, the application starts automatically. Confirm that "PSoC 6 MCU: BGT60LTR11 RADAR example" is displayed on the UART terminal.

    Figure 1. Terminal output on program startup

  5. Confirm that the result corresponding to the selected appropriate output mode is displayed in the terminal at approximately 1Hz.

Debugging

You can debug the example to step through the code. In the IDE, use the <Application Name> Debug (KitProg3_MiniProg4) configuration in the Quick Panel. For details, see the "Program and debug" section in the Eclipse IDE for ModusToolbox™ software user guide.

Note: (Only while debugging) On the CM4 CPU, some code in main() may execute before the debugger halts at the beginning of main(). This means that some code executes twice – once before the debugger stops execution, and again after the debugger resets the program counter to the beginning of main(). See KBA231071 to learn about this and for the workaround.

Design and implementation

The example initializes the BSP and SPI using the driver APIs. It then initializes the BGT60LTR11AIP Radar sensor using the API's provided by the bgt60ltr11_mtb library. After successful initialization, it performs the corresponding function according to the selected mode, every 1 second. It then displays the output result on the serial terminal as shown in Figure 1.

Resources and settings

Table 1. Application resources

Resource Alias/object Purpose
BGT60LTR11 Radar object bgt60ltr11_obj BGT60LTR11 radar object including PSoC6 HAL specialization
UART (HAL) cy_retarget_io_uart_obj UART HAL object used by retarget-io for the debug UART port

Related resources

Resources Links
Application notes AN228571 – Getting started with PSoC™ 6 MCU on ModusToolbox™ software
AN215656 – PSoC™ 6 MCU: Dual-CPU system design
AN650 – BGT60LTR11AIP Radar Shield2Go
Code examples Using ModusToolbox™ software on GitHub
Device documentation PSoC™ 6 MCU datasheets
PSoC™ 6 technical reference manuals
Development kits Visit Evaluation Board Finder and use the options in the Search for Product section to filter kits by Product family or Design Type or Target Application.
Libraries on GitHub mtb-pdl-cat1 – PSoC™ 6 peripheral driver library (PDL)
mtb-hal-cat1 – Hardware abstraction layer (HAL) library
retarget-io – Utility library to retarget STDIO messages to a UART port
Middleware on GitHub psoc6-middleware – Links to all PSoC™ 6 MCU middleware
Tools Eclipse IDE for ModusToolbox™ software – ModusToolbox™ software is a collection of easy-to-use software and tools enabling rapid development with Infineon® MCUs, covering applications from embedded sense and control to wireless and cloud-connected systems using AIROC™ Wi-Fi and Bluetooth® connectivity devices.

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: CE221773 - PSoC™ 6 MCU: BGT60LTR11 RADAR example

Version Description of change
1.0.0 New code example

© 2023, Infineon Technologies. All rights reserved.

About

This code example demonstrates how to interface Infineon's S2GO RADAR BGT60LTR11 board with PSoC6™ via SPI using Eclipse IDE for ModusToolbox™. This code demonstrates the procedure to detect target motion and direction, as well as raw internal ADC readings.

Topics

Resources

Stars

Watchers

Forks

Packages

No packages published