SparkFun Forums 

Where electronics enthusiasts find answers.

Discussions about processor boards have here!
User avatar
By adam.g
#220398
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.

Code: Select all
//-------------------------------------------

// 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:
Code: Select all
SPIFlash flash(SS1, &SPI1);
SPIFlash flash(PIN_SPI1_SS, &SPI1);
SPIFlash flash(52, &SPI1);
SPIFlash flash(20, &SPI1);
Code: Select all
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
User avatar
By adam.g
#220422
Oops. I should clarify I’m trying to access the external Winbond 25Q128JVPM 16 MB flash.

The microSD is working fine on the SPI bus but no dice with SPI1.

Cheers,
Adam
User avatar
By TS-Chris
#220447
The flash chip is tied to the bootloader so it's not available for general use unless you remove the bootloader and replace it with your own custom firmware.
User avatar
By adam.g
#220448
Hi Chris,

That would explain it!

At least the one good thing that came out of delving into the variant.h file is that I discovered the board definitions were missing definitions for a number of pins.

In terms of power consumption, will the external flash memory usually be in a powered-down state? I'm unfamiliar with how being tied to the bootloader works. I've been trying to see what kind of sleep current I can achieve with the SAMD51, but a milliamp or two seems to be the limit (though the SAMD51 can reach 42 uA).

Cheers,
Adam
User avatar
By TS-Chris
#220455
The flash chip is tied directly to the 3.3 volt rail so it's always powered but when CS is driven high, the chip does enter a low power state that should be around 20μA.
 Topic permissions

You can post new topics in this forum
You can reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

long long title how many chars? lets see 123 ok more? yes 60

We have created lots of YouTube videos just so you can achieve [...]

Another post test yes yes yes or no, maybe ni? :-/

The best flat phpBB theme around. Period. Fine craftmanship and [...]

Do you need a super MOD? Well here it is. chew on this

All you need is right here. Content tag, SEO, listing, Pizza and spaghetti [...]

Lasagna on me this time ok? I got plenty of cash

this should be fantastic. but what about links,images, bbcodes etc etc? [...]