PIC18F46K22 EEPROM reading/writing specification
I have made a custom programmer for firmware upgrades on the field by retrofitting PIC18F46K22 based boards with a more modern micro that can read a stored .hex and controls the PGD PGC MCLR lines with an LVP approach. These were the pins available from production.
So far I have been able to reflash the PIC (code memory). The next step (which I hoped would be straight forward) was to read the EEPROM and write it back as the "Chip Erase" procedure wipes everything, including the EEPROM.
I have followed everything the Programming Specification document says, page 26 : http://ww1.microchip.com/downloads/en/DeviceDoc/41398B.pdf
I believe my understanding and implementation should be correct as I have managed to flash the chip, but I am obviously missing something or there is an issue that is not documented for the EEPROM.
I have tried variations of the commands, such as not doing the NOP, introducing delays, sending first the AddrH, etc. No luck.
I still don't understand why the "shift out data" in step4 is described like this:
0010 MSB LSB
Figure 4-4 does not quite match that description. It looks like a copy paste from Figure 4-1.
Isn't every read supposed to be [COMMAND] [8 DUMMY CLOCKS] [READ 8 BITS] ?
I have tried:
 [0000 0000] [READ BYTE]
 [READ BYTE] [READ BYTE]
Has anybody encountered issues around reading/writing to the EEPROM over the PGD/PGC pins? MPLab + Pickit4 does it so there must be a way. Any help is welcome.