I have read (better take a glimpse on) the source code. There is a program loop:
Code:
//Write
write_start();
for (int x = 0; x < BUFFERSIZE; ++x) fast_write(addr + x, cmdbuf[x+5]);
write_end();
This for-loop calls fast_write(addr,data) for
each byte to be programmed. That won't work for the AT29C256.
Take a look at page 3 of the datasheet you submitted:
Quote:
PROGRAM: The device is reprogrammed on a page basis. If a byte of data within a
page is to be changed, data for the entire page must be loaded into the device. Any byte
that is not loaded during the programming of its page will be indeterminate. Once the
bytes of a page are loaded into the device, they are simultaneously programmed during
the internal programming period. After the first data byte has been loaded into the
device, successive bytes are entered in the same manner. Each new byte to be programmed
must have its high-to-low transition on WE (or CE) within 150 μs of the low-tohigh
transition of WE (or CE) of the preceding byte. If a high-to-low transition is not
detected within 150 μs of the last low-to-high transition, the load period will end and the
internal programming period will start. A6 to A14 specify the page address. The page
address must be valid during each high-to-low transition of WE (or CE). A0 to A5 specify
the byte address within the page. The bytes may be loaded in any order; sequential
loading is not required. Once a programming operation has been initiated, and for the
duration of tWC, a read operation will effectively be a polling operation.
This means you have to rewrite the //write... to pass a pointer to the first of a chunk of 64 bytes of a "page" (here this means A6...A14 are constant, A0..A5 varies) to the fast_write() function. Then fast_write() needs to write all 64 bytes quickly (= less than 150 µs per byte), then wait >=150µs, and then start polling. Once the chip is ready (two sequential reads deliver the same data) fast_write() can return. Then the next chunk can follow.
I think this is more than a "little" rework. As I have no Arduino at hand (nor the burner hardware) I cannot provide working SW for you. Sorry
BTW the "algorithm" to program a 27C512 isn't the way the chip manufacturer recommends. It
may work with "new" parts, but there is a great chance the EPROM will "forget" what was written soon.
Regards,
Arne
edited (1) - typos, grammar