By SD card working as stated in the title, I actually meant that it has only successfully established a connection to the SD card, and is far from being able to write to or read from the SD card. The connection is verified by sending a reset command to the SD card via SPI and reads for a valid response 0x01, this doesn’t make use of the SD card driver in the harmony configurator. If the pic32 reads the correct response it means the SD card is working.
When I started with the project the SD card wouldn’t work, checking the SD card using a signal analyzer shows that the SD card is responding, but somehow it wasn’t reaching the pic or the pic wasn’t reading the correct response. Through numerous tries I was finally able to get it working but still couldn’t figure out what went wrong.
It was when I was trying to integrate the project into the test firmware that I encountered the same problem again. I was sure the code was working, as it came from an already working project. I realized that it may be the same problem that I faced when trying to integrate the FPGA project into the test firmware, which is the Harmony configuration file. The solution was to replace the harmony configuration file in the test firmware project. I replaced it with the one from the SD card project which I knew was working, and I set the configuration to match that of the configurator file it replaced, i.e. exact same setting as the one it replaced. After that, the whole project worked, SPI for SD card and FPGA, USB CDC com port and ethernet.
After ensuring that all the capabilities are working, the next step was to set the cdc com port to output the results to a terminal emulator. To test for success of the FPGA configuration, SD card connection and Ethernet I checked the DONE pin, command CMD0 response. I also set the LEDs to toggle alternately if a valid IP is obtained && a valid CMD0 response is obtained && DONE pin is up. If the FPGA is configured, but SD card is not connected or network cable not connected or both, the red LED will remain on the whole time. If the FPGA fails to configure however nothing would happen as the FPGA actually polls for the DONE pin using a while loop.