se051plugntrust 2.1.0.0
main.c File Reference

SE051 Plug n Trust Click example. More...

#include "board.h"
#include "log.h"
#include "se051plugntrust.h"

Macros

#define PARSE_BUF_LEN   0xFF
 
#define DATA_LEN   16
 
#define AES_DATA_SIZE   16
 
#define AES_KEY_SIZE   16
 

Functions

void application_init (void)
 
void application_task (void)
 
int main (void)
 

Detailed Description

SE051 Plug n Trust Click example.

Description

This application is showcasing basic functionality of SE051 Plug&Trust click board. It gets identify data from device, selects card manager and applet. Then checks free memory, reads all objects and deletes not reserved ones. After that showcases a few of functionality:

  • Generating random data,
  • Creating, reading and deleting binary objects,
  • Creating AES symmetrical key and cipher with it; In the end it is showcasing funcionality in the endless loop.

The demo application is composed of two sections :

Application Init

At the start it sets comunication interface to I2C and resets the chip, reads identifying data from device, and then selects card manager and applet. After that it reads free persistent memory, reads all objects and deletes objects that are not reserved by the Applet. Then it generates 2 byte of random data, and gets the version information from the Applet. That's followed up with creating binary object with 'MikroE' data inside. Then it checks if object is created and reads data back. After that, the object is deleted and it's checked if it still exists. Finally it creates 128AES key (16bytes), encrypts it and then decrypts data with that key, and in the end it deletes that key object.

Application Task

It generates 16bytes of data, writes it in binary object and then reads it back and displays on the USB UART. Then creates AES key and encrypts that generated data with it, and then decrypts it. In the end it deletes both AES key object and binary object that's created at the start of the task.

Note
For more information refer to documents from NXP: AN12413 and UM11225.
Author
Stefan Filipovic

Macro Definition Documentation

◆ AES_DATA_SIZE

#define AES_DATA_SIZE   16

◆ AES_KEY_SIZE

#define AES_KEY_SIZE   16

◆ DATA_LEN

#define DATA_LEN   16

◆ PARSE_BUF_LEN

#define PARSE_BUF_LEN   0xFF

Function Documentation

◆ application_init()

void application_init ( void )

< Logger config object.

< Click config object.

Logger initialization. Default baud rate: 115200 Default log level: LOG_LEVEL_DEBUG

Note
If USB_UART_RX and USB_UART_TX are defined as HAL_PIN_NC, you will need to define them manually for log to work. See LOG_MAP_USB_UART macro definition for detailed explanation.

◆ application_task()

void application_task ( void )

◆ main()

int main ( void )