No, you don't need to, in fact you can't, use SPI, UART, or I2C to program the PIC. The only way to get a new program into a PIC that doesn't have special code loaded for that purpose (a bootloader) is to use the external hardware programming interface. Electrically, this means connecting to Vss, MCLR, PGC, and PGD. It can be useful to have the programmer also connected to Vdd, but not necessary for this chip as long as the Vdd level is known and the programmer adjusted accordingly.
The low level hardware interface is quite simple. PGD is the data line, which is sampled by the PIC on the falling edge of PGC (the clock line). To get the PIC into programming mode in the first place, a special 32 bit key is clocked in relative to specific edges on MCLR (although see note below regarding high voltage programming).
The higher level protocol gets more complicated. Most things are done with 6 bit commands, some of which are followed by 14 bit data words. You have to read the programming spec carefully. Note that the programming spec is a separate document from the datasheet. Go to the product page for your particular PIC on the Microchip web site, and you will find a link to the programming spec in the documents section.
Added about high voltage programming
These kinds of PICs have two ways to enter programming mode, high voltage (HVP) and low voltage (LVP). The high voltage method requires raising MCLR to between 8 and 9 volts and to keep it there during programming. This method always works, regardless of any possible data programmed into the PIC.
The low voltage method of entering programming mode starts by driving MCLR high, then low, then clocking in a special 32 bit key sequence using PGC and PGD normally. The part will enter programming mode upon the correct key sequence, and will stay in programming mode as long as MCLR is held low.
The low voltage method can be disabled by one of the config bits. However, the erased state of the config bit allows low voltage programming, it is shipped from the factory that way, and this config bit can only be set to disallow LVP if programming was entered with the high voltage method. Therefore, for LVP to not be enabled, all the following have to be true:
- The PIC was last programmed with a HVP-capable programmer, and the HVP program entry mode was used.
- The HEX file programmed into the PIC deliberately sets the LVP bit in config word 2 to the non-erased state.
Since disabling LVP pretty much requires a deliberate action and the right programmer, it is likely still enable. If it was deliberately disabled for some strange reason, then you have to supply 8-9 V on MCLR to get the PIC into programming mode at least long enough to perform a bulk erase (which re-enables LVP).
Best Answer
A fully erased chip would require some kind of programmer driving the SPI lines. This could potentially be a very simple piece of hardware, assuming you had the matching software to do the programming.
When they say:
This is because the firmware itself is capable of erasing and writing the flash. That means you can program the chip with a bootloader and then talk to that bootloader via whatever interfaces it supports (in this case, USB). This is extremely common for modern microcontrollers.
The product brief says that it comes pre-programmed with the USB bootloader, so as long as you don't erase it you can program your application via USB:
So you can see you must take some care not to overwrite the bootloader and you must provide some way to get back into it from your application (for example, by checking that a particular pin is low because a "prog" button is being held down when it powers on). If you break the bootloader you have "bricked" the chip until you fix it with a SPI programmer.