Electrical – Programming USB OTG PIC32 through USB in MPLAB

microcontrollermplabpicusbusb-otg

I have a PIC32 that has USB OTG. How would I program it through a USB cable in MPLAB? Does it work out of the box of does it need additional software.

Best Answer

In general, you need to use one of a small number of 'approved' programmers from within MPLAB X to program a part:

  • PICkit3
  • ICD3
  • REAL ICE
  • PM3
  • PKOB (see below)

Some development kits provide you a USB 'programming port' but if you study the schematic, you'll see that what you're interfacing with is the equivalent circuitry and firmware of a PICkit3 embedded on the board. This shows up as PKOB or 'PICkit on-board'.

I do USB work and I don't reprogram from within MPLAB X - I build my HEX file then switch over to my bootloader application to program the part. Assuming your device was USB-bootloadable you could modify the build process to call a bootloader program as a post-build step. (You would still need a bootloader, and an official programmer to get the bootloader into the part in the first place, but hey.)