Step 3: With MHC, configure SDSPI Driver, SPI Peripheral Library, and SPI pins
1
Attach an SD Card Driver to the FILE SYSTEM service. Right-click the red square next to DRV_MEDIA to bring up a list of Satisfiers that can be used to attach to this component. Select the SD Card (SPI) driver by clicking on it.
Select Instance 0 of the SD Card (SPI) Driver and choose RB7 as the Chip Select Pin.
2
Attach an SPI peripheral (PLIB) to the SD Card Driver. Right-click on the yellow diamond next to SPI. From the Satisfiers list, select SPI2. This matches the hardware SPI peripheral of the WFI32E Module that is routed to the IO1 Xplained Pro's SD Card.
The SPI2 Component is now part of the Project Graph. Leave the configuration with default values.
3
Enable and configure the pins connected to the SPI2 Peripheral. Open MHC > Tools > Pin Configuration and select Pin Table. In addition to I2C and BSP pins you enabled during Lab 1, you should enable the following pins for SPI operations:
- SDI2 (Pin #B19) and SDO2 (Pin #B18) for SPI PLIB
- GPIO RB7 (Pin #A57) for SPI2 Chip Select
- GPIO RB2 (Pin #B51) for SD Card detect feature
Apply the following configuration in the Pin Settings tab:
- GPIO RB7 (Pin #A57) configured as Digital Output with high level by default
- GPIO RB2 (Pin #B51) configured as Digital Input with Change Notification and Pull-up both enabled