I can program bytes. But when I try to program bytes after a sector erase operation, the first few program attempts usually, but do not always, fail

I did find a big bug in my toggle routine–it was reading the data bus without touching the CS and RD lines, so it was just reading 0xff the whole time. Of course, there was no toggling if that happens unless there is just noise on the floating D6. But the max byte write time is 20 microseconds, the max sector erase time is 25 ms, and the max chip erase is 100ms. So it shouldn’t be in those modes.

I hypothesized that may there could be an address issue and that the bytes were written but to the wrong location. So I did a full sweep of the flash (which took a long time) and discovered that it was not the case, but also that A17 and A16 weren’t changing. It’s related to the comparison to the previous address.

So, I have 2 problems to work on. A17 and A16 not changing because ((addr^(lastAddr) & 0xfff00L) doesn’t seem to be working.

I also want to speed things up and make block transfers easier. So that’s my agenda for today.