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

Step 2.1: Configure USART Peripheral Library, USART Pins and USART Peripheral Clock

The USART will be used to print the application debug log and application output.

1

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

Click on the green_plus.png symbol beside SERCOM 2 to add the SERCOM instance 2 (SERCOM 2 PLIB) to the project.
sercom_selection_for_uart.png

Associate the STDIO tool to SERCOM instance 2 (USART) peripheral by right-clicking on the yellow diamond.

associate_stdio_to_sercom.png

2

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

usart_clock_config_5.png

Once the window is opened, scroll down to the SERCOM2_CORE peripheral and set GCLK2 (48 MHz) as the source clock to the SERCOM2 peripheral.

usart_clock_config_6.png

3

Select the SERCOM 2 Peripheral Library in the Project Graph and configure SERCOM2 on Configuration Options.

usart_sercom_setup.png

As this USART will be used to print the debug information and application output, the default baud rate of 115,200 Hz is enough. Verify the default baud rate is set to 115,200 Hz.

4

From the Project Graph tab, select Plugins > Pin Configuration to launch the Pin Configuration windows.

open_pin_configuration.png

Three new windows, Pin Diagram, Pin Table, and Pin Settings are opened in the project’s main window.

5

Select the Pin Settings tab of MCC and then scroll down to the pin numbers 29 and 30 and configure the two pins as below.

  • Configure Pin #29 as SERCOM2_PAD0 (USART_TX) i.e. PA12
  • Configure Pin #30 as SERCOM2_PAD1 (USART_RX) i.e. PA13
usart_sercom_pins_setup.png

The USART pins are configured as per the SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit virtual COM Port design.

Step 2.2: Configure Timer System Service with TC0 Timer Peripheral Library (PLIB) and verify its Peripheral Clock

The timer system service is needed to fulfill the shared timer by different tasks in the application.

1

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

Click on the green_plus.png symbol beside TC0 to add the Timer Counter instance 0 (TC0 PLIB) to the project.
add_tc0.png

Associate Timer System Service tool to TC0 peripheral by right-clicking on the yellow diamond.

associate_sys_time_to_tc0.png

2

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

tc0_clock_config_1.png

Once the window is opened, scroll down to the TC0, TC1 peripheral and verify GCLK1 (32 kHz) as the source clock to TC0 peripheral.

tc0_clock_config_2.png

3

Select and verify the default TC0 and Timer System Service configurations.

tc0_config.png
timer_sys_service_config.png

The Timer TC0 and Timer Service default configurations are sufficient to create a shared timer. Also, the timer counter value can able to change in application run time based on the task requirement.

Step 2.3: Configure TC3 Timer Peripheral Library (PLIB) and its Peripheral Clock

The timer TC3 is used to control the display backlight using the Timer compare PWM output.

1

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

Click on the green_plus.png symbol beside TC3 to add the Timer Counter instance 3 (TC3 PLIB) to the project.
add_tc3.png

2

In Clock Easy View, configure the GLCK Generator 4 block as shown below to generate a 1 MHz clock.

gclk4_clock_config.png

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

tc3_clock_config_1.png

Once the window is opened, scroll down to the TC2, TC3 peripheral and set GCLK4 (1 MHz) as the source clock to TC3 peripheral.

tc3_clock_config_2.png

3

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

tc3_config.png

The Timer TC3 is configured for 100 usecs compare period. Users can able to change the timer compare period in multiples of 100 usecs in run time using TC3 timer APIs.

4

Select the Pin Settings tab of MCC and configure the pin number 32 (PA15) GPIO Pin as shown here. This pin is configured as per the LCD hardware design of the SAM E51 Integrated Graphics and Touch Curiosity Evaluation kit. This TC3 waveform output will be used to control the LCD BackLight functionality.

tc3_wo_pin_setup.png

Step 2.4: Configure RTC Peripheral Library

The Touch Library uses the RTC timer as a counter, and the default RTC configuration is sufficient for Touch Library.

1

Under the left side tab Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > RTC.
Click on the green_plus.png symbol beside RTC to add the RTC PLIB to the project graph.
rtc_adding.png
Click image to enlarge.

2

From the Clock Easy View MCC plugin, verify that the RTC clock is set to run at a 1 kHz internal ultra-low-power clock.

When a module is added to the project graph, MCC automatically enables the clock to the module. The default RTC clock source is a 1 kHz internal ultra-low-power clock (OSCULP1K).

rtc_clock_setup.png

3

Select and verify the default RTC peripheral configuration.

rtc_configuration_setup.png



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.