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

Grand Central M4 MOSI and SCLK Pins Swapped #284

Open
Rymar-Eng opened this issue Mar 3, 2021 · 0 comments
Open

Grand Central M4 MOSI and SCLK Pins Swapped #284

Rymar-Eng opened this issue Mar 3, 2021 · 0 comments

Comments

@Rymar-Eng
Copy link

It appears that these 2 pins are reversed, in variants/grand_central_m4/variant.h (line 180)

#define PIN_SPI_MOSI        (66)
#define PIN_SPI_SCK         (65)

From variant.cpp, in the rows for pins 65 and 66:

  { PORTD, 8, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_3 },   // MOSI
  { PORTD, 9, PIO_SERCOM, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_4 },   // SCK

Looking at the Grand Central M4 schematic, PORTD pin 8 is actually connected to MOSI, and PORTD pin 9 is actually connected to SCK; in other words variant.cpp is correct. However, in variant.h, PIN_SPI_MOSI should be for row 65 in g_APinDescription, and PIN_SPI_SCK should be for row 66.
This doesn't cause any problems with the SERCOM controlled SPI port, because both pins have the same initialization parameter from g_APinDescription, and the SPI SERCOM controls both signals directly. I guess if someone tried to use the symbols MOSI and SCK to as inputs to the simple digital pin controls this would create a problem.

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

No branches or pull requests

1 participant