Cypress has a new PSoC 6 tool in town and it's called ModusToolbox. ModusToolbox is a development environment for the PSoC which includes the PSoC SDK, ModusToolbox IDE and Cypress Programmer. The PSoC 6 SDK includes the standard Cypress tools such as PSoC PDL API (based on PDL 3.1), Middleware Libraries, Command-Line Tools, fw-loader, PSoC 6 MCU Configurators, CapSense and more.
Link to ModusToolbox site:
Image from the ModusToolbox Release Notes:
The PSoC 6 Software Library (psoc6sw-1.0) is comprised of two main pieces; Peripheral Device Library (PDL) and middleware/software libraries.
The main interface is the ModusToolbox IDE which is an Eclipse based product which means it includes the standard features of the Eclipse IDE plus some extra tools specific to the Cypress PSoC 6 devices.
The following is a partial list of some of the features available in the current release of ModusToolbox (1.0)
- PSoC 6 digital and analog peripheral drivers, which enable rapid peripheral software development
- The ARM Cortex Microcontroller Software Interface Standard (CMSIS) core access header files directly from the CMSIS 5.3.0 release
- CMSIS compliant device header files, startup code (platform initialization) and device configuration header files
- A Device Firmware Update library that can be readily integrated for any application need
- FreeRTOS source code integrated with the PDL
- Bluetooth Low Energy (BLE) middleware and stack library
- PDL Application Programming Interface (API) Reference Guide
Currently, ModusToolbox 1.0 supports all PSoC 6 MCU architecture devices.
The kits supported with this ModusToolbox version include:
- CY8CKIT-062-BLE PSoC+BLE
- CY8CKIT-062-WIFI-BT PsoC+WIFI+BT
- CY8CPROTO-062-4343W PSoC2M+WIFI+BT
NOTE: ModusToolbox requires KitProg3 so a firmware upgrade may be required.
GUI -based Configuration tools called Configuators are included as part of the SDK and can be run either from the ModusToolbox IDE or from command-line:
- Device Configurator: Set up the system (platform) functions, as well as the basic peripherals (e.g., UART and Timer, etc.).
- CapSense Configurator and Tuner: Configure CapSense, test it, and generate the required firmware.
- USB Configurator: Configure USB settings and generate the required firmware.
- QSPI Configurator: Configure external memory and generate the required firmware.
- BLE Configurator: Configure BLE settings and generate the required firmware.
- Smart I/O™ Configurator: Configure Smart I/O settings and generate the required firmware.
The following utilities are available with the SDK:
- CyMCUElfTool: Merges core executable images into a single file for programming / debugging.
- OpenOCD: Open On-Chip Debugger provides debugging, in-system programming, and boundary-scan testing for embedded target devices.
- Cypress KitProg Firmware Loader: Used to upgrade firmware on Cypress kits. It allows you to switch the KitProg firmware from KitProg2 to KitProg3, and back
- JRE: Java Runtime Environment
To install ModusToolbox, the tool can be downloaded from the Cypress web site at:
NOTE: ModusToolbox is only supported on the following 64-bit operating systems
NOTE2: There is no 32-bit support
- Windows 7 64-bit / Windows 10 64-bit
- macOS 10.13and 10.14
- Ubuntu Linux 16.04 LTS
After installing ModusToolbox, open the tool by double clicking the Desktop Icon; that is if running Windows and there is a shortcut created.
When ModusToolbox first starts, a slash screen appears.
After the splash screen appears, as in a standard Eclipse IDE, the user is prompted to either open or create a workspace.
NOTE: For users with a Cypress PSoC 6 BLE Pioneer Kit (CY8CKIT-062-BLE) earlier than rev 13, the startup file from the PDL folder must be replaced otherwise the code will not run on the kit.
See the data at the following link for info on how to perform this.
This will be located at the following location:
When ModusToolbox finally launches, it starts with a Welcome screen that includes links to help get started with the tool
If this page is closed. then the blank IDE screen can be seen where a new project can be created or imported from an existing project.
Under the Project Explorer Pane, there is a section with the ModusToolbox IDE logo in it. In this section, click on the Quick Panel tab and two Start options are shown; New Application and Search Online for Code Examples.
Click on New Application and a screen to Choose Target Hardware appears with an options for Dev/Eval Kit or Custom Hardware are seen.
The Custom Hardware option is for use when a new custom application is being created. The Dev/Eval Kit option can be used to access starter examples for the supported PSoC 6 boards.
In this example, the Dev/Eval Kit option will be used.
Once the Dev/Eval Kit option is selected, a screen will appear listing the supported board for ModusToolbox.
The CY8CKIT-062-BLE kit will be used in this example. Select CY8CKIT-062-BLE from the list and click Next.
The CE221120 - PSoC® 6 MCU SPI Master example is used in this post.
Download and unzip the file from the link and use Browse Button from the Starter Application window to select this modus.mk file and click open.
After clicking Open, the CE221120_HighLevelSPIMaster project will appear in the application selection pane.
Highlight this example and click next and the Summary window will appear.
If all looks correct, click Finish and the project will be loaded into the ModusToolBox IDE
From the imported project, 5 folders are created.
- CE221120_HighLevelSPIMaster_config - Contains the Design Configurator file design.modus
- CE221120_HighLevelSPIMaster_mainapp - Contains config files specific for the Cortex M4 core
- CE221120_HighLevelSPIMaster_mainapp_cm0p - Contains files specific for the Cortex M0 Plus core
- CE221120_HighLevelSPIMaster_mainapp_cm0p_psoc6pdl - Contains the M0 plus PDL files
- CE221120_HighLevelSPIMaster_mainapp_psoc6pdl - Contains the M4 PDL files
Since this is a Starter Project, there are a few items that need to be adjusted in the project before it will work with the PSoC 6 BLE Pioneer Kit.
There is a PDF document in the CE221120_PSoC6_SPIMaster titled CE221120_PSoC6_SPIMaster.pdf which describes the necessary changes required in the project.
This can be downloaded from the Cypress website as well:
The first thing to note is the Hardware Setup which notes the KitProg on the BLE Kit must be at rev KitProg3 before it can be used with the ModusToolbox.
Also, the Hardware Setup describes how to connect the Slave and Master SPI signals from the Arduino Headers on the kit.
In the Resources section of the CE221120 doc, the ModusToolbox Resource are shown. In particular a DMA Channel has to be added to the project with the Alias txDma.
For the CY8CKIT-062-BLE, a DMA DataWrite 0 Channel 0 is required.
To add a DMA channel ModusToolbox project, the Device Configuator is used.
This can be launched by either double clicking the 'design.modus' file or clicking 'Configure Device' under the ModusToolbox Quick Panel.
Once the Device Configurator is open, click the DMA tab to add a DMA Channel.
See Figure 4. txDma Resource Configuration from the CE221120 doc for the proper settings.
Once the DMA channel is added, this needs to assigned to the appropriate SBC. In this case it is the SPI Master SBC 2 where it is used to send the data to the SPI Slave. Also, note the other settings for SBC 2 as described in the CE221120 doc.
The SCBs can be accessed via the Peripherals Tab in the Device Configurator and assigning it to TX Trigger Output under Connections.
The SPI Slave SBC 1 connections are configured as follows.
The SBCs can be configured as either a EZI2C, I2C, SPI or UART from the drop down list box the right of the Communication listing of each SBC.
The KIT_LED2 (RED LED at LED9 Port 13 Pin 7) may need to be configured if not already set. This is used to indicate that the data transfer between the Mast and Slave SPI interfaces has completed. This is under the Pins tab in the Device Configurator tool.
The SBC and LED Pins assignments are as seen here:
Ensure the clocks listed under the Peripheral-Clocks tab are set as follows:
Under the Platform Tab, the Debug port assignment is set to SWD mode.
Once all of the changes are made in the Device Configurator, Save the changes and close the tool.
One note, as previously mentioned, before the project is built, it is best to replace the startup file with the updated one from the Cypress Community posting.
In the ModusToolbox IDE, it is best to clean the project if changes are made in Device Configurator to ensure no leftover configurations are still active. This can be performed by clicking
Clean CE221120_HighLevelSPIMaster Application
under the Quick Panel tab and CE221120_HighLevelSPIMaster_mainapp selection.
After cleaning the build, it is best to Rebuild the Index for each project folder. This is performed by right clicking on a project folder and selecting 'Index' Then 'Rebuild' to rebuild the Index. Then right click the project folder again and select 'Index' and then ' Update with Modified files'.
Then build the project. This can be performed by clicking
Build CE221120_HighLevelSPIMaster Application
under the Quick Panel tab and CE221120_HighLevelSPIMaster_mainapp selection.
Once the program builds successfully, there are two options the load the code on the PSoC 6 board; Debug or Program with either a J-Link or programmer or the builtin KitProg3 programmer. These are listed under Launches in the Quick Panel.
As in a typical Eclipse IDE, if the Debug option is used, then the Debug session will be started allowing the code to be stepped through one line at a time or adding a Breakpoint to stop the code at a particular point. If the example was configured properly, the KIT_LED2 will blink each time the code completes a loop through the data transfer or every 1 sec if the code is loaded on the board.
Example of a Debug session.
Once the code is running properly, the KIT_LED2 should blink every second indicating the data transfer was completed.
This is a quick video showing the example running on a PSoC 6 BLE Pioneer kit rev. 8.
The ModusToolbox 1.0 from Cypress is a very capable tool that adds and option to programming a PSoC 6 device using a standard IDE. The SCBs (Serial Communication Blocks) are quite useful and easy to set-up to add either a SPI, i2C, or UART to a project. I have just scratched the surface of this tool and plan to use it in a project I am working to see if will suite my purposes to program the PSoC. I have yet to test any C++ code with this, but I would suspect that it is an Eclipse based tool that C++ should be supported. That will be my next test with this.