I am designing a new shield based on the AY-3-8910 (audio generator from the 80's). This is for the UNO (or compatible designs).
Anyway, the design calls for an SD card, shift register and a few control pins.
My initial thought was to either require another SD shield or add an SD reader to my shield.
Either way, the SD shield/add-on would use the standard SPI pins (10-13, IIRC).
The MCU will communicate with the AY sound chip via a 74*595 shift register.
For the shift register, I am using the following digital pins:
SI = 9
RCK = 8
SCK = 7
And on the AY, I need two pins (possibly a third later on to disable the chip but two for now):
BC1 = 6
BDIR = 5
Not counting the SD card, I am using between 5-6 pins.
This shield is a very niche product and I don't expect many will be made. Purely for hobbyist like me. And the AY is still pretty easy to find on eBay.
So, my questions are:
Does that pin combination seem logical?
Are there other, more popular shields that might use those pins?
Again, I don't expect people to be installing my shield along with several other shields but I'd like to be as compatible with other designs as possible.
Oh, for those that are wondering, this will be version 1 and I am purposely using a real, vintage AY chip. I realize I can emulate it with other devices. Version 2 will hopefully be more robust and use a different technique.
If you put on a SD card slot you should use the ICSP header pins for SPI. That will let the shield work on an Arduino MEGA and Arduino Leonardo as well as the Arduino UNO. See the Arduino Ethernet Shield for design tips.
Oh, I think I see what you're saying. So by using the ICSP pins for my SD/SPI connections, my shield would work with either the UNO or the MEGA/Leonardo series. Meaning they would physically fit.
Does this mean the other pins (10-13) would be free for other SPI devices? Does the UNO (or more accurately, the MCU) support two SPI buses?
Oh, and what about the SD library. How would I tell it to use the ICSP pins instead?
Sorry for so many questions.
I just noticed that the Ethernet Shield appears to have the holes filled in where the ICSP header would fit. I can't hardly tell by the picture but is that true? Which means the user would have to remove the solder? That can't be right.
The ICSP header is the right way to go for new shields. Unfortunately many existing shields don’t pass those pins through, so you can end up with problems where the newer shield must be stacked closest to the Arduino.
On most Arduinos (Uno, Mega) this doesn’t “free up” the 11-13 pins. They are connected on the Arduino board and can’t be disconnected. However on Due and possibly others, this does mean those pins are useable for something else. But not many shields take advantage of this because they don’t want to be Due-only.
Don’t think about popular shields. Think about what you might want to stack with your shield. Would you ever want to use an Ethernet shield? Does it make sense to use a motor shield as well as your audio shield?
If I’m planning a shield that might need its pins reassigned in the future, I put a row of header pin holes adjacent to the Arduino headers. They are connected straight across on the PCB but it’s possible to scratch off the PCB trace and wire it over to any other pin. A good example is Sparkfun’s Xbee shield or this Wifi shield from Adafruit.
Thank you. That was very helpful.
I have a million ideas for my first shield but I need to pull it back and finish a simpler one.
I've already built it on a breadboard so I guess I'm almost ready for the next step.
I will look into designing for the ICSP pins and include an SD slot too. That way, my shield will be ready out of the box to play VGM music.