This blog post is the Part of PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - Review Product LinkProduct Link (Figure 1). This post is also related to previous ones so for better understanding kindly take a look at those too.

 

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - Kit Content

Figure 1: PSoC6 WiFi-BT Pioneer Kit (details)

 

Blinky LED

In the previous post we have learn how to successfully build and test the Hello World project based on UARTprintf example. Now we are going to build a Blinky Led project from scratch without using any example. In this example we will alternately blink the Red and Green part of onboard RGB led (LED5) (figure 2) at 1Hz with 500msec on and off duration. The schematic of LED5 on PSoC6 pioneer board is also shown in figure 3.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - onboard LED5

Figure 2: On board RGB LED on PSoC6 Pioneer board of PSoC6 WiFi-BT KIT

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Onboard RGB Led Schematic

Figure 3: Schematic diagram of Onboard RGB Led (LED5) (source: HERE)

It will help us in understanding the basic work flow of PSoC Creator code generation. After building the project we will also learn how to debug it using PSoC creator. All the step required to built a blinky led project without using any pre-build example are given below.

 

Create a New Project using Empty Schematic as project template

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Create New Project using Empty Schematic

Rename and Select the New Project Location (optional) and Click Finish to Create a new project with empty Schematic

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Rename and Select the New Project Location

New Project with Empty Schematic is Created Successfully and we will use these side panel to create a Blinky LED project

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - New Project with Empty Schematic is Created Successfully

Search for output and select Digital Output Pin from component Catalog and drag it to empty Schematic. We will add two digital output pins and then rename them to RED_Led and GREEN_Led

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Add Digital Output Pin on Empty Schematic

To Blink an LED we will use PWM module of PSoC6 mcu. So add a PWM component on TopDesign Schematic.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Add PWM component

To drive the PWM module we need some clock source therefore also add a clock component.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - ADD clock component to Drive PWM module

Change the Clock component configuration if you want to rename or change the Frequency otherwise leave as it is.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Change the Clock component configuration

Change the PWM component configuration such that we get a 1Hz PWM with 50% duty cycle

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Change the PWM component configuration such that we get a 1Hz PWM with 50% duty cycle

The complete TopDesign schematic after renaming and interconnecting all the components.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Final Schematic Design

After setting the clock and PWM component we will assign the physical pins to Digital output pins in TopDesign Schematic. Go to PIN assignment window under design wide resources

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Go to pin assignment window

Assign the Physical pins connected to Red and Green LEDs of onboard RGB Led (LED5)

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Assign the Physical pins attach to Red and Green LEDs

Add PWM_1_START(); in main() function before the forever for loop inside the main_cm4.c file

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Open the main_cm4.c file and add PWM1_start() in main function

Build the Project to check for any error and it will build successfully

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Build the Project

After successful build, program the Blinky Led Project to test on physical hardware. And will worked perfectly Now we modify the PWM period and duty cycle and verify the result on physical hardware.

PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - PSoC Creator - Program the Blink Led Project

Video