SPI to eternal F-RAM

Arduino Due connected to CMOS4050 (level translation 3.6v) to Ramtron FM25H20 (2M SPI FRAM)
Please see attached code (SPI_02.ino) and logic anyliser image (SPI_write and SPI_read)
I am not sure if my write is wrong or read is, as I do not get the same data back???
The FRAM uses 3 bytes for address (18 bits) MSB first (standard SPI settings)
Have tried all sorts of variations, LSB, clock and data polarity, cutting down divde clock etc, but no luck
Noted that MISO is tri stated, does it need to be biased high? Did try that but still no luck…
Have tried another Due and FRAM, but again same result
So I assume I have a fault in the code…?
Please advice if possible.

SPI_02.ino (4.26 KB)

Have you got the W pin high?

Also there's this from the data sheet

The FM25H20 will power up with writes disabled. The WREN command must be issued prior to any write operation.


/W and /HOLD are tied high See code, WREN is sent first then WRITE, ADDRESS, DATA Then small delay READ, ADDRESS, then clock SPI_transfer(oxff) Thanks Also Merry Christmas......

Yes I see the WREN now.


Ok, have just changed circuit to suite SRAM 23k256 and adjusted code, (2 byte address, no WREN, and set reg to "sequence write and read" and it all works ok...! So I assume the problem is my protocol to the FRAM or some weird circuit setup... Any one got any constructive ideas for me? All I can think is the Register is not correctly setup, but I should at least get 1 byte into memory.... But can not even read the reg, or I am getting incorrect data back....? Frustrating :0

I am using the FM25H20 with pic24HJ/dspic33 with no issues (@3.3V, none level translation). Show us your schematics pls.

Hi Pito I do not have a "schematic prog" so as to give you a diagram. But can list as below,

Arduino pin (CMOS 4050 pin CMOS 4050 pin) FRAM pin description 10 --------------- 14 buffer 15 ------------ 1 Chip Select (SS) 11 --------------- 11 buffer 12 ------------ 5 Serial Data in (MOSI) (D) 12 --------------- 2 buffer 3 ------------ 2 Serial Data out (MISO) (Q) 13 --------------- 9 buffer 10 ----------- 6 Serial Clock (SLK) (C) 3.3v ------------- 1 8 VDD Gnd ------------- 8 4 GND


I do not have a “schematic prog” so as to give you a diagram.

If you have a way to take a digital picture - then you have a way to post a schematic, provided you own a pencil/pen and some paper.

..cmos4050 @3.3V may have ~100ns prop delays - be aware..

Ok, but it works with the SRAM. Same circuit. As I can not get a "valid" reading from the register in the FRAM (RDSR) I must assume my "read process" is incorrect.... Tried the 1Meg Fram (FM25V10_ds) which has a manufacture ID (9 bytes), but could not read that correctly.... So "reading" seems more the problem, I suspect. I would not think that the logic anyliser would cause corruption on the FRAM output, tried without it connected and sent "read" values by serial, same result.... What next? (I bet it is a stupid simple thing, just slightly out of my vision...!)

Well, change the FRAM, AGAIN and it all works…
I do not know why but 3 chips later and ever thing is ok :slight_smile:
I noticed on the power supply requirements that the power supplied must have a fast power up or the internal chip does not reset correctly?
May be this was the cause, but why does the 4th chip work?
Many thanks for your help and advice…(I will investigate more later)
Have a Great New Year.