Quantcast
Channel: Arduino Forum - Latest topics
Viewing all articles
Browse latest Browse all 15454

I2C Fram circuit not worked (MB85RC256)

$
0
0

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.

My circuit:

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.

FRAM Breakboard circuit (Adafruit):
Capttyrtyrsdfgturar

Serial print:

Recebido: C:\Users\Matheus Markies\AppData\Local\Temp\.arduinoIDE-unsaved2024322-16248-98p6p7.uy5q7\FRAM9_test\FRAM9_test.ino
FRAM_LIB_VERSION: 0.7.0
   KB  :	0
BYTES  :	512
Write	0	1
Write	1	1
Write	2	2
Write	3	2
Write	4	3
Write	5	3
Write	6	4
Write	7	4
Write	8	5
Write	9	5
Write	10	6
Write	11	6
Write	12	7
Write	13	7
Write	14	8
Write	15	8
Write	16	9
Write	17	9
Write	18	10
Write	19	10
Write	20	11
Write	21	11
Write	22	12
Write	23	12
Write	24	13
Write	25	13
Write	26	14
Write	27	14
Write	28	15
Write	29	15
Write	30	16
Write	31	16
Write	32	17
Write	33	17
Write	34	18
Write	35	18
Write	36	19
Write	37	19
Write	38	20
Write	39	20
Write	40	21
Write	41	21
Write	42	22
Write	43	22
Write	44	23
Write	45	23
Write	46	24
Write	47	24
Write	48	25
Write	49	25
Write	50	26
Write	51	26
Write	52	27
Read	0	1	164
Read	1	1	30
Read	2	2	24
Read	3	2	27
Read	4	3	22
Read	5	3	31
Read	6	4	24
Read	7	4	24
Read	8	5	27
Read	9	5	31
Read	10	6	26
Read	11	6	26
Read	12	7	25
Read	13	7	23
Read	14	8	29
Read	15	8	28
Read	16	9	0
Read	17	9	0
Read	18	10	0
Read	19	10	0
Read	20	11	0
Read	21	11	

Test-Fram.ino:

//
//    FILE: FRAM9_test.ino
//  AUTHOR: Rob Tillaart
// PURPOSE: demo FRAM9 memory test
//     URL: https://github.com/RobTillaart/FRAM_I2C


#include "FRAM.h"

FRAM9 fram;

uint32_t start;
uint32_t stop;

uint32_t sizeInBytes = 0;


void setup()
{
  Serial.begin(115200);
  Serial.println(__FILE__);
  Serial.print("FRAM_LIB_VERSION: ");
  Serial.println(FRAM_LIB_VERSION);

  Wire.begin();

  int rv = fram.begin(0x50);
  if (rv != 0)
  {
    Serial.print("INIT ERROR: ");
    Serial.println(rv);
  }

  //  get size
  Serial.print("   KB  :\t");
  Serial.println(fram.getSize());
  Serial.print("BYTES  :\t");
  Serial.println(fram.getSizeBytes());
  sizeInBytes = fram.getSizeBytes();

  delay(100);

  test();

  Serial.println("done...");
}


void loop()
{
}


void test()
{
  //  addr goes from 0 .. 512
  //  value goes from 0.. 255

  uint8_t value = 0x00;
  for (uint32_t addr = 0; addr < sizeInBytes; addr++)
  {
    if (addr % 2 == 0) value++;
    fram.write8(addr, value);
    Serial.print("Write\t");
    Serial.print(addr);
    Serial.print("\t");
    Serial.println(value);
  }

  // read back
  value = 0x00;
  for (uint32_t addr = 0; addr < sizeInBytes; addr++)
  {
    if (addr % 2 == 0) value++;
    uint8_t x = fram.read8(addr);
    if (x != value)
    {
      Serial.print("Read\t");
      Serial.print(addr);
      Serial.print("\t");
      Serial.print(value);
      Serial.print("\t");
      Serial.println(x);
    }
  }

}

//  -- END OF FILE --

FRAM link: https://pt.aliexpress.com/i/4000117998517.html

8 posts - 4 participants

Read full topic


Viewing all articles
Browse latest Browse all 15454

Trending Articles