You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am trying to write data to an eeprom with some success but not quite. The chip is a 93c46 128 words at 8 bit or 64 words at 16 bit. The data to go in is in 64 word (16 bit) format as follows:
data to go in
When i write it to the chip and read it back i get:
data comes out
So its like its only writing one half of the value into each word.
I am using the code as below, with the data converted from hex to string to match the input type of the example code.
#include <93C46.h>
/*
* Example Sketch demonstration on how to write to (and read from) a 93C46 eeprom
*
* Wiring:
* Pin 7(CS) to Chip pin 1
* Pin 9(CS) to Chip pin 2
* Pin 10(DI/MOSI) to Chip pin 3
* Pin 11(DO/MISO) to Chip pin 4
*
* (For some chips:) GND/VCC to Chip pin 6
* This determines the organization:
* HIGH is 64x16 (Use EEPROM_MODE_16BIT)
* LOW is 128x8 (Use EEPROM_MODE_8BIT)
*
*/
#define pCS 10
#define pSK 13
#define pDI 11
#define pDO 12
// Prints all words of the buffer
void debugPrint(word* buff, int len) {
Serial.print("\n\t00\t01\t02\t03\t04\t05\t06\t07\t08\t09\t0A\t0B\t0C\t0D\t0E\t0F");
for(int i = 0; i < len; i++) {
if(i % 16 == 0) {
Serial.println();
Serial.print(i, HEX);
}
Serial.print("\t");
if(buff[i] < 0x10) {
Serial.print("0");
}
Serial.print(buff[i], HEX);
}
}
void setup() {
bool longMode = EEPROM_93C46_MODE_16BIT;
eeprom_93C46 e = eeprom_93C46(pCS, pSK, pDI, pDO);
e.set_mode(longMode);
Serial.begin(9600);
Serial.println("Writing data...");
// First, enable EW (Erase/Write)
e.ew_enable();
String writeBuffer;
if(longMode) {
writeBuffer = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ£çô3Ø¡²¥";
//writeBuffer = (!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!,!, ,ÿÿ,ÿÿ,ÿÿ,ÿÿ,ÿÿ,ÿÿ,ÿÿ,£,,ç,ô3,Ø¡,²,¥);
} else {
writeBuffer = "!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! ÿÿÿÿÿÿÿÿÿÿÿÿÿÿ£çô3Ø¡²¥";
}
int len = longMode ? 64 : 128;
// Write your data
for(int i = 0; i < len; i++) {
e.write(i, writeBuffer[i]);
}
// Optionally, disable EW after writing
e.ew_disable();
Serial.println("Reading data...\n");
word readBuffer[len];
for(int i = 0; i < len; i++) {
word r = e.read(i);
readBuffer[i] = r;
Serial.print(char(r));
}
debugPrint(readBuffer, len);
Serial.println();
}
void loop() {}
The text was updated successfully, but these errors were encountered:
Hey, I don't check this repository all too often, so my apologies for the late reply.
Please make sure that your chip is the 93C46C variant that has an ORG pin and make sure it is asserted high. It looks like the chip is still in the 8-bit configuration.
I am trying to write data to an eeprom with some success but not quite. The chip is a 93c46 128 words at 8 bit or 64 words at 16 bit. The data to go in is in 64 word (16 bit) format as follows:
data to go in
When i write it to the chip and read it back i get:
data comes out
So its like its only writing one half of the value into each word.
I am using the code as below, with the data converted from hex to string to match the input type of the example code.
The text was updated successfully, but these errors were encountered: