Hello,
I'm working on an implementation of the HACK computer from Nand2Tetris. My experience has been almost all on the FPGA side so far. I have written a working CPU with keyboard input and VGA output, and now I want to use the AVR as a kind of bootloader. My goal is to load the computer's software from a file on an SD card using the Arduino SD library and then stream it to the FPGA which will copy it into the SRAM. Once the program is transferred, the AVR should tell the FPGA to begin executing it.
As a first step, I'm trying to get the CardInfo example to run and verify that it can read an SD card, but I haven't had much luck. My experience so far has been with Verilog programming in Xilinx ISE, so I'm completely new to Arduino programming. The card.init() call fails with SD_INIT_TIMEOUT. For now, I'm using a blank FPGA circuit. I suspect something is wrong with the Arduino pin assignments for the AVR and I'm not sure how to verify I have the correct pins. The example file only has a variable for configuring the CS pin:
const int chipSelect = 4;
The example file doesn't mention the SCK, MOSI, or MISO pins. I tried running CardInfo with the default value of chipSelect = 4. Then I tried chipSelect = 10. Neither of these values worked. I looked up the pin-out diagram here: http://papilio.cc/uploads/Papilio/Papilio DUO pinout for CC.pdf. This states that the chip select pin is D16. I'm not sure what this maps to in C++ code though; chipSelect = 16 did not work either. How can I determine what the correct pin number to use is? Do I also need to setup the SCK, MOSI and MISO pins somehow?
Thanks!
-Brandon