Skip to main content

Getting Started with PSoC 6 BLE Prototyping Kit and ModusToolbox

Main48_84013976425617d2dbe15b2a65d27590b29f3ab1.jpg

Hands on with CY8CPROTO-063-BLE and the flexible ModusToolbox platform.

The Cypress Semiconductor CY8CPROTO-063-BLE (181-2207) is a low cost solution for PSoC 6 development, with integrated USB programming, debugging and bridging capability. Together with ModusToolbox this provides a powerful platform with BSP, library and middleware support, that can either be used with a supplied Eclipse-based IDE, else driven via command line tools.

CYBLE-416045-02 EZ-BLE Creator

CYBLE_2abf42a93e138c0d3662ce93bb9a4451947749a1.jpg

The board is based around the CYBLE-416045-02 EZ-BLE module, which includes the following key features:

  • 150-MHz Arm® Cortex®-M4F CPU with single-cycle multiply (Floating Point Unit (FPU) and Memory Protection Unit (MPU))
  • 100-MHz Cortex-M0+ CPU with single-cycle multiply and MPU
  • 1 MB Application Flash with 32-KB EEPROM area and 32-KB Secure Flash
  • 288-KB SRAM with Selectable Retention Granularity
  • Up to 36 GPIOs with programmable drive modes, strengths, and slew rates (and any can be CapSense, analogue/digital)
  • Bluetooth 5.0 qualified single-mode module
  • I2S interface; up to 192 kilosamples (ksps) word clock
  • Two pulse-density modulation (PDM) channels for stereo digital microphones
  • Programmable analogue with ADC, DAC, 2x Op Amps, 2x comparators
  • 12 programmable logic blocks, each with eight macrocells and an 8-bit data path. Usable as drag-and-drop Boolean primitives (gates, registers), or as Verilog programmable blocks. Support for UART, SPI, S/PDIF and other protocols
  • ROM-based root-of-trust plus cryptography accelerators

This is provided in a convenient castellated module with screening, and rated for an industrial temperature range of -40C to +85C, with low power 1.71V to 3.6V operation. For further details, see the Cypress documentation.

Development kit

Kit1_55665fb975af32df5c498bdbdc0d81e9b2835c13.jpg

The kit comes supplied with an integrated USB programmer which can be broken off.

QuickStart_1c417b0b7f0d9f05d855ff9ee6b6c71d384d85ea.jpg

The reverse of the packaging features a Quick Start Guide, with handy pinouts for both the PSoC 6 board and the attached programmer.

There are two options available for PSoC 6 development. The first of these is PSoC Creator, a proprietary IDE that is only available on Windows and which supports a subset of PSoC 6 devices, along with other device families, such as PSoC 5LP and PSoC 4 etc. The second development platform is ModusToolbox, which is a collection of configuration tools, drivers, middleware libraries and operating system support, plus an optional IDE.

ModbusToolbox supports all PSoC 6 devices and is the preferred development platform. It is available for Windows, Mac and Linux, and can be driven by the command line and hence integrated with your favourite development tooling, else used with the optional Eclipse-based IDE.

We’ll be using ModusToolbox installed on a computer running Ubuntu 18.04.

Software setup

ModusToolbox_0aa6083752b6565f259660e51a540907896328db.jpg

First we need to download the ModusToolbox software from the Cypress website. To install this on Linux we then took the following steps:

$ tar xvf ModusToolbox_2.1.0.1266-linux-install.tar.gz
$ cd ModusToolbox
$ sudo tools_2.1/openocd/udev_rules/install_rules.sh
$ sudo tools_2.1/driver_media/install_rules.sh
$ sudo tools_2.1/fw-loader/udev_rules/install_rules.sh
$ sudo tools_2.1/modus-shell/postinstall

If running Ubuntu 18.xx we are also instructed to install an additional package:

$ sudo apt-get install libusb-0.1-4

If our user is not already a member of the dialout and plugdev groups, it must be added to these.

$ sudo usermod -a -G dialout,plugdev $USER

Following which it is necessary to log out and back in again for the new groups to be picked up.

Note that comprehensive instructions can be found in the Installation Guide.

We can now launch the IDE with:

$ ./ide_2.1/eclipse/ModusToolbox

NewApplication1_b566b3a340b870ace5887e03f3889f5365290043.jpg

Then use the Quick Panel to create a new application and from there select CY8CPROTO-063-BLE.

Creating an application

Examples_36fc03ca57c31751ea80cca8712919b20c4a7fe5.jpg

Once we’ve selected our module we are then presented with a list of example applications, which can be used to facilitate evaluation and as the basis for our own application. This includes one named Empty PSoC 6 App.

CreateEmpty_b8a5e729707f3f938a73c463a23b44882cb63e9d.jpg

If we select this and create, we will see the first command in the log window is:

ModusToolbox/tools_2.1/project-creator/bin/project-creator-cli --board-id CY8CPROTO-063-BLE --board-uri https://github.com/cypresssemiconductorco/TARGET_CY8CPROTO-063-BLE --board-commit latest-v1.X --app-id mtb-example-psoc6-empty-app --app-uri https://github.com/cypresssemiconductorco/mtb-example-psoc6-empty-app --app-commit latest-v1.X --user-app-name Empty_PSoC6_App --target-dir /home/andrew/mtw --output-for-machine --use-modus-shell

Hence the command being run in the background is project-creator-cli and with options to specify the module and a GitHub URL for its BSP, along with GitHub URL for the example app. Following which repositories are cloned and libraries are imported.

ExampleEmpty_7e67e36360b767588bf81a8017809aee48f0278c.jpg

We can now navigate the project hierarchy via the Project Explorer, where we find main.c and libraries etc. If we expand the libs folder, the folder for our target, following this the BSP folder and within this GeneratedSource.

DesignModus_ea47e13a4f3292584baa8de9011576fdb9f9afba.jpg

At this point if we now double-click on the design.modus file.

DeviceConfigurator_1_2de6ca85f17e71afd14e9840572223fb5f778efc.jpg

This brings up the Device Configurator application, within which we can configure the PSoC resources, such as peripherals, routing and clocks.

DeviceConfigurator_2_7ef3248e821406156a7a2720849d32569a913a1d.jpg

We could easily dedicate an entire blog post to looking at the configuration options and functionality provided here

LibraryManager_4ec300148923a4873dc0ddd70f6072f298f25e60.jpg

We can also launch the Library Manager via the Quick Panel, which we can then use to configure the included libraries, along with middleware. One nice feature being FreeRTOS support, which can be configured by selecting this from the middleware list.

For further information, see Getting Started with PSoC 6 MCU on ModusToolbox, which covers many of the steps in more detail, with a worked example on how to get started writing firmware and making use of BSP/HAL/middleware functions. Also, the Device Configurator Guide, which covers configuration of device peripherals.

Running an example

SelectAppBLEBatt_5a512df686fadbd05d0bf44c5ef5fb7bc8acab33.jpg

If we once again create a new application, but this time select the BLE Battery Level FreeRTOS example. This builds on top of FreeRTOS and implements a Bluetooth Low Energy GATT Server with Battery Service and Device Information Service. The battery level is simulated and changes continuously from 0 to 100 percent.

To build and program this we then return to the Quick Panel and select to launch BLE_Battery_Level_FreeRTOS Program (KitProg3).

ProgFail_2934d770cbabd744676cae28330c6ccae06701fb.jpg

Ah, it’s not happy with our programmer. No fear, this is simply because the kit as shipped has KitProg2 loaded and we need to upgrade the programmer firmware. This is done using the fw-loader command line utility and we can find details of this in Section 6 of the KitProg3 User Guide. The firmware loader release are available on GitHub and bundle the latest firmware.

DeviceList_e8c2cd7a8d56f313fded31b28333d5bbd3521dd8.jpg

If we first run this with the –device-list option we confirm that it is indeed running a KitProg2 firmware.

UpdateKP3_637e001e898655e1d48f9bb4ef54318cc20693f0.jpg

Then if we run with –update-kp3, the programmer is updated with the latest KitProg3 firmware.

ProgSucceed_1debd28531a66e41538a7ecb86438583a8f27a6e.jpg

Now if we launch the program task within ModusToolbox once again, this time it succeeds.

Next we installed the CySmart application on an Android device.

Devices1_b7bb64f1ed7bed1adee31bb17422767cc5d6a1e2.jpg

Upon starting the app and enabling Bluetooth, we could see the kit. Pressing SW1 on the board put it into pairing mode and we were then able to pair it with the Android device.

Battery5_d8aca20ae237f09af785be604881a385359ce086.jpg

At this point we could now see the simulated battery level.

Information1_3f29c0de13c31f688f5fedd3a450333b014a077e.jpg

And also the information provided by the Device Information Service.

Wrapping up

This was just a quick run through of the PSoC 6 development kit and using it with the ModusToolbox platform, but has hopefully served to give a flavour of both. The PSoC 6 packs a lot a features around a capable BLE enabled low power microcontroller platform; most notably, of course, programmable analogue and digital capabilities for which the PSoC is famed.

ModusToolbox builds on the remarkably flexible hardware to provide BSP, libraries and middleware which will further expedite development. Not only this, but with the option to use either a provided IDE, else your favourite IDE or text editor, and then to integrate your own tooling with a command line driven development flow and all the key resources hosted on GitHub.

Andrew Back

 

Open source (hardware and software!) advocate, Treasurer and Director of the Free and Open Source Silicon Foundation, organiser of Wuthering Bytes technology festival and founder of the Open Source Hardware User Group.