Hi folks,
Trying to figure out how to properly make use of the 1MB Flash onboard the SAMD51 Processor with a MicroMod Data Logging Carrier Board.
Based on the schematic, the Flash is making use of SPI1. However, the [Hookup Guide does not list which pins SPI1 corresponds to in the pinout table.
Digging into the datasheet and SparkFun board definition, the SPI CS1 is connected to PA11, which is physical pin 20, but in the variant.h board definition file, CS1 is defined as 52, PIN_SPI1_SS or SS1.
//-------------------------------------------
// SPI Interfaces
//-------------------------------------------
#define SPI_INTERFACES_COUNT 2
#define PIN_SPI_MOSI (45u)
#define PIN_SPI_SCK (46u)
#define PIN_SPI_MISO (47u)
#define PIN_SPI_SS (48u)
#define PERIPH_SPI sercom0
#define PAD_SPI_TX SPI_PAD_0_SCK_1
#define PAD_SPI_RX SERCOM_RX_PAD_2
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 ;
// SPI1
#define PIN_SPI1_MOSI (49u)
#define PIN_SPI1_SCK (50u)
#define PIN_SPI1_MISO (51u)
#define PIN_SPI1_SS (52u)
#define PERIPH_SPI1 sercom2
#define PAD_SPI1_TX SPI_PAD_0_SCK_1
#define PAD_SPI1_RX SERCOM_RX_PAD_2
//-------------------------------------------
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 ;
Running the SPIMemory library example [“Flash Diagnostics” using SPI1 doesn’t seem to work with any of the following combinations:
SPIFlash flash(SS1, &SPI1);
SPIFlash flash(PIN_SPI1_SS, &SPI1);
SPIFlash flash(52, &SPI1);
SPIFlash flash(20, &SPI1);
12:58:55.484 -> Initialising..........
12:58:55.484 ->
12:58:55.484 -> SPIMemory Library version: < 2.5.0
12:58:55.484 ->
12:58:55.484 -> No comms. Check wiring. Is chip supported? If unable to fix, raise an issue on Github
Any guidance would be appreciated!
Cheers,
Adam](SPIMemory/examples/FlashDiagnostics/Diagnostics_functions.ino at master · Marzogh/SPIMemory · GitHub)](https://learn.sparkfun.com/tutorials/micromod-samd51-processor-board-hookup-guide/all)