2

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.

4
  • it looks like SERCOM1 could be configured as SPI on pins 11, 12, 13, but how do you want to use it?
    – Juraj
    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. 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/SamdSercom
    – Juraj
    May 31, 2023 at 4:09
  • guide for SPI by Adafruit learn.adafruit.com/…
    – Juraj
    May 31, 2023 at 4:09

1 Answer 1

-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.

3
  • 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/… 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..PA07
    – KIIV
    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
    May 31, 2023 at 2:23

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.