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

Step 3.1: Configure SPI Peripheral Library and SPI Pins

1

Under the Available Components tab, expand Peripherals > SERCOM.

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

sercom1_selection.png
Figure 1

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

sercom1_setup.png
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

2

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

open_pin_configuration.png
Figure 3

3

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

sercom1_pins_setup_1.png
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

sercom1_pins_setup_2_schematic.png
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)
sercom1_pins_setup_2.png
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.

sercom1_pins_setup_3_schematic.png
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)
sercom1_pins_setup_3.png
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

Step 3.2: Configure SysTick

1

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.

systick_config.png
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



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.