Hello Everyone,
I did quite a bit of digging, and I don't see that too many folks have used the flashram I picked solely based on capacity and cost from Mouser. The 16 megabyte x 8, Adesto AT25QF128A @ $1.52 ea, not too bad for the size. Fortunately, it seems I may have picked relatively wisely, as it seems to be detected by the SPIMemory library, and even supports SFDP.
I have a PCB I built myself which has an atmega32u4 running the 8MHz 3.3V (have also tried 16MHz too, same result) running the Leonardo bootloader at the moment connected to this chip. The CS pin for memory is on arduino Pin 7 and I am running the built-in diagnostic example program provided with the SPIMemory library. It more or less works, but I see errors on reads and writes sporadically like crazy. I will also mention in full disclosure, I may well have fried this chip. I have on more than one occasion overvolted it to 5V messing around with other problems I had on the board. But, the trooper that it seems to be, it 100% of the time will erase, and it always reads the JEDEC ID, sees it's SFDP capable etc. My own code works for reads & writes too. I am waiting on a new IC now, and I wouldn't post here if I didn't think I was having a library issue. I promise!
I uncommented the following three settings in SPIMemory.h per the docs:
#define USES_SFDP
#define RUNDIAGNOSTIC
#define DISABLEOVERFLOW
In addition, I would have thought SFDP would read the capacity correctly, and I have even tried to instantiate flash by specifying: flash.begin(MB(16));
That should be a match for this chip. No matter what combination I have tried, I always see this when I run the diag:
Initialising..........
Chip Diagnostics initiated.
SFDP available
Error code: 0x12
Error code: 0x13
Chip identified using sfdp. Most of this chip's functions are supported by the library.
No Chip size defined by user. Checking library support.
Chip identified. This chip is fully supported by the library.
SPIMemory Library version: < 2.5.0
JEDEC ID: 0x1F8901
Man ID: 0x1F
Memory ID: 0x89
Capacity: 524288
Max Pages: 2048
Unique ID: 2395288456731648, 0x234274408D991C00
The two errors thrown from SFDP are here:
#define NOSFDPERASETIME 0x12
#define NOSFDPPROGRAMTIMEPARAM 0x13
Neither of these seem to be a deal breaker, and should pull the capacity just fine. I also forced it to 16MB, but the output always says I didn't specify it. So I think what may be happening is that there is one Adesto flash IC supported by SPIMemory, and it sees the 0x1F manufacturer ID and says, aha! It's this chip. That IC so happens to be a 512kb chip, which is what it is detecting. I cannot seem to override this with SFDP nor by forcing the value.
I also wrote a quick bit of code to simply erase the whole chip, then loop from address 0x0-0xFFFFFF. I simply write each byte as 0x00 and immediately read it back to see if it matches. If not, I throw an error to the serial port. It works no problem until it hits 512kb, then throws error 0x05, which is out of bounds. So the lib won't even try to write past the capacity with DISABLEOVERFLOW enabled it seems.
I didn't tear through the library too much, as I'm probably not the best to debug something like this. I know technically this is an unsupported chip, but I do think it will work fine based on what I'm seeing.
Is there some other way to force 16MB I'm missing?
Thanks,
-Kevin