Skip to content

This code example makes use of Matter on an Infineon PSoC™ 6 board to demonstrate its functionality as a Wi-Fi door lock device.

License

Notifications You must be signed in to change notification settings

Infineon/mtb-example-psoc6-matter-door-lock

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Matter PSoC™ 6 door lock example

This code example makes use of Matter on an Infineon PSoC™ 6 board to demonstrate its functionality as a Wi-Fi door lock device.

Requirements

  • ModusToolbox™ software v3.0 or later (tested with v3.0)
  • PSoC™ 6 board with 2 user buttons, 2 MB of Flash, and two user LEDs
  • PSoC™ 6 board support package (BSP) minimum required version: 4.0.0
  • Programming language: C/C++
  • Associated parts: All PSoC™ 6 MCU(https://www.infineon.com/PSoC6) parts

Supported toolchains (make variable 'TOOLCHAIN')

  • GNU Arm® embedded compiler v10.3.1 (GCC_ARM) - Default value of TOOLCHAIN

Supported kits (make variable 'TARGET')

CY8CKIT-062S2-43012

Software setup

Hardware setup

  • The board should be in KITPROG3 mode.
  • Check for the LED in the ON state (not blinking)
  • Connect the USB device to the host.

Using the CE

The Project can be created using any one of the following ways:

Using Eclipse IDE for ModusToolbox™ Follow the steps given here:

  1. Quick Panel --> New Application

  2. In the Project Creator Tool, choose a kit that is supported by the code example Project Creator --> Board Support Package (BSP) dialog.

  3. Click on the check box containing the example under Select Application

  4. Click Create.

Using the CLI

  1. Open the Project Creator from the Windows Start menu

  2. You could also choose {ModusToolbox™ software install directory}/tools_{version}/project-creator/project-creator.exe.

  3. Choose the required BSP, and click Next.

  4. Select the appropriate IDE from the Target IDE drop-down menu under the Select Application

  5. Click Create

  6. Export the application to the desired IDE. Refer to the ModusToolbox™ tools package user guide, "Using applications with third-party tools" chapter for details.

Setting up chip-tool

Once the application is running, set up chip-tool on Raspberry Pi 4 to perform commissioning and cluster control.

  • Set up python controller.

       $ cd {path-to-connectedhomeip}
       $ ./scripts/examples/gn_build_example.sh examples/chip-tool out/debug
    
  • Execute the controller.

       $ ./out/debug/chip-tool
    

Commissioning over Bluetooth® LE

Run the built executable and pass it the discriminator and pairing code of the remote device, as well as the network credentials to use.

     $ ./out/debug/chip-tool pairing ble-wifi 1234 ${SSID} ${PASSWORD} 20202021 3840

     Parameters:
     1. Discriminator: 3840
     2. Setup-pin-code: 20202021
     3. Node ID: 1234 (you can assign any node id)
     4. SSID : Wi-Fi SSID
     5. PASSWORD : Wi-Fi Password

Notes

Raspberry Pi 4 Bluetooth® LE connection issues can be avoided by running the following commands. These power cycle the Bluetooth® hardware and disable BR/EDR mode.

      $ sudo btmgmt -i hci0 power off
      $ sudo btmgmt -i hci0 bredr off
      $ sudo btmgmt -i hci0 power on

Cluster control

  • After successful commissioning, use the Lock Unlock cluster command to toggle device between Lock or Unlock states.

    $ ./out/debug/chip-tool door-lock lock 1234 1

    $ ./out/debug/chip-tool door-lock unlock 1234 1

  • Cluster Lock Unlock can also be done using the USER_BTN1 button on the board. This button is configured with APP_LOCK_BUTTON in include/AppConfig.h. Press USER_BTN1 on the board to toggle between lock and unlock states. The Lock/Unlock status of the door lock can be observed with 'Red LED' on the board. This LED is configured with LOCK_STATE_LED in include/AppConfig.h.

OTA software update

  • Over The Air (OTA) support can be included in the Wi-Fi door lock application by following either of these routes:

Using the Infineon OTA middleware library

The OTA library provides support for Over-The-Air update of the application code running on an Infineon device. The ModusToolbox OTA code examples import the ota-update library automatically. This application is built in ModusToolbox™ software, integrated with the OTA library.

For more information refer - [OTA_using_ModusToolbox] https://github.com/Infineon/ota-update

Using MATTER (project-chip repository)

Matter provides a system for OTA to be run as a provider requestor.

For further information, head to [Matter] https://github.com/project-chip/

PSoC™ 6 Deep Sleep

  • PSoC™ 6 can put to Deep Sleep for longer period of time by suspending Network stack and enabling WLAN Offload features using LPA.

  • Refer to LPA Quick Start Guide - Code Snippets for more information on APIs to be used.

  • Network stack suspend/resume logic should be added after Wi-Fi Connection is successfully established. This can be done in AppTask::Init function after starting DnssdServer.

    if (event->InternetConnectivityChange.IPv4 == kConnectivity_Established ||
        event->InternetConnectivityChange.IPv6 == kConnectivity_Established)
    {
        chip::app::DnssdServer::Instance().StartServer();
        //Create new task which calls wait_net_suspend API implemented in LPA
    }
  • Configure Various WLAN offloads using the ModusToolbox™ Device Configurator. Refer to LPA Quick Start Guide

Design and Implementation

Table 1. Application resources

Resource Alias/object Purpose
UART (HAL) cy_retarget_io_uart_obj UART HAL object used by retarget-io for the Debug UART port
GPIO (HAL) CYBSP_USER_LED User LED
GPIO (HAL) CYBSP_USER_BTN User button

Related resources

Resources Links
Application notes AN228571 - Getting started with PSoC™ 6 MCU on ModusToolbox™ software
AN215656 - PSoC™ 6 MCU: Dual-CPU system design
AN234334 - Getting started with XMC7000 MCU on ModusToolbox™ software
Code examples Using ModusToolbox™ software on GitHub
Device documentation PSoC™ 6 MCU device website
Development kits Visithttps://www.infineon.com/cms/en/design-support/tools/sdk/modustoolbox-software/#!designsupport.
Libraries on GitHub mtb-pdl-cat1 - Peripheral driver library (PDL)
mtb-hal-cat1 - Hardware abstraction layer (HAL) library
retarget-io - Utility library to retarget STDIO messages to a UART port
Middleware on GitHub capsense - CAPSENSE™ library and documents
psoc6-middleware - Links to all ModusToolbox™ middleware
Tools ModusToolbox™ tools package - ModusToolbox™ software is a collection of easy-to-use software and tools enabling rapid development with Infineon MCUs, covering applications from embedded sense and control to wireless and cloud-connected systems using AIROC™ Wi-Fi and Bluetooth® connectivity devices.

Other resources

Infineon provides a wealth of data at www.infineon.com to help you select the right device, and quickly and effectively integrate it into your design.

For PSoC™ 6 MCU devices, see How to design with PSoC™ 6 MCU - KBA223067 in the Cypress community.

Document history

Document title: CE236478 - Wi-Fi door lock

Version Description of change
1.0.0 New code example for Wi-Fi door lock
1.0.1 Removing "treat warnings as errors" build option


© Cypress Semiconductor Corporation, 2020-2023. This document is the property of Cypress Semiconductor Corporation, an Infineon Technologies company, and its affiliates ("Cypress"). This document, including any software or firmware included or referenced in this document ("Software"), is owned by Cypress under the intellectual property laws and treaties of the United States and other countries worldwide. Cypress reserves all rights under such laws and treaties and does not, except as specifically stated in this paragraph, grant any license under its patents, copyrights, trademarks, or other intellectual property rights. If the Software is not accompanied by a license agreement and you do not otherwise have a written agreement with Cypress governing the use of the Software, then Cypress hereby grants you a personal, non-exclusive, nontransferable license (without the right to sublicense) (1) under its copyright rights in the Software (a) for Software provided in source code form, to modify and reproduce the Software solely for use with Cypress hardware products, only internally within your organization, and (b) to distribute the Software in binary code form externally to end users (either directly or indirectly through resellers and distributors), solely for use on Cypress hardware product units, and (2) under those claims of Cypress’s patents that are infringed by the Software (as provided by Cypress, unmodified) to make, use, distribute, and import the Software solely for use with Cypress hardware products. Any other use, reproduction, modification, translation, or compilation of the Software is prohibited.
TO THE EXTENT PERMITTED BY APPLICABLE LAW, CYPRESS MAKES NO WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, WITH REGARD TO THIS DOCUMENT OR ANY SOFTWARE OR ACCOMPANYING HARDWARE, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. No computing device can be absolutely secure. Therefore, despite security measures implemented in Cypress hardware or software products, Cypress shall have no liability arising out of any security breach, such as unauthorized access to or use of a Cypress product. CYPRESS DOES NOT REPRESENT, WARRANT, OR GUARANTEE THAT CYPRESS PRODUCTS, OR SYSTEMS CREATED USING CYPRESS PRODUCTS, WILL BE FREE FROM CORRUPTION, ATTACK, VIRUSES, INTERFERENCE, HACKING, DATA LOSS OR THEFT, OR OTHER SECURITY INTRUSION (collectively, "Security Breach"). Cypress disclaims any liability relating to any Security Breach, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from any Security Breach. In addition, the products described in these materials may contain design defects or errors known as errata which may cause the product to deviate from published specifications. To the extent permitted by applicable law, Cypress reserves the right to make changes to this document without further notice. Cypress does not assume any liability arising out of the application or use of any product or circuit described in this document. Any information provided in this document, including any sample design information or programming code, is provided only for reference purposes. It is the responsibility of the user of this document to properly design, program, and test the functionality and safety of any application made of this information and any resulting product. "High-Risk Device" means any device or system whose failure could cause personal injury, death, or property damage. Examples of High-Risk Devices are weapons, nuclear installations, surgical implants, and other medical devices. "Critical Component" means any component of a High-Risk Device whose failure to perform can be reasonably expected to cause, directly or indirectly, the failure of the High-Risk Device, or to affect its safety or effectiveness. Cypress is not liable, in whole or in part, and you shall and hereby do release Cypress from any claim, damage, or other liability arising from any use of a Cypress product as a Critical Component in a High-Risk Device. You shall indemnify and hold Cypress, including its affiliates, and its directors, officers, employees, agents, distributors, and assigns harmless from and against all claims, costs, damages, and expenses, arising out of any claim, including claims for product liability, personal injury or death, or property damage arising from any use of a Cypress product as a Critical Component in a High-Risk Device. Cypress products are not intended or authorized for use as a Critical Component in any High-Risk Device except to the limited extent that (i) Cypress’s published data sheet for the product explicitly states Cypress has qualified the product for use in a specific High-Risk Device, or (ii) Cypress has given you advance written authorization to use the product as a Critical Component in the specific High-Risk Device and you have signed a separate indemnification agreement.
Cypress, the Cypress logo, and combinations thereof, WICED, ModusToolbox, PSoC, CapSense, EZ-USB, F-RAM, and Traveo are trademarks or registered trademarks of Cypress or a subsidiary of Cypress in the United States or in other countries. For a more complete list of Cypress trademarks, visit www.infineon.com. Other names and brands may be claimed as property of their respective owners.

About

This code example makes use of Matter on an Infineon PSoC™ 6 board to demonstrate its functionality as a Wi-Fi door lock device.

Topics

Resources

License

Stars

Watchers

Forks

Packages

No packages published