Good afternoon, I'm developing a board with a set of sensors.
I use a 256 kbit FRAM (MB85RC256) to store the data.
In the beginning I used an already assembled breakboard, and it worked correctly. I'm currently implementing the FRAM hip directly on the pcb, which has caused me some problems.
The controller of my circuit is an atmega328p, in the serial print it returns the memory address correctly (0x50), however, when I try to print the available memory using the "FRAM.h" library it returns 0.
I can't write or read data either.
I think there's something wrong with my circuit. I tried changing the memory and that didn't work either.
As you can see, in my circuit I have a 3.3V supply for the sensors and for the FRAM, a 3.3V i2c pull-up resistor with a 4.7K resistor. And an i2c to 5V converter, which is the power supply for my Atmega.
The sensors are working correctly in this configuration, but the memory is not.
I thought the problem was also with the supplier, but I tested it with a memory taken from the FRAM Breakboard itself afterwards, and it didn't work either.
It is possible that a I2C Scanner sketch sees a chip, but reading and writing is not possible. It happens more on this forum. In most cases the I2C bus is too slow, has too much noise, the voltage levels do not match, or there is OLED display on the I2C bus.
I am looking at the level shifter
Are you saying that the FRAM is working when it is connected to the ATmega chip and not when it is behind the level shifter ?
The FRAM works at 3.3V and 5V, it would be better to use it with 5V and connect it to the ATMega.
Did you buy the level shifter from AliExpress ?
Both the datasheet and Sparkfun have 100pF for the capacitor at VREF2. You have 100nF.
Are there other things with pullup resistors ?
It is possible to measure the current for SDA and SCL by measuring the short circuit current.
Upload a sketch with only Wire.begin() in setup() and a empty loop().
Measure the current from SDA to GND, and from SCL to GND. They should be the same and they should not exceed the 3mA.
5V/60k + 5V/4k7 + 3.3V/4k7 = 1.8 mA
That matches with your measurements.
The datasheet for the voltage regulator says: "It is recommended to use X7R or X5R dielectric capacitor if 1.0μF ceramic capacitor is selected as input/output capacitors".
You have 10μF, but they are X5R, so I assume that they are okay.
Can you measure after the 200k what the voltage of VREF2 is ? Perhaps there is something on the PCB that conducts electricity and leaks away some current. I assume that it should be between 4.5 and 5.0V.
Do you have the newest version of the FRAM library ? A bug was fixed in January.
If the other I2C chips are okay, then perhaps the FRAM chip is sensitive for timing or noise problems.
Maybe others would like to see the PCB layout. SDA should not go side-by-side with SCL over the PCB for more than 10cm.
How about a redesign with a ATmega chip at 8MHz and running at 3.3V, so the level shifter is no longer needed ?
I've just done a more interesting test on this library.
I put my FRAM Breakboard directly into an Arduino Nano, and got the same error.
That means the library is faulty, right?
The pictured solder joints don't look promising. They need to be cleaned up and checked for solder bridges and proper continuity. Adafruit and Sparkfun have excellent tutorials on soldering.
Without a doubt, this wasn't one of my best jobs...
I found something interesting here.
I made the breakboard circuit from scratch and put in the fram, and it worked!
I need to adapt it to my pcb now, as there must be some more complicated error in it.
I used 10K pull-up resistors, do you think that might have made it work?
The PCA9306 is a weird chip with a large resistor to VREF2. I don't know if 3.4V for VREF2 is good.
But I have to tell you that I don't understand why they made VREF2 that way.