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

Last modified by Microchip on 2023/11/10 12:39

Configure USART Peripheral Library, Pins and Clock

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

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

Click on the green plus symbol green plus beside SERCOM 2 to add the SERCOM instance 2 (SERCOM 2 PLIB) to the project.

SERCOM selection for USART

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

Associate SERCOM to USART

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

USART clock config

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.

Configure USART clock

Select the SERCOM 2 Peripheral Library in the Project Graph and configure SERCOM2 on Configuration Options. 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.

USART SERCOM setup

From the Project Graph tab, select Plugins > Pin Configuration to launch the Pin Configuration windows. Three new windows, Pin DiagramPin Table, and Pin Settings are opened in the project’s main window.

Open pin configuration

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

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

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

USART SERCOM pins setup

Information

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

Back to Top


Configure Timer System Service and verify its Clock

The timer system service uses the TC0 Timer Peripheral Library (PLIB) and is needed to fulfill the shared timer by different tasks in the application.

Under the left tab Resource Management (MCC), go to Device Resources and expand Libraries > Harmony > Peripherals > TC. Click on the green plus symbol green plus beside TC0 to add the Timer Counter instance 0 (TC0 PLIB) to the project.

Add TC0

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

Associate SYS time to TC0

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

TC0 clock configuration

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

TCO clock configuration

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

Timer system service configuration

TC0 configuration

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.

Back to Top


Configure TC3 Timer Peripheral Library (PLIB) and Clock

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

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

Click on the green plus symbol green plus beside TC3 to add the Timer Counter instance 3 (TC3 PLIB) to the project.

Add TC3

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

Configure GCLK generator

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

Open peripheral clock configuration

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

Set source to TC3

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

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.

Configure TC3

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 waveform output pin

Back to Top


Configure RTC Peripheral Library

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

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

Add RTC

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

Select and verify the default RTC peripheral configuration.

RTC configuration

Back to Top