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 & Tria Boards Community
    • Dev Tools
    • Manufacturers
    • Multicomp Pro
    • Product Groups
    • Raspberry Pi
    • RoadTests & Reviews
  • About Us
    About the element14 Community
  • 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
      •  Japan
      •  Korea (Korean)
      •  Malaysia
      •  New Zealand
      •  Philippines
      •  Singapore
      •  Taiwan
      •  Thailand (Thai)
      •  Vietnam
      • 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
At The Core Design Challenge
  • Challenges & Projects
  • Design Challenges
  • At The Core Design Challenge
  • More
  • Cancel
At The Core Design Challenge
Blog AtTheCore: Blog #1 - Intro and what's up with the kit!
  • Blog
  • Forum
  • Documents
  • Leaderboard
  • Polls
  • Files
  • Members
  • Mentions
  • Sub-Groups
  • Tags
  • More
  • Cancel
  • New
Join At The Core Design Challenge to participate - click to join for free!
  • Share
  • More
  • Cancel
Group Actions
  • Group RSS
  • More
  • Cancel
Engagement
  • Author Author: navadeepganeshu
  • Date Created: 2 Apr 2023 6:56 PM Date Created
  • Views 2102 views
  • Likes 10 likes
  • Comments 4 comments
  • infineon
  • element14
  • PSoC 62S4 pioneer kit
  • modustoolbox
  • challenge
Related
Recommended

AtTheCore: Blog #1 - Intro and what's up with the kit!

navadeepganeshu
navadeepganeshu
2 Apr 2023
AtTheCore: Blog #1 - Intro and what's up with the kit!

Hello! This is the first part of my project blog for this AtTheCore design challenge. What interested me in applying for this challenge is the extensive capability of PSoC6 controllers and devkit with fancy capsense, oboard sensors, and the theme of using dual-core which I thought would be a nice thing to explore and build on as I hadn't got hands on into this anytime. 

I am a final year undergrad majoring in Electrical Engineering with deep interests in embedded software and power electronics stuff. I currently work on batteries and management systems for them and have experience designing boards, writing up some code, and developing model-based designs + algorithms.

Table of Contents

  • Challenge goal
  • Example app - IPC semaphore, Capsense and ALS - M0, M4 projects
  • Doing IPC with pushbutton, LED, and sensor data
  • Code
  • References

Challenge goal

Through this challenge, I am looking to explore the dual-core capabilities of the controller using inter-process communication(IPC) and features of capsense utilizing PWM, ADC to do motor control. Initially, I had thought to use the PSoC creator studio and configure the blocks to set up different functionalities taking instances from one of my previous projects here at element14 DigitalFever: Stepper motor control with PSoC4. But the chip in CY8CKIT-062S4 doesn't have support on that software and also recommended tool is ModusToolbox for this challenge. So I got started with it and no wonder, it's an amazing platform providing flexibility in the configuration of peripherals, IOs, and classical eclipse-based coding environment. In one of the earlier roadtests, I had worked on a motor driver board IFX007T Motor Control Shield and will be utilizing it here for this application. I am planning to go with vertical implementation and to start off with:


Tool installation and getting started

The process of getting started with the kit was super easy and it also came with out of the box example showing CapSense and UART implementations. The development tool ModusToolbox installation is also straight forward (just that now I have yet one more new vendor-specific IDEs in the system)

image

{gallery}My Gallery

image

image

image

image


Example app - IPC semaphore, Capsense and ALS - M0, M4 projects

Next, I tapped into the example projects to understand how they're structured and shared. Apparently, any project involves Board Support Package(BSP) over which several libraries can be included based on user requirements with some being default and the super intuitive Library Manager in the Quick Panel window allows this. 

 image

image

The libraries added here are shared between projects by the ModusToolbox and a separate workspace folder called 'mtb_shared' is created. In case of dual-core applications, I saw that this shared inclusion is having some conflict with intellisense and always shows up a warning in header file inclusions and errors in using variables from the shared library which is said to be included properly with no warnings at the build, but the intellisense still keeps highlighting. Let me know if anyone else is seeing the same or has a solution.


Doing IPC with pushbutton, LED, and sensor data

Strating off with, I tried inter-process communication using semaphore. misaz 's roadtest post was a good reference there and I tried out what Jan Cumps mentioned about disabling the semaphore and seeing the chaos happen.

image

Next, I used the onboard ALS and Temperature sensors to get the data printed through UART with IPC on with the same game, but additional computations over CM4+ to acquire sensor data and stream out. This involved calling the UART print function inside the main for loop of CM4 side after enabling the semaphore and same remains on the CM0+ side. Checking if the button is pressed -> Enabling the semaphore -> Turning user LED ON -> UART Print -> Disabling the semaphore.

Code

CM4 side

        if (cyhal_gpio_read(CYBSP_USER_BTN) == CYBSP_BTN_PRESSED)
        {
        #if ENABLE_SEMA
            /* Attempt to lock the semaphore */
            if (Cy_IPC_Sema_Set(SEMA_NUM, false) == CY_IPC_SEMA_SUCCESS)
        #endif
            {
                /* Print a message to the console and turn Orange LED ON*/
                cyhal_gpio_write(CYBSP_USER_LED2, CYBSP_LED_STATE_ON);
                printf("Message sent from CM4\r\n");	/*UART transmit message*/

                /*Also send sensor data*/
    			/* Wait till printf completes the UART transfer */
    	        while(cyhal_uart_is_tx_active(&cy_retarget_io_uart_obj) == true);

				/* Print the temperature and the ambient light value*/
				printf("Temperature: %2.1lfC    Ambient Light: %d%%\r\n", temperature, light_intensity);
				printf("\n");

                cyhal_system_delay_ms(1000);
                cyhal_gpio_write(CYBSP_USER_LED2, CYBSP_LED_STATE_OFF);

            #if ENABLE_SEMA
                while (CY_IPC_SEMA_SUCCESS != Cy_IPC_Sema_Clear(SEMA_NUM, false));
            #endif
            }
        }

CM0+ side

for (;;)
{
    /* Check if the button is pressed */
    if (Cy_GPIO_Read(CYBSP_SW2_PORT, CYBSP_SW2_PIN) == 0)
    {
    #if ENABLE_SEMA
        if (Cy_IPC_Sema_Set(SEMA_NUM, false) == CY_IPC_SEMA_SUCCESS)
    #endif
        {
            /* Print a message to the console and turn Red LED ON */
            cyhal_gpio_write(CYBSP_USER_LED, CYBSP_LED_STATE_ON);
            Cy_SCB_UART_PutString(CYBSP_UART_HW, "Message sent from CM0+\r\n");		/*UART transmit message*/

            cyhal_system_delay_ms(1000);
            cyhal_gpio_write(CYBSP_USER_LED, CYBSP_LED_STATE_OFF);

        #if ENABLE_SEMA
            while (CY_IPC_SEMA_SUCCESS != Cy_IPC_Sema_Clear(SEMA_NUM, false));
        #endif
        }
    }
}

image

Further, I am working on the usage of CapSense and PWM control for motor control with IFX007T arduino shield and in the next blog, we'll explore how these can be put together and also how sensor data can be used to make a little more sense. Here I am enjoying the making challenge and thanks for reading through. Also, let me know what you think :)

References

CY8CKIT-062S4 BSP
PSoC 6 Peripheral Driver Library: PDL API Reference (infineon.github.io)
ModusToolboxTm Software - Infineon Technologies
CY8CKIT-062S4 - Infineon Technologies

Also Read:

 AtTheCore: Blog #2 - Interfacing LED Bar with ALS 

 AtTheCore: Blog #3 - PWM and Capsense on Cortex M0+ 

  • Sign in to reply

Top Comments

  • navadeepganeshu
    navadeepganeshu over 2 years ago in reply to skruglewicz +1
    Hi skruglewicz , Yes, that seems like a common issue with shared library in multicore project. Saw it in one of the Infineon documentation too - although the code runs successfully and this is resolved…
  • skruglewicz
    skruglewicz over 2 years ago in reply to navadeepganeshu

    hello navadeepganeshu, 

    I have not raised this issue on the forum yet.  I thought it was just me, but good to know someone else is seeing the same thing. I was suggesting that you could raise the issue on the Infineon developer forum at https://community.infineon.com/

    You need to create a developer account but it's a free resourse. You ask under the ModusToolbox catecory.. 

    If you have the time it doesn't take long and generally the questions are answered promptly. you could post the results here on your blog. Just a suggestion.

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • navadeepganeshu
    navadeepganeshu over 2 years ago in reply to skruglewicz

    Hi skruglewicz ,

    Yes, that seems like a common issue with shared library in multicore project. Saw it in one of the Infineon documentation too - although the code runs successfully and this is resolved on build, the IDE's intellisense tool doesn't reflect the inclusion of shared libraries. Great that you've raised about this in the forum. It would be great if you can share the link to your thread in the forum.

    • Cancel
    • Vote Up +1 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • skruglewicz
    skruglewicz over 2 years ago

    nice start,,, I have a similar problem as you experienced, but my code is working and I haven't had the time to analyze why it's happening.

    I have received great advice from the Infineon developer forum. at https://community.infineon.com/

    you will need to create an account, but it's worth it..

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
  • Digimorf
    Digimorf over 2 years ago

    Nice! 

    • Cancel
    • Vote Up 0 Vote Down
    • Sign in to reply
    • More
    • Cancel
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 © 2026 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