I'm trying to get LittleFS working with a Teensy 4.0 and a 25F040 with no luck. I'm using Arduino IDE 1.8.13 and Teensyduino 1.57

My chip is:

I realize there are very specific memory chips that can be used, maybe this chip is incompatible.


Chip Teenys pin
CE 10
SO/SIO 12 (tried 11 as well)
WP no connection
SI/SIO 11 (tried 12 as well)
SCK 13
HOLD no connection
VDD 3v3.

Im running the Little FS example only changing the CS pin to pin 10

I can't get the chip to be recognized. Error is:

C:\Users\ADMINI~1\AppData\Local\Temp\arduino_modif ied_sketch_438428\LittleFS_SPI_Simple_Datalogger.i no Oct 2 2022 16:49:22
Initializing LittleFS ... Error starting SPI FLASH

Any help greatly appreciated.

  LittleFS  datalogger
 This example shows how to log data from three analog sensors
 to an storage device such as a FLASH.
 This example code is in the public domain.
#include <LittleFS.h>

// LittleFS supports creating file systems (FS) in multiple memory types.  Depending on the 
// memory type you want to use you would uncomment one of the following constructors

LittleFS_SPIFlash myfs;  // Used to create FS on SPI NOR flash chips such as the W25Q16JV*IQ/W25Q16FV,
                         // for the full list of supported NOR flash see 

//LittleFS_SPINAND myfs;  // Used to create FS on SPI NAND flash chips on a SPI port 
                          // such as SPI, SPI1, SPI2 etc.  For the full list of supported 
                          //  NAND Flash chips see

//LittleFS_SPIFram myfs;  // Used to create FS on FRAM memory chips such as the FM25V10-G.  
                          // For the full list of supported chips see

//Chip select pin for SPI lash chips such as the W25N01G. For the full list of supported NAND flash see
// The chipSelect pin can be any digital pin.  However, if using the Teensy Audio shield chipSelect is pin 6. 
const int chipSelect = 10; 

File dataFile;  // Specifes that dataFile is of File type

int record_count = 0;
bool write_data = false;

void setup()

  // Open serial communications and wait for port to open:
  while (!Serial) {
    // wait for serial port to connect.
  Serial.println("\n" __FILE__ " " __DATE__ " " __TIME__);

  Serial.print("Initializing LittleFS ... ");
  // see if the Flash is present and can be initialized:
  // Note:  SPI is default so if you are using SPI and not SPI for instance
  //        you can just specify myfs.begin(chipSelect). 
  if (!myfs.begin(chipSelect)) {
    Serial.printf("Error starting %s\n", "SPI FLASH");
    while (1) {
      // Error, so don't do anything more - stay stuck here
  Serial.println("LittleFS initialized.");

void loop()
  if ( Serial.available() ) {
    char rr;
    rr =;
    switch (rr) {
      case 'l': listFiles(); break;
      case 'e': eraseFiles(); break;
      case 's':
          Serial.println("\nLogging Data!!!");
          write_data = true;   // sets flag to continue to write data until new command is received
          // opens a file or creates a file if not present,  FILE_WRITE will append data to
          // to the file created.
          dataFile ="datalog.txt", FILE_WRITE);
      case 'x': stopLogging(); break;
      case 'd': dumpLog(); break;
      case '\r':
      case '\n':
      case 'h': menu(); break;
    while ( != -1) ; // remove rest of characters.

  if(write_data) logData();

void logData()
    // make a string for assembling the data to log:
    String dataString = "";
    // read three sensors and append to the string:
    for (int analogPin = 0; analogPin < 3; analogPin++) {
      int sensor = analogRead(analogPin);
      dataString += String(sensor);
      if (analogPin < 2) {
        dataString += ",";
    // if the file is available, write to it:
    if (dataFile) {
      // print to the serial port too:
      record_count += 1;
    } else {
      // if the file isn't open, pop up an error:
      Serial.println("error opening datalog.txt");
    delay(100); // run at a reasonable not-too-fast speed for testing

void stopLogging()
  Serial.println("\nStopped Logging Data!!!");
  write_data = false;
  // Closes the data file.
  Serial.printf("Records written = %d\n", record_count);

void dumpLog()
  Serial.println("\nDumping Log!!!");
  // open the file.
  dataFile ="datalog.txt");

  // if the file is available, write to it:
  if (dataFile) {
    while (dataFile.available()) {
  // if the file isn't open, pop up an error:
  else {
    Serial.println("error opening datalog.txt");

void menu()
  Serial.println("Menu Options:");
  Serial.println("\tl - List files on disk");
  Serial.println("\te - Erase files on disk");
  Serial.println("\ts - Start Logging data (Restarting logger will append records to existing log)");
  Serial.println("\tx - Stop Logging data");
  Serial.println("\td - Dump Log");
  Serial.println("\th - Menu");

void listFiles()
  Serial.print("\n Space Used = ");
  Serial.print("Filesystem Size = ");


void eraseFiles()
  myfs.quickFormat();  // performs a quick format of the created di
  Serial.println("\nFiles erased !");

void printDirectory(FS &fs) {
  printDirectory("/"), 0);

void printDirectory(File dir, int numSpaces) {
   while(true) {
     File entry = dir.openNextFile();
     if (! entry) {
       //Serial.println("** no more files **");
     if (entry.isDirectory()) {
       printDirectory(entry, numSpaces+2);
     } else {
       // files have sizes, directories do not
       printSpaces(36 - numSpaces - strlen(;
       Serial.print("  ");
       Serial.println(entry.size(), DEC);

void printSpaces(int num) {
  for (int i=0; i < num; i++) {
    Serial.print(" ");