However, when I flash the board and hook it up to my scope, I get a clock signal on Pin 12 (at 8MHz frequency), what looks like data on Pin 13, and nothing at all on Pin 11. Whereas I was expecting the clock on 13 and the data on 11.
I promise you I have copied your code verbatim into the Arduino IDE. I have also tried in PlatformIO with the same results.
Have I misunderstood something?
Very grateful for any help
Gavin
Here's the code:
- Code: Select all | TOGGLE FULL SIZE
#include <SPI.h>
#include "wiring_private.h" // pinPeripheral() function
SPIClass mySPI (&sercom1, 12, 13, 11, SPI_PAD_0_SCK_1, SERCOM_RX_PAD_3);
void setup() {
Serial.begin(115200);
// do this first, for Reasons
mySPI.begin();
// Assign pins 11, 12, 13 to SERCOM functionality
pinPeripheral(11, PIO_SERCOM);
pinPeripheral(12, PIO_SERCOM);
pinPeripheral(13, PIO_SERCOM);
}
uint8_t i=0;
void loop() {
Serial.println(i);
mySPI.beginTransaction(SPISettings(8000000, MSBFIRST, SPI_MODE0));
mySPI.transfer(i++);
mySPI.endTransaction();
}