element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • Community Hub
    Community Hub
    • What's New on element14
    • Feedback and Support
    • Benefits of Membership
    • Personal Blogs
    • Members Area
    • Achievement Levels
  • Learn
    Learn
    • Ask an Expert
    • eBooks
    • element14 presents
    • Learning Center
    • Tech Spotlight
    • STEM Academy
    • Webinars, Training and Events
    • Learning Groups
  • Technologies
    Technologies
    • 3D Printing
    • FPGA
    • Industrial Automation
    • Internet of Things
    • Power & Energy
    • Sensors
    • Technology Groups
  • Challenges & Projects
    Challenges & Projects
    • Design Challenges
    • element14 presents Projects
    • Project14
    • Arduino Projects
    • Raspberry Pi Projects
    • Project Groups
  • Products
    Products
    • Arduino
    • Avnet Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • Store
    Store
    • Visit Your Store
    • Choose another store...
      • Europe
      •  Austria (German)
      •  Belgium (Dutch, French)
      •  Bulgaria (Bulgarian)
      •  Czech Republic (Czech)
      •  Denmark (Danish)
      •  Estonia (Estonian)
      •  Finland (Finnish)
      •  France (French)
      •  Germany (German)
      •  Hungary (Hungarian)
      •  Ireland
      •  Israel
      •  Italy (Italian)
      •  Latvia (Latvian)
      •  
      •  Lithuania (Lithuanian)
      •  Netherlands (Dutch)
      •  Norway (Norwegian)
      •  Poland (Polish)
      •  Portugal (Portuguese)
      •  Romania (Romanian)
      •  Russia (Russian)
      •  Slovakia (Slovak)
      •  Slovenia (Slovenian)
      •  Spain (Spanish)
      •  Sweden (Swedish)
      •  Switzerland(German, French)
      •  Turkey (Turkish)
      •  United Kingdom
      • Asia Pacific
      •  Australia
      •  China
      •  Hong Kong
      •  India
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      • Americas
      •  Brazil (Portuguese)
      •  Canada
      •  Mexico (Spanish)
      •  United States
      Can't find the country/region you're looking for? Visit our export site or find a local distributor.
  • Translate
  • Profile
  • Settings
Connected Cloud Challenge
  • Challenges & Projects
  • Design Challenges
  • Connected Cloud Challenge
  • More
  • Cancel
Connected Cloud Challenge
Blog #2 Familiarizing with PSoC 6 (Hello World)
  • Blog
  • Forum
  • Documents
  • Polls
  • Files
  • Events
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: wanfp97
  • Date Created: 3 May 2020 5:54 PM Date Created
  • Views 1285 views
  • Likes 2 likes
  • Comments 0 comments
Related
Recommended

#2 Familiarizing with PSoC 6 (Hello World)

wanfp97
wanfp97
3 May 2020

This blog post give a simple example of how to interact with PSoC6 step by step.

 

BOM: PSoC6 WiFi-BT Pioneer Kit.

 

First of all, I have installed the ModusToolbox 2.1 version by following the ModusToolbox Installation Guide and read through the ModusToolbox User Guide.

 

I then started to test out the example code in the ModusToolbox 2.1.

image

Clicking New Application at the bottom left corner.

image

Choosing the Board Support Package(BSP):

In my case, I chose the BSP for CY8CKIT-062-WIFI-BT and clicked Next>.

 

 

image

Choosing a Starter Application:

There are various of Starter Application to assist a beginner like me. To get familiarize with the ModusToolbox 2.1, I chose a Hello World starter application.

The application name can be changed in the Application Name column if wished. In my case, I will just leave it as it be and click the Next> button and then Finish button to generate the application.

image

When the application is created completely, a README.md file that explains how the application works will show up.

Scroll down to the Operation part and follow the instruction to get the application works.

This application requires us to have a terminal program. In my case, I used Tera Term which can be downloaded here: teraterm-4.105.exe

image

After downloading and launching Tera Term, in the serial port section, choose KitProg3 and click OK button.

image

From the navigating tab, click Setup and choose Serial Port... , a Tera Term: Serial port setup and connection tab will pop up.

Set the speed to 115200, which is the baud rate of the PSoC 6 WiFi-BT Pioneer Kit and click New setting button.

 

image

Back to the ModusToolbox 2.1, in the Quick Panel, scroll to the Launches tab and click <application name> Program (KitProg 3) button to program and run the application.

image

The Tera Term will print these lines once the building and running process complete.

 

You don't have permission to edit metadata of this video.
Edit media
x
image
Upload Preview
image

Hello World testing on PSoC6

image

After testing the Hello_World application on PSoC6, it is good to look through the code to get familiarize with the functions which can be used to initialize the pin and peripherals of PSoC6.

In the Project Explorer, under Hello_World, there is a main.c file. Opening the main.c allows us to look through the code for the application.

 

Here are the few lines of code that I personally think that they are important so I marked them down for future usage.

 

cyhal_gpio_init(CYBSP_USER_LED, CYHAL_GPIO_DIR_OUTPUT, 
                             CYHAL_GPIO_DRIVE_STRONG, CYBSP_LED_STATE_OFF);

 

 

 

void timer_init(void)
 {
    cy_rslt_t result;
    const cyhal_timer_cfg_t led_blink_timer_cfg = 
    {
        .compare_value = 0,                 /* Timer compare value, not used */
        .period = LED_BLINK_TIMER_PERIOD,   /* Defines the timer period */
        .direction = CYHAL_TIMER_DIR_UP,    /* Timer counts up */
        .is_compare = false,                /* Don't use compare mode */
        .is_continuous = true,              /* Run timer indefinitely */
        .value = 0                          /* Initial value of counter */
    };

 

/* Configure timer period and operation mode such as count direction, 
       duration */
    cyhal_timer_configure(&led_blink_timer, &led_blink_timer_cfg);
    /* Set the frequency of timer's clock source */
    cyhal_timer_set_frequency(&led_blink_timer, LED_BLINK_TIMER_CLOCK_HZ);
    /* Assign the ISR to execute on timer interrupt */
    cyhal_timer_register_callback(&led_blink_timer, isr_timer, NULL);
    /* Set the event on which timer interrupt occurs and enable it */
    cyhal_timer_enable_event(&led_blink_timer, CYHAL_TIMER_IRQ_TERMINAL_COUNT,
                              7, true);
    /* Start the timer with the configured settings */
    cyhal_timer_start(&led_blink_timer);

 

static void isr_timer(void *callback_arg, cyhal_timer_event_t event)
{
    (void) callback_arg;
    (void) event;
    /* Set the interrupt flag and process it from the main while(1) loop */
    timer_interrupt_flag = true;
}

The functions are used to initialize the timer.

  • Sign in to reply
element14 Community

element14 is the first online community specifically for engineers. Connect with your peers and get expert answers to your questions.

  • Members
  • Learn
  • Technologies
  • Challenges & Projects
  • Products
  • Store
  • About Us
  • Feedback & Support
  • FAQs
  • Terms of Use
  • Privacy Policy
  • Legal and Copyright Notices
  • Sitemap
  • Cookies

An Avnet Company © 2025 Premier Farnell Limited. All Rights Reserved.

Premier Farnell Ltd, registered in England and Wales (no 00876412), registered office: Farnell House, Forge Lane, Leeds LS12 2NE.

ICP 备案号 10220084.

Follow element14

  • X
  • Facebook
  • linkedin
  • YouTube