Step 3.1: 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.
Select the SERCOM 1 Peripheral Library and configure it for the SPI Master protocol. Next, perform the following SPI configurations:
- 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
Select the MHC Pin Settings tab and sort the entries by Ports names.
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
- 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)
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.
- 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)
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
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.
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