Jump to content
 
  • 0

Programming a PICmcu with a different MCU and LVP


N9WXU

Question

  • Member

I have a system where I am using a PICmcu as an I/O processor handling lots of real-time activities.  My main processor is some larger ARM (like a Raspberry Pi).  I could implement a boot loader on the PICmcu but that is very complex and uses code space.  I would like to simply use low voltage programming (LVP) and teach my host CPU to program the PICmcu directly.  How do I do this?

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • Member

I posed this question because I have seen it about as often as I have seen questions about boot loaders.

LVP is a fantastic choice for programming a PICmicro used in this situation.  Doing so will require a few things:

1) A hardware connection to the PICmcu from the host.

2) A host driver that can do the work.

Let us take these requirements in order.

First, the connection: While almost all the functions on a current generation PICmicro have selectable pins through the PPS feature, the LVP pins are NOT re-mappable.  That means you must hook them up first and then you can use PPS to steer some other interface onto the pins for the "normal" behavior.

Second, the software interface.  While Microchip Technology has never published a programming library for a host CPU, there are some interesting sources of information.  The best solution would be to adapt the software found here -> https://github.com/MicrochipTech/XPRESS-Loader Specifically, https://github.com/MicrochipTech/XPRESS-Loader/blob/master/MPLAB.X/lvp.c

The interface to the I/O pins is not well abstracted (assumes a PICmcu) but it would be trivial to the average user to create some init/set/clear functions and use those.

As a bonus, LVP and HV programming is identical except for the programming mode entry.  If your PICmcu does not have LVP and you have an easy way to apply 9-12v to the MCLR pin, then you can simply adjust the ICSP_init and ICSP_Release functions.

For the nitty-gritty of programming a PICmcu, you can look for programming specifications on Microchip's website.  Here is a link to a typical specification: http://ww1.microchip.com/downloads/en/DeviceDoc/41397B.pdf

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

 


×
×
  • Create New...