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
At The Core Design Challenge
  • Challenges & Projects
  • Design Challenges
  • At The Core Design Challenge
  • More
  • Cancel
At The Core Design Challenge
Blog Infineon Beverage Dispenser # 2 - Getting Started
  • 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: guillengap
  • Date Created: 9 Mar 2023 6:36 PM Date Created
  • Views 674 views
  • Likes 10 likes
  • Comments 3 comments
  • infineon
  • PSoCTm︎ 62 MCU
  • element14
  • modustoolbox
  • Embedded Systems
  • microcontroller
  • challenge
  • arm
Related
Recommended

Infineon Beverage Dispenser # 2 - Getting Started

guillengap
guillengap
9 Mar 2023
Infineon Beverage Dispenser # 2 - Getting Started

Table of Contents

  • Introduction
  • Getting Started
  • Adding CapSense Buttons
  • How to Configure The OLED Display
  • Device Assembly
  • Programming, Test and Troubleshooting
  • Summary

**********************************************************************************************************************

In this project we will use ModusToolbox 3.0 which has enhanced support for multi-core project workflow. The release features dual-core device support, a new graphical tool for customer board support package (BSP) development, infrastructure support for ModusToolbox Packs and backend system improvements.

image

About ModusToolbox software you can find the documentation here: https://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/

The PSoCTm 62S4 Pioneer Kit features the PSoCTm 62 MCU CY8C62x4 (CY8C6244LQI-S4D92) with: 150-MHz Arm® Cortex®-M4 and 100-MHz Arm Cortex-M0+ cores, 256KB of Flash, 128KB of SRAM, programmable analog blocks including two 12-bit SAR ADCs, programmable digital blocks, Full-Speed USB, a serial memory interface, a CAN-FD interface, and industry-leading capacitive-sensing with CapSenseTm.

Documentation: CY8CKIT-062S4

Below I show you the pinout of the PSoC 62S4 board.

image

In my opinion, the technical changes on this board were successful. This board is smaller than its previous version, so it can be more easily adapted to projects such as a robotic car where spaces are reduced. In my case it will be easier to adapt it to the beverage dispenser that I will develop.

Testing the Kit

As part of my post, I am going to carry out a simple test with the PSoC 62S4 board in order to verify its proper functioning. The example I'm going to use is CapSense buttons and Slider, since I plan to modify it in my final project. We start by creating a new application with ModusToolbox 3.0

image

Now we select the CY8CKIT-062S4 kit as shown in the image below:

image

Finally, I selected the CapSense buttons and slider app, and gave it a name as shown below:

image

We wait a few minutes and the application is shown below. The app shows us the README file with a tutorial of the application. 

image

By now, I don´t plan to make changes to the code. The led.c file controls the LED diode, the two Capsense buttons and the Capsense Slider.

/*******************************************************************************
* Header files includes
*******************************************************************************/
#include "cybsp.h"
#include "cyhal.h"
#include "led.h"

/*******************************************************************************
* Global constants
*******************************************************************************/
#define PWM_LED_FREQ_HZ    (1000000lu)  /* in Hz */
#define GET_DUTY_CYCLE(x)    (100 - x)

/*******************************************************************************
* Global constants
*******************************************************************************/
led_state_t led_state_cur = LED_OFF;
cyhal_pwm_t pwm_led;

/*******************************************************************************
* Function Name: update_led_state
********************************************************************************
* Summary:
*  This function updates the LED state, based on the touch input.
*
* Parameter:
*  ledData: the pointer to the LED data structure
*
*******************************************************************************/
void update_led_state(led_data_t *ledData)
{
    if ((led_state_cur == LED_OFF) && (ledData->state == LED_ON))
    {
        cyhal_pwm_start(&pwm_led);
        led_state_cur = LED_ON;
        ledData->brightness = LED_MAX_BRIGHTNESS;
    }
    else if ((led_state_cur == LED_ON) && (ledData->state == LED_OFF))
    {
        cyhal_pwm_stop(&pwm_led);
        led_state_cur = LED_OFF;
        ledData->brightness = 0;
    }
    else
    {
    }

    if ((LED_ON == led_state_cur) || ((LED_OFF == led_state_cur) && (ledData->brightness > 0)))
    {
        cyhal_pwm_start(&pwm_led);
        uint32_t brightness = (ledData->brightness < LED_MIN_BRIGHTNESS) ? LED_MIN_BRIGHTNESS : ledData->brightness;

        /* Drive the LED with brightness */
        cyhal_pwm_set_duty_cycle(&pwm_led, GET_DUTY_CYCLE(brightness),
                                 PWM_LED_FREQ_HZ);
        led_state_cur = LED_ON;
    }
}

/*******************************************************************************
* Function Name: initialize_led
********************************************************************************
* Summary:
*  Initializes a PWM resource for driving an LED.
*
*******************************************************************************/
cy_rslt_t initialize_led(void)
{
    cy_rslt_t rslt;

    rslt = cyhal_pwm_init(&pwm_led, CYBSP_USER_LED, NULL);

    if (CY_RSLT_SUCCESS == rslt)
    {
        rslt = cyhal_pwm_set_duty_cycle(&pwm_led,
                                        GET_DUTY_CYCLE(LED_MAX_BRIGHTNESS),
                                        PWM_LED_FREQ_HZ);
        if (CY_RSLT_SUCCESS == rslt)
        {
            rslt = cyhal_pwm_start(&pwm_led);
        }
        
    }

    if (CY_RSLT_SUCCESS == rslt)
    {
        led_state_cur = LED_ON;
    }

    return rslt;
}

/* [] END OF FILE */

I build the project, and the console show me that there are no errors.

image

To upload the code to the PSoC 62S4 board, click on Run -> Run configurations

image

Select KitProg3(MiniProg4) and click Run

image

This code example features a 5-segment CAPSENSE slider and two CAPSENSE buttons. Button 0 turns the LED ON, button 1 turns the LED OFF, and the slider controls the brightness of the LED as shown below.

image

Now we are ready to start the drink dispenser project. In the next post I will modify the code of this project to control the drink flow using the capsense buttons and a mini water pump. Thanks for reading this content!

  • Sign in to reply
  • javagoza
    javagoza over 2 years ago in reply to guillengap

    This year I am taking it easy, I am making up time for my running training that I had to stop due to an injury and continue learning about FPGAs at my own pace. I will learn from your experiences!

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

    Thanks for your comment! javagoza  I have had progress with the CY8CKIT-028-SENSE OLED display and I want to adapt it (it's a surprise!) ... There're not as many contests as before, but I hope to see you in Hackster or Hackaday Prize because you are competitive! ... Have a nice day!

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

    Thanks for sharing guillengap  Working with an eclipse-based development environment is very familiar to me. That encourages me to try one of these Infineon solutions in the future.

    • 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 © 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