Rapid Prototyping With 32-bit MCU-based Curiosity Nano Evaluation Kit using MPLAB Harmony v3 Software Framework: Step 3

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

Configure SPI Peripheral Library and SPI Pins

Under the Available Components tab, expand Peripherals > SERCOM.

Double-click on SERCOM1 to add the SERCOM instance 1 to the project.

SERCOM instance 1 added to the project

Figure 1

Select the SERCOM 1 Peripheral Library and configure it for the SPI Master protocol. Next, perform the following SPI configurations:

SERCOM 1 Peripheral Library configuration

Figure 2

  • The eINK Bundle Click board uses four lines for SPI and three more port pins for standby, reset, and data/config command control
  • The SERCOM1 (as SPI Master) Speed is set at 20 MHz to interact with the eINK Display. This helps the display refresh and update fast.
  • The Clock phase is set to sample the data on the trailing SCK edge and change on the leading SCK edge to meet the requirement of the eINK display
  • The Clock Polarity is set to SCK is high when idle, i.e when the channel is idle the clock stays high

Open the Pin Configuration tab by clicking MHC > Tools > Pin Configuration.

MHC > Tools > Pin Configuration menu

Figure 3

Select the MHC Pin Settings tab and sort the entries by Ports names.

Pin Settings tab

Figure 4

The mikroBUS™ socket #1 design schematics for the PIC32CM MC00 Curiosity Nano Evaluation Kit and the Curiosity Nano Base Board are shown in Figure 5.

Note: The highlighted (encircled red box) SPI lines coming onto the microbusBUS socket #1 connected to eINK bundle

mikroBUS socket #1 design schematics for the PIC32CM MC00 Curiosity Nano Evaluation Kit and the Curiosity Nano Base Board

Figure 5

  • Configure SPI MISO on PA16 (Pin #17)
  • Configure SPI clock (SCK) on PA17 (Pin #18)
  • Set Custom Name as "CLICK_EINK_BUNDLE_CS" (SPI Chip Select (CS)) on PA18 (Pin #19), Direction as Out, and Latch as High.
  • Configure SPI MOSI on PA19 (Pin #20)
Pins 17-20

Figure 6

The eINK Click bundle needs three additional pins for configuration and data exchange.
Configure these PORT pins needed by the eINK Click bundle in the MHC Pin Configurator as shown in Figure 7.

Design schematic that shows the Port pins needed by the eINK Click bundle

Figure 7

  • Set Custom Name as "CLICK_EINK_BUNDLE_DC", Direction as Out, and Latch as High on PA05 (Pin #6)
  • Set Custom Name as "CLICK_EINK_BUNDLE_BSY" and Direction as In on PA10 (Pin #13)
  • Set Custom Name as "CLICK_EINK_BUNDLE_RST", Direction as Out, and Latch as High on PA11 (Pin #14)
Pins 6, 13, and 14

Figure 8

This completes the configuration of the SPI peripheral library. The application code will use the SPI PLIB Application Programming Interfaces (APIs) to display the temperature and fan speed on the eINK display

Back to Top


Configure SysTick

Click on System in the project graph. Expand Cortex-M0+ Configuration > SysTick > Enable SysTick from the Configuration Options tab, and check the box next to Enable SysTick and Enable Interrupt.

Configuration Options pane

Figure 9

Enable the systick interrupt for 1 millisecond. The systick will provide a 1 millisecond interrupt every time, which is used to provide the timing requirement for Click boards

Back to Top