Previously added to a solved thread - now withdrawn.
I am trying to get the Fujitsu SPI FRAM working MB85RS1MT.
I can read the chip ID OK so the SPI is OK.
I can’t seem to get the writeData() working - not sure whether I have misunderstood the write protection and use of the status register vis the write protect pin.
/WP pin is pulled up to 3V3 with a 10K resistor and so is /HOLD.
I am not using Block Protect hence BP1,0 = 0 and WPEN = 0 and WEL = 1 - that should mean unprotected blocks and status register are free to write? The status register is written to in the begin() function and I can read that and see that it has been set to 0x02.
Does anyone have a working writeData function they could share so I can then see the error of my ways?
Below is the writeData() function I am using.
bool MB85RS::writeData(uint32_t framAddr, uint8_t *buf, size_t bufLen)
{
if (framAddr + bufLen > length()) return false; //write over the end of the memory
writeStatus((uint8_t) (MB85RSXMT_WRITE_ENABLE));
beginTransaction();
SPI.transfer((byte) MB85RSXMT_WREN);
SPI.transfer((byte) MB85RSXMT_WRITE);
SPI.transfer((byte) ((framAddr >> 16) & 0x03));
SPI.transfer((byte) (framAddr >> 8));
SPI.transfer((byte) (framAddr & 0xFF));
SPI.transfer(buf, NULL, bufLen, NULL);
SPI.transfer((byte) MB85RSXMT_WRDI);
endTransaction();
return true;
}