Hi, I am trying to reflash a 24c02 eeprom whilst in circuit, or perhaps even emulate it using an arduino nano. Programming is really not my strong point, but I have managed to dump the contents of the eeprom out over the serial monitor. The eeprom is used to store a page count on a laser printer, so I wish to return it to it's original image as and when required.
Idea one was to emulate the chip on an AT328, and having it reset to it's initial image when it was power cycled. I naively assumed the libraries would easily do it, but i now understand there is a lot more to it than that.
Secondly, I could just reflash the eeprom using my arduino when needed, but my searches are only coming up with ways to reflash an arduino bootloader.
I think trying to write these from scratch, whilst being a good learning experience, would have a steep difficulty curve and that assumes it is possible. Are there any projects that might be similar that I might learn from by studying the code?
Thank you
This is my code to read the eeprom, mostly taken from examples on this site.
#include <Wire.h>
void setup()
{
Wire.begin();
Wire.beginTransmission(0x53); // part address is 0x53
Wire.write(0); //Sends 0 down the bus
Wire.endTransmission();
Serial.begin(9600);
}
void loop()
{
Serial.print("\nReady\n");
for (byte bank = 0; bank < 16; bank++)
{
byte data[16]; // a byte array to store 16 bytes
Wire.requestFrom(0x53, 16); // request 16 bytes
for (byte i = 0; i < 16; i++)
{
data[i] = Wire.read(); // store each byte into the array
Serial.print ("0x");
Serial.print (data[i],HEX);
Serial.print ( ", ");
}
Serial.print ("\n");
delay(1000);
}
}
Aethelstan:
That's quite some going to invent something like that. Would you care to quote me where I said any of your invented facts?
Why don't YOU explain why you want to reset the number of pages printed? I can't think of a single legitimate reason for doing that. The printer knows how many pages it has printed.
Bacause it makes me buy a new toner cartridge at 1200 pages, even if there is toner left. I find it wasteful. I could buy replacement chips from aliexpress, but I thought it was an interesting problem that I might learn from. I certainly didn't expect baseless accusations of fraud against a non existent boss.
I apologize for jumping to conclusions about what you were trying to accomplish.
I think I understand, though, why the toner cartridge knows how many pages it can print, and won't let you print more. It thinks that each page is going to take about the same amount of toner to print. So, after printing n pages, it thinks that there is not enough toner left to guarantee that the next page will be printed correctly.
That seems to me like a decision that should be left to the guy that has to buy the overpriced toner cartridges.
If you are able to read the existing EEPROM, it seems like you should be able to write to it, too. I'm guessing that the 0 you send it in setup() tells it that you want to read. The rest of the code simply reads the data from the EEPROM. I'm guessing that you'd send it a 1 to write to EEPROM, then send it the address and the new value.
I am a broke student, it is my printer and I would rather buy a bottle of toner than a whole new cartridge. The printer (Ricoh SP 100e) is a gimped version if one that just refills without the eeprom, so I know they are engineered to be refilled, they just have an artificial barrier on the budget version.
The zero sent during set up is an address offset, basically setting the pointer to zero. I need to research how the protocol works a bit better to see how to put it into write mode.
I have managed to find some examples of writing to a 24c256, I think the addressing is different, but I am able to understand what the code is doing by looking at it, so hopefully this will set me on my way