Hello.
Recently i purchased an DS3231 AT24C32 IIC after reading some Information about the Module, i downloaded several libraries, including theAT24C1024 library. After i run the Memtest, i came to the conclusion, that i wired up the module incorrectly. Can someone help me to find the correct wiring of the Module.
PS:The RTC part of the module works just fine.
The Module:
My wiring so far:
Arduino Nano: The Module:
GND GND
5V VCC
A5 SCL
A4 SDA
None SQW
None 32K
The code i ran:
/*
AT24C1024_EEPROM_Benchmark.ino
AT24C1024 EEPROM Benchmark Sketch
http://playground.arduino.cc/Code/I2CEEPROM24C1024
*/
#include <Wire.h>
#include <AT24C1024.h>
unsigned long time;
unsigned long finishTime;
unsigned long errors = 0;
unsigned long address = 0;
byte loop_size;
// Set to a higher number if you want to start at a higher address.
#define MIN_ADDRESS 0
// Upper boundary of the address space. Choose one.
#define MAX_ADDRESS 131072 // 1 device
//#define MAX_ADDRESS 262144 // 2 devices
//#define MAX_ADDRESS 393216 // 3 devices
//#define MAX_ADDRESS 524288 // 4 devices
void setup()
{
// Make sure we aren't reading old data
randomSeed(analogRead(0));
loop_size = random(1, 100);
Serial.begin(9600);
Serial.println();
Serial.println("AT24C1024 EEPROM Library Benchmark Sketch");
Serial.println();
writeByByteTest();
readByByteTest();
}
void loop()
{
}
void writeByByteTest()
{
time = millis();
errors = 0;
Serial.println("--------------------------------");
Serial.println("Write By Byte Test:");
Serial.println();
Serial.print("Writing data:");
for (address = MIN_ADDRESS; address < MAX_ADDRESS; address++)
{
EEPROM1024.write(address, (uint8_t)(address % loop_size));
if (!(address % 5000)) Serial.print(".");
}
finishTime = millis() - time;
Serial.println("DONE");
Serial.print("Total Time (seconds): ");
Serial.println((unsigned long)(finishTime / 1000));
Serial.print("Write operations per second: ");
Serial.println((unsigned long)(MAX_ADDRESS / (finishTime / 1000)));
Serial.println("--------------------------------");
Serial.println();
}
void readByByteTest()
{
time = millis();
errors = 0;
Serial.println("--------------------------------");
Serial.println("Read By Byte Test:");
Serial.println();
Serial.print("Reading data:");
for (address = MIN_ADDRESS; address < MAX_ADDRESS; address++)
{
uint8_t data;
data = EEPROM1024.read(address);
if (data != (uint8_t)(address % loop_size))
{
Serial.println();
Serial.print("Address: ");
Serial.print(address);
Serial.print(" Should be: ");
Serial.print((uint8_t)(address % loop_size), DEC);
Serial.print(" Read val: ");
Serial.println(data, DEC);
errors++;
}
if (!(address % 5000)) Serial.print(".");
}
finishTime = millis() - time;
Serial.println("DONE");
Serial.println();
Serial.print("Total Test Time (secs): ");
Serial.println((unsigned long)(finishTime / 1000));
Serial.print("Read operations per second: ");
Serial.println((unsigned long)(MAX_ADDRESS / (finishTime / 1000)));
Serial.print("Total errors: ");
Serial.println(errors);
Serial.println("--------------------------------");
Serial.println();
}
The outcome:
AT24C1024 EEPROM Library Benchmark Sketch
--------------------------------
Write By Byte Test:
Writing data:...........................DONE
Total Time (seconds): 684
Write operations per second: 191
--------------------------------
--------------------------------
Read By Byte Test:
Reading data:.
Address: 1 Should be: 1 Read val: 0
Address: 2 Should be: 2 Read val: 0
Address: 3 Should be: 3 Read val: 0
Address: 4 Should be: 4 Read val: 0
Address: 5 Should be: 5 Read val: 0
Address: 6 Should be: 6 Read val: 0
Address: 7 Should be: 7 Read val: 0
Address: 8 Should be: 8 Read val: 0
Address: 9 Should be: 9 Read val: 0
Address: 10 Should be: 10 Read val: 0
Address: 11 Should be: 11 Read val: 0
Address: 12 Should be: 12 Read val: 0
Address: 13 Should be: 13 Read val: 0
Address: 14 Should be: 14 Read val: 0
Address: 15 Should be: 15 Read val: 0
Address: 16 Should be: 16 Read val: 0
Address: 17 Should be: 17 Read val: 0
Address: 18 Should be: 18 Read val: 0
Address: 19 Should be: 19 Read val: 0
Address: 20 Should be: 20 Read val: 0
Address: 21 Should be: 21 Read val: 0
Address: 22 Should be: 22 Read val: 0
Address: 23 Should be: 23 Read val: 0
Address: 24 Should be: 24 Read val: 0
Address: 25 Should be: 25 Read val: 0
Address: 26 Should be: 26 Read val: 0
Address: 27 Should be: 27 Read val: 0
Address: 28 Should be: 28 Read val: 0
Address: 29 Should be: 29 Read val: 0
Address: 30 Should be: 30 Read val: 0
Address: 31 Should be: 31 Read val: 0
Address: 32 Should be: 32 Read val: 0
Address: 33 Should be: 33 Read val: 0
Address: 34 Should be: 34 Read val: 0
Address: 35 Should be: 35 Read val: 0
Address: 36 Should be: 36 Read val: 0
Address: 37 Should be: 37 Read val: 0
(It goes on like this forever.)