SPI FRAM not working - any ideas

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;
}

Clearly not many users of SPI FRAM out there in the community!?

For anyone who might need to know, after methodically trying all the combinations the result was this:

WP pin connect to GND [Edit - can also be left not connected]
HOLD pin 10K pull-up to 3V3
Don’t set status register at start-up in begin() - in other words status register is 0x00
Allow a short delay after setting the chip select pin 50mSec
When calling the operation codes WREN and WRDI call beginTransaction() before and endTransaction() after each.

I went over the datasheet several times and this isn’t what it says but hey-ho it is working.

2 Likes