Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

Interfacing OPTIGA™ Trust M with a PSoC™ 6 device

snehapra
Moderator
Moderator First like received First question asked 25 sign-ins
Moderator

Interfacing OPTIGA™ Trust M with a PSoC™ 6 device

In this blog, we will see how OPTIGATM Trust M can be interfaced with PSoC6 device. Connect the host microcontroller PSoC™6 to Shield2Go Security OPTIGA™ Trust M via the shielded I2C interface with an additional layer of security as shown in Figure 1.

snehapra_0-1658916738132.png

 


Figure 1 I2C connections between Shield2Go Security OPTIGA™ Trust M and PSoC™ 6 MCU

Hardware:

  • Any PSoC™ 6 device.
  • Shield2GO Security OPTIGA™ Trust M.

Software:

Follow these steps to interface OPTIGA™ Trust M with one of the following PSoC™ 62S2 evaluation kits, CY8CEVAL-062S2 or CY8CEVAL-062S2-LAI-4373M2:

  1. Launch ModusToolbox™ software.
  2. In the Eclipse IDE, click New Application from the Quick Panel.
  3. Select the Board Support Package (BSP) that you want to work with. See Getting Started with ModusToolbox™ to create applications.
  4.  Click the Peripherals dropdown and select the OPTIGA™ Cryptography template application and click Create as shown in Figure 2.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   
snehapra_1-1658916738139.png


Figure 2  Selection of OPTIGA™ Cryptography template application

  1. After the application is imported successfully, build and program the OPTIGA_Cryptography application to test the available examples.
  2. Tera Term displays the output, follow the steps in OPTIGA™: Cryptography to program the host MCU.

OPTIGA_Cryptography code examples in ModusToolbox™ software do not support PSoC™ 6 MCUs which do not have the OPTIGA™ Trust M kit package. The code examples can be cloned from the GitHub link. To import the application, follow these steps:

  1. Open New Application and select the relevant BSP that you want to work with, for example, CY8CPROTO-062-4343W.
  2. Click Import and select the example folder you cloned in Step 1.
  3. Select the imported code example from the Custom section, and click Create as shown in Figure 3.
snehapra_2-1658916738143.png


Figure 3   Selection of code example

  1. Change the supported hal library version to 1.6.0 by navigating to Library Manager > libraries > mtb-hal-cat1 (version: 1.6.0 release) and click Update.
  2. Add the OPTIGA™ Trust M library by navigating to Application Root Path > <mtb-example-optiga-crypto> > libs > mtb.mk file as shown in Figure 4.
  • Add SEARCH_optiga-trust-m=../mtb_shared/optiga-trust-m/release-v3.1.2  under # List of shared libraries.
  • Add SEARCH+=$(SEARCH_optiga-trust-m) under # Shared libraries added to build.

 

snehapra_3-1658916738145.png


Figure  4  Adding
OPTIGA™ Trust M library

  1. Modify the file optiga_lib_config_mtb.h of the source folder per the MCU datasheet to provide the right I2C pin details (CYBSP_I2C_SCL and CYBSP_I2C_SDA) as shown in Figure 5.
snehapra_4-1658916738147.png


Figure 5  Modifing optiga_lib_config_mtb.h

  1. Build the application after incorporating the above changes.
  2. Follow the steps mentioned in OPTIGA™: Cryptography to program the host MCU.

Note: Updating the libraries by running Library Manager or ‘make getlibs’ in the terminal will replace the changes in the ‘mtb.mk’ file.

This way, the OptigaTM can be interfaced with PSoC™ 6 MCU and the example applications can be tested using ModusToolbox™. There are several use cases of OptigaTM such as encryption, signature generation and verification, protected update etc., that are discussed in the following blogs in this series.