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

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

Configure Analog-to-Digital Converter (ADC) Peripheral Library (PLIB)

The Peripheral Touch Controller (PTC) acquires signals to detect a touch on the capacitive sensors. The sensor electrodes are connected to the analog front end of the PTC through the I/O pins in the device. When the PTC is enabled, it uses ADC0 exclusively for signal conversion and acquisition.

Under the left tab Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > ADC.

Click on the green plus symbol beside ADC0 to add the ADC instance 0 (ADC0 PLIB) to the project.

Associate PTC peripheral to ADC0 peripheral by right-clicking on the yellow diamond.

Associate PTC peripheral to ADC0

Add ADC0

Now, open the peripheral clock configuration by clicking on the Peripheral Clock Configuration button in the Clock Easy View window.

ADC0 clock config

Once the window is opened, scroll down to the ADC0 peripheral and verify the GCLK0 (120 MHz) as the source clock to ADC0 peripheral.

ADC0 clock configuration 2

Select the ADC0 Peripheral Library in the Project Graph and verify the default ADC0 configuration in the Configuration Options window.

As the ADC conversion output is fed to PTC peripheral, the default ADC configuration is enough to read the sensor analog inputs.

ADC0 configuration

Back to Top


Configure Touch Library - Peripheral Touch Controller (PTC)

The PTC channels output will be used by the Touch Library along with the RTC timer.

Associate Touch Library peripheral to PTC peripheral by right-clicking on the yellow diamond.

Associate touch library to PTC

 

If MCC prompts for Auto-connect for rtc and ptc, click on Yes to connect RTC and PTC components.

Auto-connect for RTC and PTC

Auto-connected PTC and RTC

From the Project Graph tab, select Plugins > Touch Configuration to launch Touch Configurator.

Touch configurator open

 

A new window, Touch Configurator is opened in the project’s main window.

Touch configurator

Once the window is opened, select Mutual Capacitance Sensing and click on the black x button button to add 2D-Surface Sensor, also configure Horizontal and Vertical Channels as shown in Figure 11.

Add 2d surface sensor

Click on the Pins tab and configure 2D Surface Pin Configuration on Surface Matrix View as shown.

Sensor pin configuration

Sensor pin configuration

 Click on the PTC lines to re-assign all the pins, the pins are assigned here as per the PTC interface design in SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit.
PTC interface design

Parameters Configuration

Click on the Parameters tab, under Channel, channel Parameters such as Filter Levels, Digital Gain, Analog Gain, Series Resistor, Charge Share Delay (CSD) (additional cycles), Prescaler, Threshold, Hysteresis, and Sensor Adjacent Key Suppression (AKS™) Group can be modified.

Configure Channel parameters as shown.

Channel configuration

Under Parameters > Sensor, Sensor Parameters such as Detect Integration, Away from Touch Recal Integration Count, Away from Touch Recal Threshold, Touch Drift Rate, Away from Touch Drift Rate, Drift Hold Time, Re-burst mode, Max ON Duration, Scan Rate, Acquisition Frequency and Noise Handling using Frequency Hop can be modified.

Configure Sensor parameters as shown.

Sensor configuration

Under Parameters > Surface, Surface Parameters such as Position Resolution, Deadband Percentage, Position Hysteresis, and Detect Threshold can be modified.

Configure Surface parameters as shown.

Surface configuration

Under Parameters > Gesture, verify the default Gesture Parameters configured as shown.

Gesture configuration

Select the Pin Settings tab of MCC and configure PTC interface GPIO Pins as shown in Figure 19. These pins are configured as the PTC interface design of SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit (The PTC interface design is shown above in Step 3.2, point number 4).

PTC interface pins

Follow these links for more details on Surface and Gesture Configurations:

Back to Top


Configure Touch Library Input Driver

Associate Integrated Touch Driver to Touch Library by right-clicking on the yellow diamond.

Associate touch driver touch library

Select the Integrated Touch Driver in the Project Graph and configure Integrated Touch Driver on Configuration Options.

 

Touch driver configuration

Select the Pin Settings tab of MCC and configure Touch LCD interface GPIO Pins as shown in Figure 22. These pins are configured as LCD interface design of SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit.

LCD interface pins

LCD interface

Back to Top


Configure Configurable Custom Logic (CCL) Peripheral Library (PLIB)

The CCL PLIB is to control the Display write pin by evaluating the logical expressions using touch input channels.

Under the left tab Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > CCL.

Click on the green plus symbol beside CCL to add the CCL peripheral to the project.

Add CCL

Select the CCL in the Project Graph and configure CCL on Configuration Options.

CCL configuration

In Clock Easy View, configure the Fractional Digital Phase Locked Loop 1 (FDPLL1), GLCK Generator 3 blocks as shown in the accompanying image to generate a 100 MHz clock.

FDPLL1 clock configuration

As per the electrical characteristics of CCL, provided in the SAM D5x/E5x Family datasheet, the CCL peripheral maximum running clock frequency is 100MHz.

GCLK3 clock configuration

Open the peripheral clock configuration by clicking on the Peripheral Clock Configuration button.

CCL clock configuration

Once the window is opened, scroll down to the CCL peripheral and set GCLK3 (100 MHz) as the source clock to CCL peripheral.

CCL clock configuration

Select the Pin Settings tab of MCC and configure the pin number 50 (PB23) GPIO Pin as shown in Figure 30. This pin is configured as per the LCD hardware design of the SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit. CCL output will be used to control the LCD Write functionality.

CCL pin setup

LCD WR pin schematic

Back to Top