Live PhotoFrame Tutorial: Step 3

Step 3.1 - Enable and Configure the SD Card

In the MPLAB® Harmony Configurator (MHC) Options tab, expand the Harmony Framework Configuration > Drivers > SD Card selection tree. Check the Use SD Card Driver? box.

use_sdcard.png

After you check this box, all SD Card driver configuration options become visible. Note the Use SD Card Driver? selection option is now highlighted, indicating this selection has been changed from its default value.

1

Configure the Number of SD Card Clients to 2. This is because the SD Card will be accessed by the application code as well as the TCP/IP stack.

2

The SD Card driver has the Serial Peripheral Interface (SPI) protocol lying underneath. The SPI gets the clock from CLK_BUS_PERIPHERAL_2. Configure the Clock To Use to CLK_BUS_PERIPHERAL_2.

3

Micro SD Cards do not have a write protection pin on them. As we are using a micro SD Card for our application, we will have to disable this action. If this is not disabled, we will not be able to write anything to the SD Card. So, uncheck the Enable Write Protect Check? option.

4

For SD Cards operating in SPI mode, the DATA3/CD line of SD Card is used as a chip select line and the same is connected to port pin RB14. Configure the options Chip Select Port and Chip Select Port Bit to PORT_CHANNEL_B and PORTS_BIT_POS_14 respectively.

sdcard_config.png

Expand the following section to see descriptions of all SD Card configuration options.

Step 3.2 - Configure SPI driver

The SD Card is connected to one of the PIC32's SPI ports (SPI2). Configure the SPI driver used by the SD Card driver.

In the MHC Options tab, expand the Harmony Framework Configuration > Drivers > SPI selection tree. Note that when you checked the box beside the Use SD Card Driver? selection, MHC automatically checked the Use SPI Driver? box for you. Configure the SPI driver as shown:

spi_config.png

Expand the following section to see descriptions of all SPI driver configuration options.

Step 3.3 - Verify and Configure the SPI I/O Pins

Verify and Configure the I/O Pins used by the SPI module using the Graphical Pin Manager. Select the Pin Table tab and configure the SPI pins as shown:

spi_pin_mapping.png

SDI2 is not configured in the pin table because pin RD7 is shared between the SPI bus (SPI2) and Ethernet Transmit Clock (ETXCLK) of TCP/IP.
Pin RD7 is mapped to SDI2 in the application code.



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.