I'm currently away from home and forgot to pack my PICKIT3 and now I need to flash a few PIC16F1705's . So what to do? Purchase another PICKIT or just repurpose something that I actually did put in my bag? I choose the latter since I don't want to lug around even more stuff than I'm already doing, and why spend money when I can do a cool hack instead? ;-)
This device will allow me to just hook up the ESP via 5 wires to a PIC and then just open a browser on my laptop, navigate to the ESP webpage over wifi and then drag and drop the hex file to be flashed onto the PIC. Nice and easy.
After a day worth of document reading, hacking and debugging code I can now read/set the fuse bits and also flash and dump the code memory of the PIC. This with the PIC hex code hardcoded into a string array in the esppic software.
Even if I could flash and read back the code successfully my PIC test firmware did't work - the pic looked completely dead. I spend an hour debugging the esp code and focused on the fuse/config settings, but no joy. Then I realised that my pic test code was broken. I didn't use the LAT register for toggling the port for the flashing LED. Doh! I'm really too experienced to spend that long time on a beginners mistake like that. ^__^
So now I basically just have to patch in the webserver code so code can be uploaded over wifi instead of being hardcoded. Ans also make the code support more than just the 16F1705 of course.
I think that the RAM in the ESP8266 will be enough to handle up to 16KW devices, for bigger devices I might have to upgrade to the ESP32.... Or maybe I can upload the hex directly to a file onto the SPIFFS file system. Then I can handle hex files bigger than what the largest PIC requires.
But for the time being I'm happy with just hardcoded support for the 8Kword 16F1705 device.
I have hooked up the ESP and the PIC with a LED on a solderless breadboard. Time to start coding - this shouldn't be too hard. The Microchip LVP protocol is rather simple and have decent docs.