#define PIN_SPI_MISO (10u)
#define PIN_SPI_MOSI (8u)
#define PIN_SPI_SCK (9u)
#define PIN_SPI_SS (24u)
#define PERIPH_SPI sercom1
#define PAD_SPI_TX SPI_PAD_0_SCK_1
#define PAD_SPI_RX SERCOM_RX_PAD_3
static const uint8_t SS = PIN_SPI_SS; // SPI Slave SS not used. Set here only for reference.
static const uint8_t MOSI = PIN_SPI_MOSI;
static const uint8_t MISO = PIN_SPI_MISO;
static const uint8_t SCK = PIN_SPI_SCK;
// SPI1: Connected to WINC1501B
#define PIN_SPI1_MISO (29u)
#define PIN_SPI1_MOSI (26u)
#define PIN_SPI1_SCK (27u)
#define PIN_SPI1_SS (28u)
#define PERIPH_SPI1 sercom2
#define PAD_SPI1_TX SPI_PAD_0_SCK_1
#define PAD_SPI1_RX SERCOM_RX_PAD_3
static const uint8_t SS1 = PIN_SPI1_SS;
static const uint8_t MOSI1 = PIN_SPI1_MOSI;
static const uint8_t MISO1 = PIN_SPI1_MISO;
static const uint8_t SCK1 = PIN_SPI1_SCK;
// Multi-serial objects instantiation
SERCOM sercom0(SERCOM0);
SERCOM sercom1(SERCOM1);
SERCOM sercom2(SERCOM2);
SERCOM sercom3(SERCOM3);
SERCOM sercom4(SERCOM4);
SERCOM sercom5(SERCOM5);
// SPI Interfaces
// --------------
#define SPI_INTERFACES_COUNT 2
/* +------------+------------------+--------+-----------------+--------------------------------------------------------------------------------------------------------
* | Pin number | ATRF233 | PIN | Label/Name | Comments (* is for default peripheral in use)
* +------------+------------------+--------+-----------------+--------------------------------------------------------------------------------------------------------
* | 9 | | PB30 | MOSI | SERCOM4/PAD[2] peripheral F
* | 10 | | PC19 | MISO | SERCOM4/PAD[0] peripheral F
* | 11 | | PC18 | SCK | SERCOM4/PAD[3] peripheral F
* | 12 | | PB31 | SS (/SEL, CS) | SERCOM4/PAD[1] peripheral F
* | | | | |
* | 13 | | PB00 | IRQ | EXTINT[0]
* | 14 | | PA20 | SLP_TR |
* | 15 | | PB15 | /RST |
* +------------+------------------+--------+-----------------+--------------------------------------------------------------------------------------------------------
*/
{ PORTB, 30, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER_ALT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM4/PAD[2]
{ PORTC, 19, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER_ALT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM4/PAD[0]
{ PORTC, 18, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER_ALT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM4/PAD[3]
{ PORTB, 31, PIO_TIMER_ALT, (PIN_ATTR_DIGITAL|PIN_ATTR_TIMER_ALT), No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, // SERCOM4/PAD[1]
{ PORTB, 0, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_0 }, // EXTINT[0]
{ PORTA, 20, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, //
{ PORTB, 15, PIO_DIGITAL, PIN_ATTR_DIGITAL, No_ADC_Channel, NOT_ON_PWM, NOT_ON_TIMER, EXTERNAL_INT_NONE }, //
/*
* SPI Interfaces
*/
#define SPI_INTERFACES_COUNT 1
#define PIN_SPI_MOSI ( 9u) // Tx, PAD 2
#define PIN_SPI_MISO (10u) // Rx, PAD 0
#define PIN_SPI_SCK (11u) // PAD 3
#define PIN_SPI_SS (12u) // PAD 1
#define PERIPH_SPI sercom4
#define PAD_SPI_TX SPI_PAD_2_SCK_3
#define PAD_SPI_RX SERCOM_RX_PAD_0
static const uint8_t SS = PIN_SPI_SS ;
static const uint8_t MOSI = PIN_SPI_MOSI ;
static const uint8_t MISO = PIN_SPI_MISO ;
static const uint8_t SCK = PIN_SPI_SCK ;
--You received this message because you are subscribed to the Google Groups "Developers" group.
To unsubscribe from this group and stop receiving emails from it, send an email to developers+...@arduino.cc.
Hi Daniel,
You were right!
I erroneously presumed variant.cpp definitions would automatically set pinmuxing during pin setup... But it turns out I had to call pinPeripheral() manually to set PMUX stuff before initializing SPI on SERCOM4.
Success, Arduino comparability for the Atmel SAM R21E is working, radio and all.
- Alex