After successfully integrating the FPGA code with ethernet and USB serial, I proceeded to create a test firmware to establish and verify a connection with a micro SD card. The first thing to note about this project is that the SD card is connected to the PIC32 through the FPGA, so the FPGA needs to be configured correctly before the SD card will work.

I started by adapting the existing code from the FPGA project. The functions that I used were mostly referred from the document help_harmony_v0_70b.pdf. The document contains information about some SD card functions and also examples, but it might be a bit outdated because it was written in 2013. The safest way was to refer to whatever function that is defined in drv_sdcard.h, which is generated when you choose the SD card driver in Harmony Configurator.

There are two FPGA projects, using Static and Dynamic SPI driver, both which I experimented with for the SD card project. I first verify that the FPGA is configured before testing out the SD card functions. For the dynamic driver, before I selected SD card driver in the Harmony Configurator, the FPGA worked fine. But after selecting it and loading the project into the board, I found that the digital pins were all set high instead, testing the SDO2 pin shows that data was still sent long after the FPGA was supposed to be configured, and the SCK2 pin was also sending a signal which is unlike a clock signal.

The static driver on the other hand successfully configured the FPGA. But testing with the SD card function shows that the initialization failed. Testing the Serial Clock SCK2 pin shows that it remains in a low state instead of a clock signal.