I double check and some boards seem to have D2 and D4 reversed !
So you may have right (and I was hoping a lot) but I'm using a Robodyn M0 and SERCOM2.2 is D4.
There was a mistake on pinPeripheral but no more chance.
My priority is to use SERCOM1 (MOSI = D11, MISO = D12, CLK = D13) :
Here is my code :
#include "SPI.h"
#include "wiring_private.h" // pinPeripheral() function
SPIClass mySPI (&sercom1, 12, 13, 11, SPI_PAD_0_SCK_1, SERCOM_RX_PAD_3);
#include "Adafruit_GFX.h"
#include "Adafruit_ILI9341.h"
// For the Adafruit shield, these are the default.
#define TFT_DC 9
#define TFT_CS 10
Adafruit_ILI9341 tft = Adafruit_ILI9341(&mySPI, TFT_CS, TFT_DC);
void setup() {
mySPI.begin();
// Assign pins 11, 12, 13 to SERCOM functionality
pinPeripheral(11, PIO_SERCOM);
pinPeripheral(12, PIO_SERCOM);
pinPeripheral(13, PIO_SERCOM);
tft.begin();
}