It's very nice to have SPIFFS library to access the "internal flash" but it would be nice to have support external flash chip also.
You mean this library? https://github.com/PaulStoffregen/SerialFlash
Yeah there is this guy, how ever, it's not compatible with the ESP. this guy work for teensy and a little bit for arduino board, but only work for AVR and not ARM structure.
Basically seem to have incompatibility with the SPI library and something about 16bit transfer.
I can send you all the error message, if you want.
Using the CopyfromSD example
Arduino: 1.6.5 (Windows XP), Board: "Generic ESP8266 Module, 80 MHz, 40MHz, DIO, 115200, 512K (64K SPIFFS), ck, Disabled, None"
Build options changed, rebuilding all
C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash\SerialFlashChip.cpp: In static member function 'static void SerialFlashChip::read(uint32_t, void*, uint32_t)':
C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash\SerialFlashChip.cpp:169:28: error: no matching function for call to 'SPIClass::transfer(uint8_t*&, uint32_t&)'
SPIPORT.transfer(p, rdlen);
^
C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash\SerialFlashChip.cpp:169:28: note: candidate is:
In file included from C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash\SerialFlash.h:32:0,
from C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash\SerialFlashChip.cpp:28:
C:\Documents and Settings\gust\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0-rc1\libraries\SPI/SPI.h:64:11: note: uint8_t SPIClass::transfer(uint8_t)
uint8_t transfer(uint8_t data);
^
C:\Documents and Settings\gust\Application Data\Arduino15\packages\esp8266\hardware\esp8266\2.3.0-rc1\libraries\SPI/SPI.h:64:11: note: candidate expects 1 argument, 2 provided
Error compiling.
This report would have more information with
"Show verbose output during compilation"
enabled in File > Preferences.
1st error — change type of rdlen from unsigned long to unsigned or uint32_t. This is a bug in the example, function argument is declared as uint32_t and this is not the same as unsigned long (size is the same, types are different).
2nd error — add one line to esp8266/libraries/SPI/SPI.h:
void transfer(void *_buf, size_t count) { writeBytes((uint8_t*) _buf, (size_t) count); }
It did the trick. Thank you. :)
Sketch uses 236,941 bytes (54%) of program storage space. Maximum is 434,160 bytes.
Global variables use 32,712 bytes (39%) of dynamic memory, leaving 49,208 bytes for local variables. Maximum is 81,920 bytes.
I don't want to be annoying :D But the lisfile example return this:
ListFiles.ino: In function 'void setup()':
ListFiles:31: error: no matching function for call to 'SerialFlashChip::readdir(char [64], unsigned int, long unsigned int&)'
ListFiles.ino:31:65: note: candidate is:
In file included from ListFiles.ino:1:0:
C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash/SerialFlash.h:67:14: note: static bool SerialFlashChip::readdir(char*, uint32_t, uint32_t&)
static bool readdir(char *filename, uint32_t strsize, uint32_t &filesize);
^
C:\Documents and Settings\gust\My Documents\Arduino\libraries\SerialFlash/SerialFlash.h:67:14: note: no known conversion for argument 3 from 'long unsigned int' to 'uint32_t& {aka unsigned int&}'
I guess this library will be fully compatible once this is settle. Except for the MP3 part, but hey!
Forget about it, All is good, I updated your esp platform, and I forgot to fix the SPI.h thing, so it made problem in the other example listfile thing..
Thank you!
Most helpful comment
1st error — change type of rdlen from
unsigned longtounsignedoruint32_t. This is a bug in the example, function argument is declared asuint32_tand this is not the same asunsigned long(size is the same, types are different).2nd error — add one line to esp8266/libraries/SPI/SPI.h: