element14 Community
element14 Community
    Register Log In
  • Site
  • Search
  • Log In Register
  • About Us
  • 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 #3 Familiarize with Device Configurator
  • 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: 5 May 2020 11:56 AM Date Created
  • Views 3000 views
  • Likes 2 likes
  • Comments 4 comments
  • cypress modus toolbox
  • psoc 6
  • device_configurator
Related
Recommended

#3 Familiarize with Device Configurator

wanfp97
wanfp97
5 May 2020

Below are the materials that I have used in this blog, do prepare those items so you can follow what I have done if you wish so.

BOM: PSoC6 WiFi-BT Pioneer Kit, 1 LED, 1 potentiometer with resistance adjusted to around 300 ohm.

 

When I'm trying to find some step by step guide for PSoC6 online, I found the video below from Cypress's website.

https://www.cypress.com/video-library/PSoC/modustoolbox-101-lesson-2-3-pwm/610036

Unfortunately, I can't embed the video in this blog because the Service timed out! Please try again soon. error keep pooping out, so I have just put the link here.

 

In this video, Alan used a different way to mimic the Hello World application in the example code. I think this is a good approach to get myself familiarize with ModusToolbox and PSoC6.

You can read through this Device Configurator Guide to get yourself prepared before proceeding.

 

Following the guide, I opened up Device Configurator in ModusToolbox. Device Configurator is a Tool you can find in ModusToolbox to help you configure yr our pins, peripherals, clock frequency, and so on.

image

The Device Configurator can be found in the Quick Panel > Tools.

 

Below are some views in the Device Configurator:

image

image

You can configure the peripherals such as timer and peripheral-clocks in the Device Configurator.

image

 

First, I have clicked to the Peripheral-Clock tab to configure the peripheral clock.

I then chose a 16-bit divider for my peripheral clock and set the divider value to 10000 to get a 10kHz clock.

image

At the right bottom, you can click to Code Preview tab to see the code generated according to your parameter setting. You can look through it and copy it for further modification to implement in different type of cases.

 

image

I then go the Peripheral tab and chose to activate the TCPWM[0] 32-bit Counter 0 and named it tcpwm1. At the right hand side, you can adjust the parameters of the tcpwm1. In my case, I have set the period to 10000 and compare value to 5000. Since my peripheral clock is 10kHz, setting 10k count for my period and 5k count compare value will give me a 1Hz clock cycle and a 50% duty cycle. I have also assign the 16-bit Divider 0 clk that I have configure previously as the input Clock Signal.

image

I then scroll down to the Output section, and assign the pin for PWM_n(line_compl). You can look through the datasheet of your board and choose the pin that has the location that is most favorable for you. I have chosen the P9[7] in this case. Similarly, you can look through the code in the Code Preview if you wish so.

image

When I click to the Pins tab, I have notice that ModusToolbox have already setup the P9[7] for me, all I have to do is just give a name to the pin. You can ignore this step as ModusToolbox will use the default name for it and the application will still work anyway even though you don't name it.

 

The next thing you need to do is write a few line of codes in the main.c to initialize, enable, and start the tcpwm.

image

The relevant functions required to interact with the tcpwm can be found through the Open PWM(TCPWM) Documentation link found in the Device Configurator.

In my case, I included the "cycfg.h" header file and initialize the cycfg using the  added the 3 lines code below in the main.c and run it on the PSoC6.

    #include "cy_pdl.h"
    #include "cycfg.h"

 

    init_cycfg_all();
    Cy_TCPWM_PWM_Init(tcpwm1_HW, tcpwm1_NUM, &tcpwm1_config);
    Cy_TCPWM_PWM_Enable(tcpwm1_HW, tcpwm1_NUM);
    Cy_TCPWM_TriggerStart(tcpwm1_HW, tcpwm1_MASK);

 

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

And it works, a 1Hz blinking LED with 50% duty cycle using Device Configurator.

 

GitHub link: https://github.com/wanfp97/Hello-World-using-TCPWM

  • Sign in to reply

Top Comments

  • ankur608
    ankur608 over 5 years ago +1
    Nice progress.
  • DAB
    DAB over 5 years ago +1
    Nice update. DAB
Parents
  • DAB
    DAB over 5 years ago

    Nice update.

     

    DAB

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • wanfp97
    wanfp97 over 5 years ago in reply to DAB

    Thanks DAB

     

    Wan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Comment
  • wanfp97
    wanfp97 over 5 years ago in reply to DAB

    Thanks DAB

     

    Wan

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
Children
No Data
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