I am looking at the documentation for the Arduino Zero, and I am a little confused.
It indicates that pins 13, 12, and 11 can be used for CIPO, COPI and SCK, but using SPI.begin()
puts the signals on the 6-pin header SPI pinout, which makes sense since it is designated for SPI.
Is there a way to switch to the digital pins via C code? Or do I need to edit the header files? We are using another board that can only attach to the digital pins.
-
it looks like SERCOM1 could be configured as SPI on pins 11, 12, 13, but how do you want to use it?Juraj– Juraj ♦2023年05月30日 19:53:20 +00:00Commented May 30, 2023 at 19:53
-
I am sending a 32-bit word to another device via SPI protocol, and want to use all the same functions as the 6-pin header on the default digital pins. I tried some pin mapping with the SERCOM but the code didn't seem to work.eramirez2024– eramirez20242023年05月30日 21:05:53 +00:00Commented May 30, 2023 at 21:05
-
the guide doesn't show how to use SERCOM for SPI, but similar approach as for Wire should work: docs.arduino.cc/tutorials/communication/SamdSercomJuraj– Juraj ♦2023年05月31日 04:09:28 +00:00Commented May 31, 2023 at 4:09
-
guide for SPI by Adafruit learn.adafruit.com/…Juraj– Juraj ♦2023年05月31日 04:09:51 +00:00Commented May 31, 2023 at 4:09
1 Answer 1
EDIT: Provably wrong answer below, see comments from though.
Unfortuantely the Arduino Zero doesn't support remapping of SPI pins as far as I know. Many other modern boards do, like the ESP8266/ESP32, but not the Zero, at least as far as I can tell.
-
That's really unfortunate if that's the case. Why would they include the SPI options on the digital pins on the documentation? Or is it just outdated? docs.arduino.cc/static/b1fbc77f1b73dcd9ac379af596e3472e/…eramirez2024– eramirez20242023年05月30日 19:49:37 +00:00Commented May 30, 2023 at 19:49
-
@eramirez2024 That it can't be remapped doesn't mean it has only one SERCOM, you can probably use another one. For example SERCOM0 is on pins PA04..PA07KIIV– KIIV2023年05月30日 21:06:01 +00:00Commented May 30, 2023 at 21:06
-
1@KIIV Apologies, I didn’t realize the Zero ran on the SAMD21, and I am not super knowledgeable about SERCOM, however I found this extremely relevant guide that may help (particularly pages 11-14) cdn-learn.adafruit.com/downloads/pdf/…kylemohr– kylemohr2023年05月31日 02:23:07 +00:00Commented May 31, 2023 at 2:23