Writing to FLASH-memory intermittently slow: 150us vs 80ms (Adafruit SPIFlash)

Hello,

I have a custom board where accelerometer is connected to ATSAMD21. Acceleration data is written to FLASH-memory (W25Q64JVZPI) connected to ATSAMD21 via SPI.

It works otherwise but for every 100th or so write operation the write time is 80ms compared to "usual" 150us write time. This means that acceleration information is lost (can't be fetched from accelerometer) for 80ms. For example with 500Hz sampling rate it is 40 samples and means that post-processing of acceleration data is not useful.

Why does this delay happen? Can I get rid of that somehow?

Below is a test sketch which is partly based on "Adafruit SPIFlash" -library examples and partly mimics what my accelerometer sketch does.

/*  Custom HW:
 *  Winbond 64Mbit FLASH- memory (W25Q64JVZPIQ) connected to ATSAMD21G via MUX-chip
 *  MUX is not switched during this test.
 *  Board selected in Arduino IDE: "Adafruit ItsyBitsy M0 Express (SAMD21)" (This board was used as a baseline for custom HW)
 */


#include <SPI.h>
#include <SdFat.h>
#include <Adafruit_SPIFlash.h>

#define FILE_NAME "Accdat_1.csv"            // Data is stored to this file

Adafruit_FlashTransport_SPI flashTransport(EXTERNAL_FLASH_USE_CS, EXTERNAL_FLASH_USE_SPI);
Adafruit_SPIFlash flash(&flashTransport);
FatFileSystem fatfs;

const int MUX_PIN = 7;                      // FLASH MUX pins
long startWriteTime;
long stopWriteTime;
long loopTime;
const int sampleCount = 2000;               // Number of "lines" written to FLASH -memory in this test.

void setup() {  
  Serial.begin(2000000); 
  delay(3000);
  while (!Serial) {
    delay(1);
  }
  Serial.println("Adafruit SPIFlash - memory writing test 1");
  Serial.println();

  SPI.begin();
  SPI.setDataMode(SPI_MODE0);  //lisätty

  // Initialize FLASH MUX pins.
  // Custom HW has MUX-chip in between ATSAMD21 and FLASH-memory chip
  // MUX is not switched during the test.
  pinMode(MUX_PIN, OUTPUT);
  digitalWrite(MUX_PIN, LOW);           //LOW = select FLASH0, HIGH = select FLASH1
  delay(1);
}


void loop() {
    // Initialize flash library and check its chip ID.
    if (!flash.begin()) {
      Serial.println("Error, failed to initialize flash chip!");
      while(1) yield();
    }
    Serial.print("Flash chip OK! JEDEC ID: 0x"); Serial.println(flash.getJEDECID(), HEX);

  // First call begin to mount the filesystem.  Check that it returns true
  // to make sure the filesystem was mounted.
  if (!fatfs.begin(&flash)) {
    Serial.println("Error, failed to mount newly formatted filesystem!");
    Serial.println("Was the flash chip formatted with the fatfs_format example?");
    while(1) delay(1);
  }
  Serial.println("Filesystem ok!");

  // Delete a file with the remove command.
  Serial.println("Deleting old data file...");
  if (!fatfs.remove(FILE_NAME)) {
    Serial.println("File didn't exist or other issue!");
  }
  else {
    Serial.println("Deleted file!");
  }

  Serial.println();
  Serial.print("Opening file for writing: ");  
  Serial.println(FILE_NAME);
  Serial.println();

  // Originally was:   File dataFile = fatfs.open(FILE_NAME, FILE_WRITE);
  // Was changed to "FileFTP" because of "File" name conflict with  https://github.com/ldab/ESP32_FTPClient -library
  // Changes made to <SdFat.h> and <Adafruit_SPIFlash.h>
  FileFTP dataFile = fatfs.open(FILE_NAME, FILE_WRITE);


  for(int j = 0; j < sampleCount; j = j + 1) {
    long x_acc = random(1000);                      // Just mimicking the original sketch where the data was fetched from accelerometer
    long y_acc = random(1000);
    long z_acc = random(1000);
     
    startWriteTime = micros();                                                         
 
  // Check that the file opened successfully and write a line to it.
  //if (dataFile) {                                 // Commenting this out seems to shorten the write delay                     
     
    dataFile.print(j);                              // Just mimicking the original sketch where the data was fetched from accelerometer
    dataFile.print("T");        
    dataFile.print(startWriteTime);
    dataFile.print("X");     
    dataFile.print(x_acc,3);
    dataFile.print("Y");       
    dataFile.print(y_acc,3);
    dataFile.print("Z");    
    dataFile.print(z_acc,3);
    dataFile.println();

    /*                                               // Commenting this out seems to shorten the write delay                             
    //Serial.println("Wrote new measurement to data file!");
    }
    else {Serial.println("Failed to open data file for writing!");
    }
    */
    loopTime = micros() - stopWriteTime;
    stopWriteTime = micros();


    Serial.print("Sample #, loop time (us), write time (us): ");
    Serial.print(j);
    Serial.print(" , ");
    Serial.print(loopTime);
    Serial.print(" , ");
    Serial.println(stopWriteTime - startWriteTime);
    
    delayMicroseconds(1200);                      // Adjust the loop time to mimick different sampling frequencies used with accelerometer
/*                                           
    Serial.print(j);                              // Printing to Serial just to see what data is written to FLASH
    Serial.print("T");        
    Serial.print(timeStamp);
    Serial.print("X");     
    Serial.print(x_acc,3);
    Serial.print("Y");       
    Serial.print(y_acc,3);
    Serial.print("Z");    
    Serial.print(z_acc,3);
    Serial.println();
  */  
  }
  
  // Finally close the file when done writing.  This is smart to do to make
  // sure all the data is written to the file.
  dataFile.close(); 

  delay(30000);

}

The output:

Adafruit SPIFlash - memory writing test 1

Flash chip OK! JEDEC ID: 0xEF4017
Filesystem ok!
Deleting old data file...
Deleted file!

Opening file for writing: Accdat_1.csv

Sample #, loop time (us), write time (us): 0 , 3910209 , 8541
Sample #, loop time (us), write time (us): 1 , 1918 , 145
Sample #, loop time (us), write time (us): 2 , 1946 , 144
Sample #, loop time (us), write time (us): 3 , 1804 , 138
Sample #, loop time (us), write time (us): 4 , 1903 , 142
Sample #, loop time (us), write time (us): 5 , 1806 , 140
Sample #, loop time (us), write time (us): 6 , 1784 , 145
Sample #, loop time (us), write time (us): 7 , 1797 , 150
Sample #, loop time (us), write time (us): 8 , 1971 , 143
Sample #, loop time (us), write time (us): 9 , 1896 , 140
Sample #, loop time (us), write time (us): 10 , 1783 , 141
Sample #, loop time (us), write time (us): 11 , 1862 , 146
Sample #, loop time (us), write time (us): 12 , 1803 , 151
Sample #, loop time (us), write time (us): 13 , 1885 , 142
Sample #, loop time (us), write time (us): 14 , 1781 , 144
Sample #, loop time (us), write time (us): 15 , 86344 , 84725
Sample #, loop time (us), write time (us): 16 , 1971 , 145
Sample #, loop time (us), write time (us): 17 , 1866 , 138
Sample #, loop time (us), write time (us): 18 , 1947 , 138
Sample #, loop time (us), write time (us): 19 , 2026 , 141
Sample #, loop time (us), write time (us): 20 , 1987 , 144
Sample #, loop time (us), write time (us): 21 , 2062 , 145
Sample #, loop time (us), write time (us): 22 , 2013 , 148
Sample #, loop time (us), write time (us): 23 , 2102 , 143
Sample #, loop time (us), write time (us): 24 , 1926 , 140
Sample #, loop time (us), write time (us): 25 , 2082 , 150
Sample #, loop time (us), write time (us): 26 , 2262 , 144
Sample #, loop time (us), write time (us): 27 , 1895 , 137
Sample #, loop time (us), write time (us): 28 , 2092 , 134
Sample #, loop time (us), write time (us): 29 , 2009 , 145
Sample #, loop time (us), write time (us): 30 , 2101 , 151
Sample #, loop time (us), write time (us): 31 , 2096 , 255
Sample #, loop time (us), write time (us): 32 , 2165 , 144
Sample #, loop time (us), write time (us): 33 , 2007 , 129
Sample #, loop time (us), write time (us): 34 , 2016 , 140
Sample #, loop time (us), write time (us): 35 , 2020 , 132
Sample #, loop time (us), write time (us): 36 , 2044 , 144
Sample #, loop time (us), write time (us): 37 , 1985 , 149
Sample #, loop time (us), write time (us): 38 , 2105 , 141
Sample #, loop time (us), write time (us): 39 , 1907 , 139
Sample #, loop time (us), write time (us): 40 , 1843 , 143
Sample #, loop time (us), write time (us): 41 , 1948 , 148
Sample #, loop time (us), write time (us): 42 , 1894 , 148
Sample #, loop time (us), write time (us): 43 , 1926 , 140
Sample #, loop time (us), write time (us): 44 , 1911 , 143
Sample #, loop time (us), write time (us): 45 , 1879 , 145
Sample #, loop time (us), write time (us): 46 , 1902 , 144
Sample #, loop time (us), write time (us): 47 , 2029 , 265
Sample #, loop time (us), write time (us): 48 , 1760 , 135
Sample #, loop time (us), write time (us): 49 , 1778 , 144
Sample #, loop time (us), write time (us): 50 , 1836 , 141
Sample #, loop time (us), write time (us): 51 , 1855 , 143
Sample #, loop time (us), write time (us): 52 , 1950 , 147
Sample #, loop time (us), write time (us): 53 , 1781 , 140
Sample #, loop time (us), write time (us): 54 , 1740 , 145
Sample #, loop time (us), write time (us): 55 , 1939 , 142
Sample #, loop time (us), write time (us): 56 , 1829 , 144
Sample #, loop time (us), write time (us): 57 , 1738 , 141
Sample #, loop time (us), write time (us): 58 , 1966 , 146
Sample #, loop time (us), write time (us): 59 , 1904 , 140
Sample #, loop time (us), write time (us): 60 , 1937 , 139
Sample #, loop time (us), write time (us): 61 , 1856 , 135
Sample #, loop time (us), write time (us): 62 , 1969 , 262
Sample #, loop time (us), write time (us): 63 , 1951 , 148
Sample #, loop time (us), write time (us): 64 , 1889 , 136
Sample #, loop time (us), write time (us): 65 , 1859 , 143
Sample #, loop time (us), write time (us): 66 , 1873 , 151
Sample #, loop time (us), write time (us): 67 , 1864 , 142
Sample #, loop time (us), write time (us): 68 , 1950 , 142
Sample #, loop time (us), write time (us): 69 , 1755 , 147
Sample #, loop time (us), write time (us): 70 , 1790 , 149
Sample #, loop time (us), write time (us): 71 , 1815 , 150
Sample #, loop time (us), write time (us): 72 , 1881 , 143
Sample #, loop time (us), write time (us): 73 , 1951 , 145
Sample #, loop time (us), write time (us): 74 , 1832 , 139
Sample #, loop time (us), write time (us): 75 , 1887 , 142
Sample #, loop time (us), write time (us): 76 , 1823 , 146
Sample #, loop time (us), write time (us): 77 , 1811 , 142
Sample #, loop time (us), write time (us): 78 , 1871 , 252
Sample #, loop time (us), write time (us): 79 , 1781 , 145
Sample #, loop time (us), write time (us): 80 , 1887 , 129
Sample #, loop time (us), write time (us): 81 , 1876 , 146
Sample #, loop time (us), write time (us): 82 , 1739 , 131
Sample #, loop time (us), write time (us): 83 , 1748 , 146
Sample #, loop time (us), write time (us): 84 , 1812 , 147
Sample #, loop time (us), write time (us): 85 , 1809 , 144
Sample #, loop time (us), write time (us): 86 , 1731 , 144
Sample #, loop time (us), write time (us): 87 , 1693 , 138
Sample #, loop time (us), write time (us): 88 , 1781 , 148
Sample #, loop time (us), write time (us): 89 , 1780 , 136
Sample #, loop time (us), write time (us): 90 , 1823 , 144
Sample #, loop time (us), write time (us): 91 , 1787 , 141
Sample #, loop time (us), write time (us): 92 , 1817 , 140
Sample #, loop time (us), write time (us): 93 , 1731 , 142
Sample #, loop time (us), write time (us): 94 , 2058 , 259
Sample #, loop time (us), write time (us): 95 , 1741 , 138
Sample #, loop time (us), write time (us): 96 , 1703 , 141
Sample #, loop time (us), write time (us): 97 , 1738 , 150
Sample #, loop time (us), write time (us): 98 , 1892 , 140
Sample #, loop time (us), write time (us): 99 , 1907 , 139
Sample #, loop time (us), write time (us): 100 , 1871 , 153
Sample #, loop time (us), write time (us): 101 , 1940 , 145
Sample #, loop time (us), write time (us): 102 , 1920 , 149
Sample #, loop time (us), write time (us): 103 , 2107 , 141
Sample #, loop time (us), write time (us): 104 , 1908 , 149
Sample #, loop time (us), write time (us): 105 , 1759 , 148
Sample #, loop time (us), write time (us): 106 , 1693 , 146
Sample #, loop time (us), write time (us): 107 , 1697 , 144
Sample #, loop time (us), write time (us): 108 , 1798 , 146
Sample #, loop time (us), write time (us): 109 , 2010 , 260
Sample #, loop time (us), write time (us): 110 , 1765 , 151
Sample #, loop time (us), write time (us): 111 , 1798 , 150
Sample #, loop time (us), write time (us): 112 , 1716 , 142
Sample #, loop time (us), write time (us): 113 , 1833 , 144
Sample #, loop time (us), write time (us): 114 , 1760 , 142
Sample #, loop time (us), write time (us): 115 , 1781 , 139
Sample #, loop time (us), write time (us): 116 , 1829 , 145
Sample #, loop time (us), write time (us): 117 , 1691 , 145
Sample #, loop time (us), write time (us): 118 , 1746 , 151
Sample #, loop time (us), write time (us): 119 , 1713 , 142
Sample #, loop time (us), write time (us): 120 , 1683 , 143
Sample #, loop time (us), write time (us): 121 , 1736 , 141
Sample #, loop time (us), write time (us): 122 , 1678 , 147
Sample #, loop time (us), write time (us): 123 , 1700 , 145
Sample #, loop time (us), write time (us): 124 , 1693 , 140
Sample #, loop time (us), write time (us): 125 , 1866 , 279
Sample #, loop time (us), write time (us): 126 , 1685 , 137
Sample #, loop time (us), write time (us): 127 , 1895 , 139
Sample #, loop time (us), write time (us): 128 , 1717 , 148
Sample #, loop time (us), write time (us): 129 , 1700 , 145
Sample #, loop time (us), write time (us): 130 , 1688 , 151
Sample #, loop time (us), write time (us): 131 , 1710 , 153
Sample #, loop time (us), write time (us): 132 , 1730 , 147
Sample #, loop time (us), write time (us): 133 , 1727 , 147
Sample #, loop time (us), write time (us): 134 , 1690 , 148
Sample #, loop time (us), write time (us): 135 , 1706 , 144
Sample #, loop time (us), write time (us): 136 , 1793 , 141
Sample #, loop time (us), write time (us): 137 , 1724 , 148
Sample #, loop time (us), write time (us): 138 , 1685 , 143
Sample #, loop time (us), write time (us): 139 , 1749 , 143
Sample #, loop time (us), write time (us): 140 , 91453 , 89752
Sample #, loop time (us), write time (us): 141 , 1733 , 145
Sample #, loop time (us), write time (us): 142 , 1735 , 135
Sample #, loop time (us), write time (us): 143 , 1712 , 148
Sample #, loop time (us), write time (us): 144 , 1717 , 148
Sample #, loop time (us), write time (us): 145 , 1781 , 144
Sample #, loop time (us), write time (us): 146 , 1791 , 153
Sample #, loop time (us), write time (us): 147 , 1853 , 142
Sample #, loop time (us), write time (us): 148 , 1736 , 142
Sample #, loop time (us), write time (us): 149 , 1781 , 148
Sample #, loop time (us), write time (us): 150 , 1783 , 148
Sample #, loop time (us), write time (us): 151 , 1789 , 143
Sample #, loop time (us), write time (us): 152 , 1861 , 136
Sample #, loop time (us), write time (us): 153 , 1808 , 147
Sample #, loop time (us), write time (us): 154 , 1885 , 146
Sample #, loop time (us), write time (us): 155 , 1950 , 267
Sample #, loop time (us), write time (us): 156 , 1825 , 148
Sample #, loop time (us), write time (us): 157 , 1851 , 151
Sample #, loop time (us), write time (us): 158 , 1840 , 150
Sample #, loop time (us), write time (us): 159 , 1811 , 140
Sample #, loop time (us), write time (us): 160 , 1898 , 144
Sample #, loop time (us), write time (us): 161 , 1837 , 135
Sample #, loop time (us), write time (us): 162 , 1718 , 148
Sample #, loop time (us), write time (us): 163 , 1754 , 151
Sample #, loop time (us), write time (us): 164 , 1780 , 149
Sample #, loop time (us), write time (us): 165 , 1753 , 147
Sample #, loop time (us), write time (us): 166 , 1752 , 140
Sample #, loop time (us), write time (us): 167 , 1776 , 142
Sample #, loop time (us), write time (us): 168 , 1755 , 145
Sample #, loop time (us), write time (us): 169 , 1722 , 146
Sample #, loop time (us), write time (us): 170 , 1847 , 268
Sample #, loop time (us), write time (us): 171 , 1743 , 149
Sample #, loop time (us), write time (us): 172 , 2177 , 156
Sample #, loop time (us), write time (us): 173 , 1724 , 141
Sample #, loop time (us), write time (us): 174 , 1763 , 136
Sample #, loop time (us), write time (us): 175 , 1698 , 146
Sample #, loop time (us), write time (us): 176 , 1721 , 147
Sample #, loop time (us), write time (us): 177 , 1727 , 147
Sample #, loop time (us), write time (us): 178 , 1762 , 149
Sample #, loop time (us), write time (us): 179 , 1703 , 142
Sample #, loop time (us), write time (us): 180 , 1719 , 145
Sample #, loop time (us), write time (us): 181 , 1716 , 146
Sample #, loop time (us), write time (us): 182 , 1716 , 148
Sample #, loop time (us), write time (us): 183 , 1718 , 156
Sample #, loop time (us), write time (us): 184 , 1689 , 144
Sample #, loop time (us), write time (us): 185 , 1830 , 255
Sample #, loop time (us), write time (us): 186 , 2088 , 147
Sample #, loop time (us), write time (us): 187 , 1885 , 150
Sample #, loop time (us), write time (us): 188 , 1871 , 147
Sample #, loop time (us), write time (us): 189 , 1736 , 147
Sample #, loop time (us), write time (us): 190 , 1721 , 144
Sample #, loop time (us), write time (us): 191 , 1874 , 149
Sample #, loop time (us), write time (us): 192 , 1875 , 147
Sample #, loop time (us), write time (us): 193 , 1972 , 143
Sample #, loop time (us), write time (us): 194 , 1802 , 140
Sample #, loop time (us), write time (us): 195 , 1772 , 150
Sample #, loop time (us), write time (us): 196 , 1901 , 152
Sample #, loop time (us), write time (us): 197 , 1763 , 147
Sample #, loop time (us), write time (us): 198 , 1907 , 154
Sample #, loop time (us), write time (us): 199 , 1860 , 144
Sample #, loop time (us), write time (us): 200 , 2056 , 263
Sample #, loop time (us), write time (us): 201 , 1975 , 147
Sample #, loop time (us), write time (us): 202 , 1934 , 154
Sample #, loop time (us), write time (us): 203 , 1955 , 142
Sample #, loop time (us), write time (us): 204 , 1923 , 139
Sample #, loop time (us), write time (us): 205 , 1981 , 139
Sample #, loop time (us), write time (us): 206 , 1950 , 144
Sample #, loop time (us), write time (us): 207 , 1902 , 154
Sample #, loop time (us), write time (us): 208 , 1934 , 147
Sample #, loop time (us), write time (us): 209 , 1857 , 156
Sample #, loop time (us), write time (us): 210 , 1880 , 149
Sample #, loop time (us), write time (us): 211 , 1908 , 145
Sample #, loop time (us), write time (us): 212 , 1926 , 147
Sample #, loop time (us), write time (us): 213 , 1780 , 151
Sample #, loop time (us), write time (us): 214 , 1785 , 136
Sample #, loop time (us), write time (us): 215 , 1825 , 266
Sample #, loop time (us), write time (us): 216 , 2012 , 147
Sample #, loop time (us), write time (us): 217 , 1789 , 152
Sample #, loop time (us), write time (us): 218 , 1811 , 152
Sample #, loop time (us), write time (us): 219 , 1815 , 150
Sample #, loop time (us), write time (us): 220 , 2295 , 149
Sample #, loop time (us), write time (us): 221 , 1928 , 152
Sample #, loop time (us), write time (us): 222 , 1792 , 148
Sample #, loop time (us), write time (us): 223 , 1849 , 140
Sample #, loop time (us), write time (us): 224 , 2099 , 148
Sample #, loop time (us), write time (us): 225 , 1985 , 154
Sample #, loop time (us), write time (us): 226 , 1900 , 140
Sample #, loop time (us), write time (us): 227 , 1878 , 142
Sample #, loop time (us), write time (us): 228 , 1775 , 152
Sample #, loop time (us), write time (us): 229 , 1799 , 142
Sample #, loop time (us), write time (us): 230 , 2311 , 263
Sample #, loop time (us), write time (us): 231 , 1929 , 147
Sample #, loop time (us), write time (us): 232 , 1964 , 144
Sample #, loop time (us), write time (us): 233 , 1871 , 153
Sample #, loop time (us), write time (us): 234 , 1923 , 143
Sample #, loop time (us), write time (us): 235 , 1905 , 149
Sample #, loop time (us), write time (us): 236 , 1833 , 145
Sample #, loop time (us), write time (us): 237 , 1843 , 140
Sample #, loop time (us), write time (us): 238 , 1827 , 144
Sample #, loop time (us), write time (us): 239 , 1999 , 145
Sample #, loop time (us), write time (us): 240 , 1801 , 147
Sample #, loop time (us), write time (us): 241 , 1771 , 141
Sample #, loop time (us), write time (us): 242 , 1815 , 147
Sample #, loop time (us), write time (us): 243 , 1840 , 151
Sample #, loop time (us), write time (us): 244 , 1991 , 144
Sample #, loop time (us), write time (us): 245 , 1828 , 149
Sample #, loop time (us), write time (us): 246 , 2147 , 285
Sample #, loop time (us), write time (us): 247 , 1991 , 152
Sample #, loop time (us), write time (us): 248 , 1879 , 146
Sample #, loop time (us), write time (us): 249 , 1919 , 149
Sample #, loop time (us), write time (us): 250 , 2000 , 151
Sample #, loop time (us), write time (us): 251 , 2145 , 142
Sample #, loop time (us), write time (us): 252 , 2104 , 141
Sample #, loop time (us), write time (us): 253 , 2008 , 147
Sample #, loop time (us), write time (us): 254 , 1790 , 147
Sample #, loop time (us), write time (us): 255 , 1940 , 149
Sample #, loop time (us), write time (us): 256 , 1895 , 145
Sample #, loop time (us), write time (us): 257 , 2246 , 149
Sample #, loop time (us), write time (us): 258 , 2139 , 148
Sample #, loop time (us), write time (us): 259 , 1946 , 146
Sample #, loop time (us), write time (us): 260 , 2048 , 144
Sample #, loop time (us), write time (us): 261 , 85899 , 84057
Sample #, loop time (us), write time (us): 262 , 2211 , 144
Sample #, loop time (us), write time (us): 263 , 2168 , 142
Sample #, loop time (us), write time (us): 264 , 2056 , 148
Sample #, loop time (us), write time (us): 265 , 2149 , 149
Sample #, loop time (us), write time (us): 266 , 1979 , 157
Sample #, loop time (us), write time (us): 267 , 2008 , 145
Sample #, loop time (us), write time (us): 268 , 2227 , 145
Sample #, loop time (us), write time (us): 269 , 1910 , 149
Sample #, loop time (us), write time (us): 270 , 2017 , 147
Sample #, loop time (us), write time (us): 271 , 1899 , 138
Sample #, loop time (us), write time (us): 272 , 1903 , 150
Sample #, loop time (us), write time (us): 273 , 1969 , 142
Sample #, loop time (us), write time (us): 274 , 1928 , 150
Sample #, loop time (us), write time (us): 275 , 1892 , 140
Sample #, loop time (us), write time (us): 276 , 2086 , 263
Sample #, loop time (us), write time (us): 277 , 2017 , 154
Sample #, loop time (us), write time (us): 278 , 2071 , 147
Sample #, loop time (us), write time (us): 279 , 2001 , 145
Sample #, loop time (us), write time (us): 280 , 1922 , 154
Sample #, loop time (us), write time (us): 281 , 1972 , 151
Sample #, loop time (us), write time (us): 282 , 2181 , 139
Sample #, loop time (us), write time (us): 283 , 2214 , 145
Sample #, loop time (us), write time (us): 284 , 2053 , 151
Sample #, loop time (us), write time (us): 285 , 2018 , 137
Sample #, loop time (us), write time (us): 286 , 2105 , 150
Sample #, loop time (us), write time (us): 287 , 2101 , 148
Sample #, loop time (us), write time (us): 288 , 2099 , 143
Sample #, loop time (us), write time (us): 289 , 1966 , 140
Sample #, loop time (us), write time (us): 290 , 2036 , 148
Sample #, loop time (us), write time (us): 291 , 2073 , 258
Sample #, loop time (us), write time (us): 292 , 1981 , 145
Sample #, loop time (us), write time (us): 293 , 1974 , 151
Sample #, loop time (us), write time (us): 294 , 1869 , 150
Sample #, loop time (us), write time (us): 295 , 2075 , 147
Sample #, loop time (us), write time (us): 296 , 1988 , 137
Sample #, loop time (us), write time (us): 297 , 2005 , 150
Sample #, loop time (us), write time (us): 298 , 1956 , 140
Sample #, loop time (us), write time (us): 299 , 1956 , 145
Sample #, loop time (us), write time (us): 300 , 1926 , 148
Sample #, loop time (us), write time (us): 301 , 2023 , 144
Sample #, loop time (us), write time (us): 302 , 2011 , 143
Sample #, loop time (us), write time (us): 303 , 1983 , 147
Sample #, loop time (us), write time (us): 304 , 1903 , 146
Sample #, loop time (us), write time (us): 305 , 1921 , 144
Sample #, loop time (us), write time (us): 306 , 2031 , 260
Sample #, loop time (us), write time (us): 307 , 1961 , 143
Sample #, loop time (us), write time (us): 308 , 1922 , 150
Sample #, loop time (us), write time (us): 309 , 1991 , 142
Sample #, loop time (us), write time (us): 310 , 2089 , 148
Sample #, loop time (us), write time (us): 311 , 2028 , 146
Sample #, loop time (us), write time (us): 312 , 1882 , 147
Sample #, loop time (us), write time (us): 313 , 1994 , 143
Sample #, loop time (us), write time (us): 314 , 1927 , 146
Sample #, loop time (us), write time (us): 315 , 1991 , 146
Sample #, loop time (us), write time (us): 316 , 1973 , 144
Sample #, loop time (us), write time (us): 317 , 2009 , 147
Sample #, loop time (us), write time (us): 318 , 2096 , 149
Sample #, loop time (us), write time (us): 319 , 1994 , 146
Sample #, loop time (us), write time (us): 320 , 1910 , 147
Sample #, loop time (us), write time (us): 321 , 2016 , 262
Sample #, loop time (us), write time (us): 322 , 1974 , 152
Sample #, loop time (us), write time (us): 323 , 1874 , 143
Sample #, loop time (us), write time (us): 324 , 1976 , 141
Sample #, loop time (us), write time (us): 325 , 1945 , 150
Sample #, loop time (us), write time (us): 326 , 2099 , 143
Sample #, loop time (us), write time (us): 327 , 1917 , 150
Sample #, loop time (us), write time (us): 328 , 1895 , 148
Sample #, loop time (us), write time (us): 329 , 1846 , 145
Sample #, loop time (us), write time (us): 330 , 1826 , 145
Sample #, loop time (us), write time (us): 331 , 1946 , 147
Sample #, loop time (us), write time (us): 332 , 2048 , 150
Sample #, loop time (us), write time (us): 333 , 1855 , 147
Sample #, loop time (us), write time (us): 334 , 1856 , 149
Sample #, loop time (us), write time (us): 335 , 1809 , 135
Sample #, loop time (us), write time (us): 336 , 1738 , 142
Sample #, loop time (us), write time (us): 337 , 1935 , 258
Sample #, loop time (us), write time (us): 338 , 1725 , 151
Sample #, loop time (us), write time (us): 339 , 1877 , 153
Sample #, loop time (us), write time (us): 340 , 1889 , 144
Sample #, loop time (us), write time (us): 341 , 1812 , 149
Sample #, loop time (us), write time (us): 342 , 1701 , 139
Sample #, loop time (us), write time (us): 343 , 1731 , 146
Sample #, loop time (us), write time (us): 344 , 1823 , 146
Sample #, loop time (us), write time (us): 345 , 1924 , 147
Sample #, loop time (us), write time (us): 346 , 1782 , 143
Sample #, loop time (us), write time (us): 347 , 1759 , 132
Sample #, loop time (us), write time (us): 348 , 1787 , 143
Sample #, loop time (us), write time (us): 349 , 1881 , 144
Sample #, loop time (us), write time (us): 350 , 1781 , 146
Sample #, loop time (us), write time (us): 351 , 1768 , 145
Sample #, loop time (us), write time (us): 352 , 1893 , 267
Sample #, loop time (us), write time (us): 353 , 1717 , 145
Sample #, loop time (us), write time (us): 354 , 1748 , 133
Sample #, loop time (us), write time (us): 355 , 1717 , 140
Sample #, loop time (us), write time (us): 356 , 1758 , 157
Sample #, loop time (us), write time (us): 357 , 1789 , 149
Sample #, loop time (us), write time (us): 358 , 1832 , 151
Sample #, loop time (us), write time (us): 359 , 1786 , 142
Sample #, loop time (us), write time (us): 360 , 1746 , 148
Sample #, loop time (us), write time (us): 361 , 1772 , 151
Sample #, loop time (us), write time (us): 362 , 1840 , 144
Sample #, loop time (us), write time (us): 363 , 1843 , 151
Sample #, loop time (us), write time (us): 364 , 1759 , 146
Sample #, loop time (us), write time (us): 365 , 1747 , 145
Sample #, loop time (us), write time (us): 366 , 1746 , 139
Sample #, loop time (us), write time (us): 367 , 1871 , 137
Sample #, loop time (us), write time (us): 368 , 1957 , 280
Sample #, loop time (us), write time (us): 369 , 1828 , 149
Sample #, loop time (us), write time (us): 370 , 1771 , 150
Sample #, loop time (us), write time (us): 371 , 1801 , 152
Sample #, loop time (us), write time (us): 372 , 1693 , 146
Sample #, loop time (us), write time (us): 373 , 1775 , 149
Sample #, loop time (us), write time (us): 374 , 1794 , 150
Sample #, loop time (us), write time (us): 375 , 1756 , 152
Sample #, loop time (us), write time (us): 376 , 1722 , 148
Sample #, loop time (us), write time (us): 377 , 1790 , 139
Sample #, loop time (us), write time (us): 378 , 1765 , 147
Sample #, loop time (us), write time (us): 379 , 1715 , 146
Sample #, loop time (us), write time (us): 380 , 1704 , 150
Sample #, loop time (us), write time (us): 381 , 1721 , 146
Sample #, loop time (us), write time (us): 382 , 1804 , 143
Sample #, loop time (us), write time (us): 383 , 86822 , 85204
Sample #, loop time (us), write time (us): 384 , 1739 , 145
Sample #, loop time (us), write time (us): 385 , 1815 , 143
Sample #, loop time (us), write time (us): 386 , 1872 , 148
Sample #, loop time (us), write time (us): 387 , 1988 , 146
Sample #, loop time (us), write time (us): 388 , 2009 , 146
Sample #, loop time (us), write time (us): 389 , 1860 , 149
Sample #, loop time (us), write time (us): 390 , 1890 , 149
Sample #, loop time (us), write time (us): 391 , 1790 , 139
Sample #, loop time (us), write time (us): 392 , 1726 , 146
Sample #, loop time (us), write time (us): 393 , 1909 , 139
Sample #, loop time (us), write time (us): 394 , 1986 , 144
Sample #, loop time (us), write time (us): 395 , 1859 , 148
Sample #, loop time (us), write time (us): 396 , 1974 , 144
Sample #, loop time (us), write time (us): 397 , 1991 , 148
Sample #, loop time (us), write time (us): 398 , 2108 , 262
Sample #, loop time (us), write time (us): 399 , 1971 , 151
Sample #, loop time (us), write time (us): 400 , 1896 , 148
Sample #, loop time (us), write time (us): 401 , 1977 , 145
Sample #, loop time (us), write time (us): 402 , 2059 , 144
Sample #, loop time (us), write time (us): 403 , 1972 , 151
Sample #, loop time (us), write time (us): 404 , 1786 , 143
Sample #, loop time (us), write time (us): 405 , 1850 , 145
Sample #, loop time (us), write time (us): 406 , 1909 , 151
Sample #, loop time (us), write time (us): 407 , 1876 , 154
Sample #, loop time (us), write time (us): 408 , 1818 , 141
Sample #, loop time (us), write time (us): 409 , 1866 , 150
Sample #, loop time (us), write time (us): 410 , 2095 , 146
Sample #, loop time (us), write time (us): 411 , 2040 , 150
Sample #, loop time (us), write time (us): 412 , 1966 , 147
Sample #, loop time (us), write time (us): 413 , 2222 , 268
Sample #, loop time (us), write time (us): 414 , 1805 , 150
Sample #, loop time (us), write time (us): 415 , 1772 , 152
Sample #, loop time (us), write time (us): 416 , 1811 , 138
Sample #, loop time (us), write time (us): 417 , 1794 , 145
Sample #, loop time (us), write time (us): 418 , 1762 , 151
Sample #, loop time (us), write time (us): 419 , 1848 , 145
Sample #, loop time (us), write time (us): 420 , 1770 , 140
Sample #, loop time (us), write time (us): 421 , 1922 , 146
Sample #, loop time (us), write time (us): 422 , 2019 , 150
Sample #, loop time (us), write time (us): 423 , 1996 , 143
Sample #, loop time (us), write time (us): 424 , 2017 , 148
Sample #, loop time (us), write time (us): 425 , 1945 , 142
Sample #, loop time (us), write time (us): 426 , 1812 , 146
Sample #, loop time (us), write time (us): 427 , 2000 , 148
Sample #, loop time (us), write time (us): 428 , 1987 , 255
Sample #, loop time (us), write time (us): 429 , 2148 , 146
Sample #, loop time (us), write time (us): 430 , 1861 , 150
Sample #, loop time (us), write time (us): 431 , 1994 , 147
Sample #, loop time (us), write time (us): 432 , 1857 , 148
Sample #, loop time (us), write time (us): 433 , 1941 , 141
Sample #, loop time (us), write time (us): 434 , 1890 , 149
Sample #, loop time (us), write time (us): 435 , 1887 , 149
Sample #, loop time (us), write time (us): 436 , 1762 , 129
Sample #, loop time (us), write time (us): 437 , 1972 , 149
Sample #, loop time (us), write time (us): 438 , 1967 , 152
Sample #, loop time (us), write time (us): 439 , 1806 , 141
Sample #, loop time (us), write time (us): 440 , 1775 , 147
Sample #, loop time (us), write time (us): 441 , 1726 , 144
Sample #, loop time (us), write time (us): 442 , 1768 , 148
Sample #, loop time (us), write time (us): 443 , 1790 , 140
Sample #, loop time (us), write time (us): 444 , 2017 , 267
Sample #, loop time (us), write time (us): 445 , 1989 , 134
Sample #, loop time (us), write time (us): 446 , 1889 , 150
Sample #, loop time (us), write time (us): 447 , 1919 , 137
Sample #, loop time (us), write time (us): 448 , 1851 , 139
Sample #, loop time (us), write time (us): 449 , 1876 , 150
Sample #, loop time (us), write time (us): 450 , 1879 , 143
Sample #, loop time (us), write time (us): 451 , 1876 , 150
Sample #, loop time (us), write time (us): 452 , 1869 , 143
Sample #, loop time (us), write time (us): 453 , 1906 , 143
Sample #, loop time (us), write time (us): 454 , 1884 , 137
Sample #, loop time (us), write time (us): 455 , 1971 , 147
Sample #, loop time (us), write time (us): 456 , 2110 , 149
Sample #, loop time (us), write time (us): 457 , 1979 , 153
Sample #, loop time (us), write time (us): 458 , 1959 , 146
Sample #, loop time (us), write time (us): 459 , 2040 , 266
Sample #, loop time (us), write time (us): 460 , 2004 , 150
Sample #, loop time (us), write time (us): 461 , 1928 , 147
Sample #, loop time (us), write time (us): 462 , 1910 , 131
Sample #, loop time (us), write time (us): 463 , 1939 , 149
Sample #, loop time (us), write time (us): 464 , 1817 , 143
Sample #, loop time (us), write time (us): 465 , 1836 , 151
Sample #, loop time (us), write time (us): 466 , 1759 , 144
Sample #, loop time (us), write time (us): 467 , 1764 , 134
Sample #, loop time (us), write time (us): 468 , 1929 , 133
Sample #, loop time (us), write time (us): 469 , 1878 , 145
Sample #, loop time (us), write time (us): 470 , 1913 , 150
Sample #, loop time (us), write time (us): 471 , 1955 , 154
Sample #, loop time (us), write time (us): 472 , 1876 , 155
Sample #, loop time (us), write time (us): 473 , 1955 , 150
Sample #, loop time (us), write time (us): 474 , 2047 , 259
Sample #, loop time (us), write time (us): 475 , 1823 , 150
Sample #, loop time (us), write time (us): 476 , 1903 , 140
Sample #, loop time (us), write time (us): 477 , 1951 , 148
Sample #, loop time (us), write time (us): 478 , 1877 , 152
Sample #, loop time (us), write time (us): 479 , 1969 , 154
Sample #, loop time (us), write time (us): 480 , 1929 , 146
Sample #, loop time (us), write time (us): 481 , 1899 , 140
Sample #, loop time (us), write time (us): 482 , 1962 , 148
Sample #, loop time (us), write time (us): 483 , 1909 , 145
Sample #, loop time (us), write time (us): 484 , 1852 , 145
Sample #, loop time (us), write time (us): 485 , 1986 , 144
Sample #, loop time (us), write time (us): 486 , 1796 , 155
Sample #, loop time (us), write time (us): 487 , 1787 , 146
Sample #, loop time (us), write time (us): 488 , 1831 , 148
Sample #, loop time (us), write time (us): 489 , 1922 , 279
Sample #, loop time (us), write time (us): 490 , 1817 , 149
Sample #, loop time (us), write time (us): 491 , 1723 , 145
Sample #, loop time (us), write time (us): 492 , 1724 , 143
Sample #, loop time (us), write time (us): 493 , 1860 , 149
Sample #, loop time (us), write time (us): 494 , 1975 , 154
Sample #, loop time (us), write time (us): 495 , 1916 , 150
Sample #, loop time (us), write time (us): 496 , 1972 , 145
Sample #, loop time (us), write time (us): 497 , 1945 , 146
Sample #, loop time (us), write time (us): 498 , 1731 , 149
Sample #, loop time (us), write time (us): 499 , 1687 , 148
Sample #, loop time (us), write time (us): 500 , 1782 , 149
Sample #, loop time (us), write time (us): 501 , 1799 , 148
Sample #, loop time (us), write time (us): 502 , 1773 , 144
Sample #, loop time (us), write time (us): 503 , 1770 , 150
Sample #, loop time (us), write time (us): 504 , 87073 , 85402
Sample #, loop time (us), write time (us): 505 , 1786 , 146
Sample #, loop time (us), write time (us): 506 , 1747 , 150
Sample #, loop time (us), write time (us): 507 , 1792 , 143
Sample #, loop time (us), write time (us): 508 , 1769 , 141
Sample #, loop time (us), write time (us): 509 , 1705 , 145
Sample #, loop time (us), write time (us): 510 , 1747 , 145
Sample #, loop time (us), write time (us): 511 , 1872 , 147
Sample #, loop time (us), write time (us): 512 , 1806 , 152
Sample #, loop time (us), write time (us): 513 , 1747 , 150
Sample #, loop time (us), write time (us): 514 , 1745 , 147
Sample #, loop time (us), write time (us): 515 , 1796 , 147
Sample #, loop time (us), write time (us): 516 , 1738 , 144
Sample #, loop time (us), write time (us): 517 , 1763 , 147
Sample #, loop time (us), write time (us): 518 , 1861 , 148
Sample #, loop time (us), write time (us): 519 , 1785 , 144

.... and so on...

Thanks,
Tipo

I suspect that the writing is buffered. Till such time that the buffer is full, data is only written to the buffer which is fast; once the buffer is full, it's flushed to the SPI flash which takes time.

No idea about a solution.

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.