Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Incorrect SPI default pins for Arduino Zero #974

Open
vlacorre opened this issue Feb 27, 2024 · 0 comments · May be fixed by #976
Open

Incorrect SPI default pins for Arduino Zero #974

vlacorre opened this issue Feb 27, 2024 · 0 comments · May be fixed by #976
Labels

Comments

@vlacorre
Copy link

Hello,

Here the list of default pins for SPI for Arduino Zero seems to be misaligned with its default variant.h, variant.cpp and SPI.cpp.

The default SPI is:

  SPIClassSAMD SPI (&PERIPH_SPI,  PIN_SPI_MISO,  PIN_SPI_SCK,  PIN_SPI_MOSI,  PAD_SPI_TX,  PAD_SPI_RX);

with

#define PIN_SPI_MISO         (22u)
#define PIN_SPI_MOSI         (23u)
#define PIN_SPI_SCK          (24u)
#define PERIPH_SPI           sercom4
#define PAD_SPI_TX           SPI_PAD_2_SCK_3
#define PAD_SPI_RX           SERCOM_RX_PAD_0

which are, by default:

const PinDescription g_APinDescription[]=
{

  /**...**/

  // 22..24 - SPI pins (ICSP:MISO,SCK,MOSI)
  // ----------------------
  { PORTA, 12, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_12 }, // MISO: SERCOM4/PAD[0]
  { PORTB, 10, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_10 }, // MOSI: SERCOM4/PAD[2]
  { PORTB, 11, PIO_SERCOM_ALT, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_11 }, // SCK: SERCOM4/PAD[3]

  /**...**/
}

As a result, the default pins should be the ones on the ICSP header:
22 (MISO)
23 (MOSI)
24 (SCK)
and no default Chip Select (CS) pin.

Please correct me if I'm wrong. Maybe other boards are also misaligned, could be something to check.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants