3. Extra credit1. Explanation
After getting the Wave shield, I've discovered that although the shield's hardware is "generally" compatible with the Mega board (e.g., the shield sits well on top of the Mega, ground and power pins are aligned, etc.), the pins used to communicate between the Mega and the shield must be remapped in software and unfortunately (for the time being) in hardware.
I've found most of the answers I was looking for by comparing the Duemilanove's and the Mega's schematics. There were two problems to solve:
a) the Duemilanove's SPI pins (used for communicating with the SD card) are located on digital pins 10, 11, 12 and 13. The Mega's SPI pins are 50, 51, 52 and 53, on the right side of the board, out of the shield's "reach".
b) The digital pins 2, 3, 4 and 5 used by the Mega board to communicate with the DAC (digital to audio converter) have a different software port mapping from the Duemilanove's.
NOTE: A more elegant (e.g. software-only) solution may be possible (see "3. Extra credit" below). For the time being, this works...
2.1 Close the Arduino IDE.
2.2 Download the two header files attached to this message: "dac.h" and "sd_raw_config.h", place them into arduino/hardware/libraries/AF_Wave/ replacing the original files.
2.3 Delete the ".o" object files sitting in the same directory.
2.4 Using diagonal cutters, clip the header pins connected to digital pins 11, 12 and 13 on the shield. See this picture: http://gregsadetsky.com/_files/ladyada- ... C_0093.JPG
2.5 Unsolder the jumper cable going from the "CCS" hole (next to the shield's reset button) to the digital pin 10 hole.
2.6 Make four 4-inch jumper cables; they should each be soldered on one side at: the "CCS" hole (see step 2.5), and the digital input/output holes 11, 12 and 13 on the shield. The other side of the four cables will connect with four of the Mega's digital pins. You should label the four cables with stickers.
See these pictures:
- http://gregsadetsky.com/_files/ladyada- ... C_0089.JPG
- http://gregsadetsky.com/_files/ladyada- ... C_0091.JPG
The cable going from the "CCS" hole on the shield connects with the digital pin 53 on the Mega.
The cable going from the digital input/output hole 11 on the shield connects with the digital pin 51 on the Mega.
The cable going from the digital input/output hole 12 on the shield connects with the digital pin 50 on the Mega.
The cable going from the digital input/output hole 13 on the shield connects with the digital pin 52 on the Mega.
2.7 You're done! You should be able to physically install the shield over the Mega, compile any example such as "PlayAllLoop", connect the Mega by USB and run it.
--------3. Extra credit
I'm a beginner, so be gentle:
Is there an easy / elegant way of running a "software" SPI interface (e.g., not using the Atmel chip's built-in MOSI, MISO, SCK, SS pins), but faking one by driving four arbitrary digital pins high and low, just like with the DAC?
If so, the digital pins 10, 11, 12 and 13 could be used to communicate with the SD card as they do in the case of the Duemilanove, and no hardware modifications would be necessary to use the Mega's SPI pins.