Skip to content

Added support for ISSI IS25LP016D SPI flash and EXTERNAL_FLASH_DEVICES on variant.h #135

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion examples/SdFat_Flash_and_SDcard/SdFat_Flash_and_SDcard.ino
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ void setup() {
Serial.println(onboardFlash.getJEDECID(), HEX);
Serial.print("Flash size: ");
Serial.print(onboardFlash.size() / 1024);
Serial.println(" KB");
Serial.println(" KiB");
Serial.print("Starting up SD Card...");
if (!onboardSdCard.begin(getSDCardPin())) {
Serial.println("No card found (is one inserted?)");
Expand Down
2 changes: 1 addition & 1 deletion examples/SdFat_format/SdFat_format.ino
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ void setup() {
}

Serial.print(F("Flash chip JEDEC ID: 0x")); Serial.println(flash.getJEDECID(), HEX);
Serial.print(F("Flash size: ")); Serial.print(flash.size() / 1024); Serial.println(F(" KB"));
Serial.print(F("Flash size: ")); Serial.print(flash.size() / 1024); Serial.println(F(" KiB"));

// Uncomment to flash LED while writing to flash
// flash.setIndicator(LED_BUILTIN, true);
Expand Down
2 changes: 1 addition & 1 deletion examples/flash_info/flash_info.ino
Original file line number Diff line number Diff line change
Expand Up @@ -76,7 +76,7 @@ void setup() {
Serial.println(flash.getJEDECID(), HEX);
Serial.print("Flash size: ");
Serial.print(flash.size() / 1024);
Serial.println(" KB");
Serial.println(" KiB");
}

void loop() {
Expand Down
5 changes: 5 additions & 0 deletions src/Adafruit_SPIFlashBase.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,10 @@ bool Adafruit_SPIFlashBase::begin(SPIFlash_Device_t const *flash_devs,

#else

#if defined(EXTERNAL_FLASH_DEVICES)
/// List of all possible flash devices defined by board's variant.h
static const SPIFlash_Device_t possible_devices[] = {EXTERNAL_FLASH_DEVICES};
#else
/// List of all possible flash devices used by Adafruit boards
static const SPIFlash_Device_t possible_devices[] = {
// Main devices used in current Adafruit products
Expand All @@ -100,6 +104,7 @@ static const SPIFlash_Device_t possible_devices[] = {

// Other common flash devices
W25Q16JV_IQ, W25Q32JV_IQ, AT25SF041, AT25DF081A};
#endif /* if defined (EXTERNAL_FLASH_DEVICES) */

/// Flash device list count
enum {
Expand Down
15 changes: 14 additions & 1 deletion src/flash_devices.h
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
#include <stdint.h>

typedef struct {
uint32_t total_size;
uint32_t total_size; // in bytes
uint16_t start_up_time_us;

// Three response bytes to 0x9f JEDEC ID command.
Expand Down Expand Up @@ -143,6 +143,19 @@ typedef struct {
.single_status_byte = false, .is_fram = false, \
}

// Settings for the ISSI IS25LP016D 16Mib / 2MiB SPI flash.
// Datasheet: https://www.issi.com/WW/pdf/25LP-WP016D.pdf
#define IS25LP016D \
{ \
.total_size = 2097152, /* 2MiB */ .start_up_time_us = 5000, \
.manufacturer_id = 0x9d, .memory_type = 0x60, .capacity = 0x15, \
.max_clock_speed_mhz = 133, .quad_enable_bit_mask = 0x40, \
.has_sector_protection = false, .supports_fast_read = true, \
.supports_qspi = true, .supports_qspi_writes = true, \
.write_status_register_split = false, .single_status_byte = true, \
.is_fram = false, \
}

// https://www.fujitsu.com/uk/Images/MB85RS64V.pdf
// RDID has continuation code: 04-7F-03-02
#define MB85RS64V \
Expand Down