Can someone explain how the SPI interface is supposed to work on the Zero? I've scratched my head bald, but I still can't figure out out. There are several mysteries I can't unravel:
1. On the
Zero Schematic, data pins 10-13 are labelled SS, MOSI, MISO and SCK, respectively, and are, in turn, connected to PA18, PA16, PA19 and PA17, also respectively. However, unlike on the UNO, and boards of a similar form factor to the Zero, these pins are not connected to the 6 pin, ICSP port. Instead, for the ICSP, MOSI connects to PB10 (pin 19), MISO to PA12 (pin 21) and SCK to PB11 (pin 20). However, in looking in the SPI.c/h and variant.h, it seems that it uses pin 23 (PA14) as MOSI, pin 22 (PA13) as MISO and pin 24 (PA15) as SCK). So, which set of pins are used by the SPI library?
2. I'm having trouble understanding the pin multiplexing architecture in the D21G. Since there are 6 independent SERCOM units in the D21G, it seems like there should be 6 different possible hardware SPI interfaces but, even after poring over the full, 1077 page data sheet, I can't seem to figure out how, for example, which pins correspond to SS, MISO, MISO and SCK for SERCOM2, or SERCOM3, etc. The data sheet has a table that shows how pins 13-16 connect to PAD[0] - PAD[3] of SERCOM2, but but is PAD[0] the MISO pin, or the MOSI pin? it doesn't to state this anywhere I've yet to find. I might have a better time understanding my issue #1 if I could figure out how pins map to specialized functions like the SPI pins.
3. Was the Zero signed to be backward compatible with things like
this tutorial that show using pins 10-13 as the SPI interface? Or, was the assumption made that only shields would need the SPI interface and would get to it via the ICSP port connector? It seems like it would have been possible to make the SPI Zero's SPI interface compatible with Arduino boards of the same form factor, such as the UNO, etc. Was this not done for some practical reason I'm not aware of?
Wayne