This blog post is the Part of PSoC® 6 WiFi-BT Pioneer Kit (CY8CKIT-062-WIFI-BT) - Review (Figure 1). This post is also related to previous ones so for better understanding kindly take a look at those too.
Figure 1: PSoC6 WiFi-BT Pioneer Kit (details)
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.
Figure 2: On board RGB LED on PSoC6 Pioneer board of PSoC6 WiFi-BT KIT
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
Rename and Select the New Project Location (optional) and Click Finish to Create a new project with empty Schematic
New Project with Empty Schematic is Created Successfully and we will use these side panel to create a Blinky LED project
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
To Blink an LED we will use PWM module of PSoC6 mcu. So add a PWM component on TopDesign Schematic.
To drive the PWM module we need some clock source therefore also add a clock component.
Change the Clock component configuration if you want to rename or change the Frequency otherwise leave as it is.
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.
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
Assign the Physical pins connected to Red and Green LEDs of onboard RGB Led (LED5)
Add PWM_1_START(); in main() function before the forever for loop inside the main_cm4.c file
Build the Project to check for any error and it will build successfully
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.