The SPI port is there so you can use the SPI bus to communicate with chips that use it.
SPI is serial parallel interface. There are two data lines, one to and from the device, a clock line to keep them synchronized which is driven by the master device, and a chip/slave select line which is used to tell the slave that it should pay attention to the commands being given to it.
That port used to be the ISP or ICSP port. That stood for something like in-system programmer, or in-circuit serial programmer, I think. It too was an SPI port, but the Atmega chips could be programmed through SPI. The Zero cannot.
Also, as programming required a reset line, they included a reset pin on the ISP port. And now for some reason they've carried that forward to the Zero instead of putting a CS line on there, so if you need a CS for your device (which you don't usually if there's just one device connected to the bus) you'll need to choose another pin along the side of the board to do that. Oh, and btw, apparently the new ATN pin is intended to be used for that purpose, but any pin could be used and I believe the hardware CS pin for that port is A2. I don't know what difference it makes using the hardware pin or not. On the Atmega it used to be that if you used an SPI bus the hardware pin had to be set to an output regardless of whether it was used, so if you wanted to keep your options open you'd be best using the right pin, but I don't know that that's the case on ARM processors.
All Arduino boards have a header which allows you to use an Atmel programmer instead of programming through the Arduino USB port.
The Arduino Zero uses the Atmel SAMD21, which is an ARM chip, and so is programmed through a 10-pin JTAG interface (labeled as "JTAG" on the Zero board).
The header labeled "SPI" on the Zero board is there just for backwards-compatibility to any shields that used those pins for SPI communication. On the other Arduino boards (for example, the Uno) this header was used for programming, but it can't program the Zero board.
scswift:
The SPI port is there so you can use the SPI bus to communicate with chips that use it.
The SPI signals MOSI, MISO and SCK are also available on pins 11, 12 and 13, respectively.
Also, I'm concerned about the decision to have included this connector on the Zero because it's designed to supply 5 volts to the ICSP Vcc pin rather than the 3.3 volts the Zero runs on. If a device, or a shield happens to use this pin for power, it could then send a 5 volt logic signals back to the MISO pin which could damage the Zero. One example, of this is the Pixy camera which is designed to plug into the ICSP connector and run.
wholder:
Also, I'm concerned about the decision to have included this connector on the Zero because it's designed to supply 5 volts to the ICSP Vcc pin rather than the 3.3 volts the Zero runs on. If a device, or a shield happens to use this pin for power, it could then send a 5 volt logic signals back to the MISO pin which could damage the Zero.
Yeah, I would have liked to see the 5V pin on the SPI connector run at the board's logic level instead.
Also, if the intent is to have the ATN pin function as a CS pin for the SPI bus then I would have replaced the reset pin with that, since it is now an SPI connector, not an ISP connector.
wholder:
The SPI signals MOSI, MISO and SCK are also available on pins 11, 12 and 13, respectively.
Hi,
is that a difference between the Zero and the M0 Pro or Zero Pro (or how it might call now) from Ardunio.org? In their documentation you can finde:
"SPI: on the ICSP header. These pins support SPI communication using the SPI library. Note that the SPI pins are not connected to any of the digital I/O pins as they are on the Uno, They are only available on the ICSP connector. This means that if you have a shield that uses SPI, but does NOT have a 6-pin ICSP connector that connects to the M0 Pro's 6-pin ICSP header, the shield will not work."
I played around with the MicroSD breakout from Adafruit. I only could get it to work if I use SPI on the the SPI header. Pin 11-13 didn't work.
Those pins can be used for SPI - that is, the processor itself supports them - but the Arduino SPI library does not yet support their use. You would have to modify the pin definitions file, and maybe some other code as well.
scswift:
Those pins can be used for SPI - that is, the processor itself supports them - but the Arduino SPI library does not yet support their use. You would have to modify the pin definitions file, and maybe some other code as well.
Hmm, is that true? If so, I totally missed that detail. At lot of the SPI-specific documentation for the Arduino, such as the page on "Some things to keep in mind when using the SD Library" go out of their way to mention using pins 10 (SS), 11 (MOSI), 12 (MISO) and 13 (SCK) as the SPI interface. These exact pins on the Zero are setup like this, so I assumed that these would be what the SPI.h library would use, too. I think carrying this convention over from the UNO (and prior boards of this same form factor as the Zero) would have made a lot of sense. Then, for example, tutorials like this:
On the Uno the SPI pins are 10/11/12/13, on the Mega they are 50/51/52/53, on the Leonardo I
can't remember. On the Due 74/75/76/77. Basically on all previous boards the ICSP header has MISO/SCLK/MOSI so shields can find them whatever the board and they endevour
to keep pin 10 as a hardware SPI chip select (for instance on the Due this is the case although you
can use pins 4 and 52 as well)
So the combination of pin 10 and the ICSP header provides a standard place for SPI for shields
(although most boards allow any pin as a CS anyhow (the Due is different))