Step 2: With MHC, Configure SD Card Driver, SPI Driver, and File System

Last modified by Microchip on 2024/01/26 19:09

Select the MPLAB® Harmony Configurator (MHC) Project Graph tab. Remember, if you ever “lose” the MHC tool, you can find it under Tools > Embedded > MPLAB Harmony 3 Configurator.

Add an SD Card (SPI) driver to your project from the Available Components window.

Expand the Harmony > Drivers > SDCARD tree and select the SD Card (SPI) driver.

SD_Card (SPI)

The SD Card (SPI) component block will be displayed in the Project Graph window as in the accompanying image.

SD card in project graph

Highlight the component block by clicking on it. The available configuration setting will be displayed in the Configuration Options window. For this project change the following:

  • SD Card Speed (Hz) to 20,000,000
  • Transfer Queue Size to 10
  • Chip Select Pin to RB14

SD card config


Attach a DRV_MEDIA to your SD Card driver.

Right-click on the yellow DRV_MEDIA attachment box. From the Satisfiers list, select FILE SYSTEM.

Select file system

Your Project Graph should now resemble the following screen.

File System in project graph

Click on the FILE SYSTEM component box to display the configuration options available for this component. Set Maximum Simultaneous File Access to 2.

File system configuration


Attach an SPI peripheral (PLIB) to your SD Card driver.

Right-click on the red diamond for the SPI Instance 0. From the Satisfiers list, select SPI2. This matches the hardware SPI peripheral that is routed to the SD Card controller on the MEB2 Expansion Card.

Attach SPI peripheral to SD card

Your Project Graph should now resemble the following screen.

Project graph

Click on the SPI2 peripheral to display the configuration options available for this component. Select Slave select SPI support is disabled and 2,000,000 Baud Rate.

Configure SPI


Save the MHC configuration by clicking the Save button.

Back to Top