Digit Recognition AI/ML Application on SAM E51 IGAT Curiosity Evaluation Kit using MPLAB Harmony v3: Step3

Step 3.1: 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.

1

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

Click on the green_plus.png symbol beside ADC0 to add the ADC instance 0 (ADC0 PLIB) to the project.
add_adc0.png
Figure 1

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

associate_ptc_to_adc0.png
Figure 2

2

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

adc0_clock_config_1.png
Figure 3

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_config_2.png
Figure 4

3

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

adc0_config.png
Figure 5

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

Step 3.2: Configure Touch Library - Peripheral Touch Controller (PTC)

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

1

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

associate_touch_lib_to_ptc.png
Figure 6

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

autoconnect_to_rtc_nd_ptc.png
Figure 7
autoconnected_rtc_nd_ptc.png
Figure 8

2

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

touch_configurator_open.png
Figure 9

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

touch_configurator.png
Figure 10

3

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

4

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

sensor_pin_config_1.png
Figure 12
sensor_pin_config_2.png
Figure 13

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.png
Figure 14

Parameters Configuration

5

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 in Figure 15.

channel_config.png
Figure 15: Click on the image to full view

6

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 in Figure 16.

sensor_config.png
Figure 16

7

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

Configure Surface parameters as shown in Figure 17.

surface_config.png
Figure 17

8

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

gesture_config.png
Figure 18

9

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_setup.png
Figure 19

Follow the below links for more details on Surface and Gesture Configurations

Step 3.3: Configure Touch Library Input Driver

1

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

associate_touch_drvr_touch_lib.png
Figure 20

2

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

touch_drvr_config.png
Figure 21

3

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_design.png
Figure 22
lcd_interface_pins_setup.png
Figure 23

Step 3.4: 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.

1

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

Click on the green_plus.png symbol beside CCL to add the CCL peripheral to the project.
add_ccl.png
Figure 24

2

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

ccl_config.png
Figure 25

3

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

fdpll_1_clock_config.png
Figure 26: FDPLL1 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_config.png
Figure 27: GLCK Generator 3 Configuration

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

ccl_clock_config_1.png
Figure 28

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_config_2.png
Figure 29

4

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.

lcd_wr_pin_design.png
Figure 30
ccl_pin_setup.png
Figure 31



Next Step >

© 2024 Microchip Technology, Inc.
Notice: ARM and Cortex are the registered trademarks of ARM Limited in the EU and other countries.
Information contained on this site regarding device applications and the like is provided only for your convenience and may be superseded by updates. It is your responsibility to ensure that your application meets with your specifications. MICROCHIP MAKES NO REPRESENTATIONS OR WARRANTIES OF ANY KIND WHETHER EXPRESS OR IMPLIED, WRITTEN OR ORAL, STATUTORY OR OTHERWISE, RELATED TO THE INFORMATION, INCLUDING BUT NOT LIMITED TO ITS CONDITION, QUALITY, PERFORMANCE, MERCHANTABILITY OR FITNESS FOR PURPOSE. Microchip disclaims all liability arising from this information and its use. Use of Microchip devices in life support and/or safety applications is entirely at the buyer's risk, and the buyer agrees to defend, indemnify and hold harmless Microchip from any and all damages, claims, suits, or expenses resulting from such use. No licenses are conveyed, implicitly or otherwise, under any Microchip intellectual property rights.