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

cross mob

Interfacing OPTIGA™ Trust M with a PSoC™ 6 device

Interfacing OPTIGA™ Trust M with a PSoC™ 6 device

250 sign-ins First comment on blog 50 solutions authored

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.



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


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


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.                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                                   

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.

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.



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.

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.