LowPowerLab / SPIFlash

Arduino library for read/write access to SPI flash memory chips
GNU General Public License v3.0
173 stars 91 forks source link

add Cypress/Ramtron FRAM support + add readManufacturerId() function #14

Open martinayotte opened 8 years ago

martinayotte commented 8 years ago

add Cypress/Ramtron FRAM support + add readManufacturerId() function

martinayotte commented 8 years ago

Hi Felix ! As you can see, I've done additional commits. I've received some W25Q128, and probably due to QA testing, the WPS bit in Status3 was HIGH, so the whole Write Protect Scheme was in Individual Block Locks mode, so now initialize() take care of reseting that.

LowPowerLab commented 8 years ago

Thanks much, I need to look into this in more detail! Can you confirm that apart from mem size, the 128mbit W25Q128 should be equivalent to the 4mbit chip I am officially using (W25X40)?

martinayotte commented 8 years ago

Hi Felix, As I said, probably not so clearly, when I try my W25Q128, I was able to retreive ChipID and UniqueID, but trying to write into flash failed. Then, I've added readStatus3(), and I've figured out that WPS bit was high. Reading the datasheet, it was explained that it turns the WriteProtect into mode where Individual Block Lock bits are used. I had to turn it off to have normal mode. So, that means the Initialize() should not only clear Status1, but also Status3.

martinayotte commented 8 years ago

Hi Felix, Any news about this PR ?

LowPowerLab commented 8 years ago

I looked at the code a while ago and I think the conclusion was that because there is device specific code in there, my gut tells me I should not merge that. It's too specific to a particular chip, this is a generic library. An inherited class derivation is more appropriate. If you submit that I can probably merge something like that. Thanks

martinayotte commented 8 years ago

As mentioned above, the whole Cypress/Ramtron family is using the 7F7F as a "continuation" ID because the returned ID is in fact 72 bits instead 24 bits like most other chips. So, your library will simply not support them ...