Digit Recognition AI/ML Application on SAM E51 IGAT Curiosity Evaluation Kit Using MPLAB® Harmony v3: Step 3
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 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.
Now, open the peripheral clock configuration by clicking on the Peripheral Clock Configuration button in the Clock Easy View window.
Once the window is opened, scroll down to the ADC0 peripheral and verify the GCLK0 (120 MHz) as the source clock to ADC0 peripheral.
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.
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.
If MCC prompts for Auto-connect for rtc and ptc, click on Yes to connect RTC and PTC components.
From the Project Graph tab, select Plugins > Touch Configuration to launch Touch Configurator.
A new window, Touch Configurator is opened in the project’s main window.
Once the window is opened, select Mutual Capacitance Sensing and click on the button to add 2D-Surface Sensor, also configure Horizontal and Vertical Channels as shown in Figure 11.
Click on the Pins tab and configure 2D Surface Pin Configuration on Surface Matrix View as shown.
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.
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.
Under Parameters > Surface, Surface Parameters such as Position Resolution, Deadband Percentage, Position Hysteresis, and Detect Threshold can be modified.
Configure Surface parameters as shown.
Under Parameters > Gesture, verify the default Gesture Parameters configured as shown.
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).
Configure Touch Library Input Driver
Associate Integrated Touch Driver to Touch Library by right-clicking on the yellow diamond.
Select the Integrated Touch Driver in the Project Graph and configure Integrated Touch Driver on Configuration Options.
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.
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 symbol beside CCL to add the CCL peripheral to the project.
Select the CCL in the Project Graph and configure CCL on Configuration Options.
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.
As per the electrical characteristics of CCL, provided in the SAM D5x/E5x Family datasheet, the CCL peripheral maximum running clock frequency is 100MHz.
Open the peripheral clock configuration by clicking on the Peripheral Clock Configuration button.
Once the window is opened, scroll down to the CCL peripheral and set GCLK3 (100 MHz) as the source clock to CCL peripheral.
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.