Digit Recognition AI/ML Application on SAM E51 IGAT Curiosity Evaluation Kit Using MPLAB® Harmony v3: Step 6

Last modified by Microchip on 2023/11/09 09:08

Configure TensorFlow Lite for Microcontroller

The TensorFlow Lite for Microcontroller (TFLite Micro) block is added to enable the TFLite Micro runtime engine and the TFLite Micro library to run the Digit Recognition Machine Learning Model on SAM E51 MCU.

Under the left tab Resource Management (MCC), go to Device Resources and expand Libraries > Third Party Libraries > Tensor Flow.

Click on the green plus symbol beside TFLite Micro to add the TFLite Micro library to the project.

Add TFLite Micro library

TFLite added

Select the TFLite Micro in the Project Graph and verify the default TFLite Micro library configuration on Configuration Options.


  • The CMSIS-NN Library check box enables the TFLite Micro library to override the default floating-point mathematical operations to use integer quantized CMSIS neural network functions.
  • This option works only when the model is converted to TFLite format with 8-bit integer quantization, and the CMSIS NN library package is added to the project; otherwise, the TFLite Micro library uses the default floating-point mathematical functions.

TFLite configuration

Configure CMSIS NN Package

The CMSIS is added by default to the project graph. Select the CMSIS in the Project Graph and configure the CMSIS pack on the Configuration Options.

  • CMSIS DSP software library is a set of common signal processing functions for use on Cortex®-M and Cortex-A processor-based devices.
  • The CMSIS NN is a software library, it is a collection of developed neural network kernels to maximize the performance and minimize the memory footprint of neural networks on Cortex-M processor cores. The library has several functions like,
    • Convolution Functions
    • Activation Functions
    • Fully-connected Layer Functions
    • SVDF Layer Functions
    • Pooling Functions
    • Softmax Functions
    • Basic math Functions

Also, the library has separate functions to work on different weight and activation data types including 8-bit integers and 16-bit integers.

  • These library APIs are used by the TFLite model to implement the machine learning capabilities in the application.

CMSIS configuration

Configure STDIO library

Ensure you add and configure the STDIO library to enable debug message printing on a serial console. This is needed to enable error message printing from the TFLte library, which maps the macro TF_LITE_REPORT_ERROR to the printf function.
STDIO is already configured with SECOM2 in Step 2.1