Low Voltage Programming of PIC® Devices

Last modified by Microchip on 2023/11/09 09:11

There are two modes for programming a PIC® Microcontroller, High Voltage (HV) mode, and Low Voltage (LV) mode. The Low-Voltage Programming (LVP) mode allows the PIC Flash MCUs to be programmed using the operating voltage VDD of the device. This offers many advantages to In-Circuit Serial Programming™ (ICSP™) designs.

A new PIC device will have the configuration set to LVP mode when purchased. Any of the Microchip development tools can program the device using the LVP method. Many of the latest development boards, such as the Curiosity Board, use LVP mode for the built-in device programmer.

LVP Configuration Setting

When the LVP bit of the Configuration Registers is set to 1, the low-voltage ICSP programming entry is enabled. To disable the low-voltage ICSP mode, the LVP bit must be programmed to 0.

Typical LVP Configuration Register Layout

lvp config

LVP: Low Voltage Programming Enable bit
1 = Low-voltage programming enabled. MCLR/VPP pin function is MCLR.
0 = HV on MCLR/VPP must be used for programming.

The LVP bit cannot be written (to zero) while operating from the LVP programming interface. The purpose of this rule is to prevent the user from dropping out of LVP mode while programming from LVP mode, or accidentally eliminating LVP mode from the configuration state. The LVP bit can only be reprogrammed to ‘0’ by using the High-Voltage Programming mode.

LVP Mode Setup

Entry into the Low-Voltage Programming Entry mode requires the following steps:

  1. MCLR is brought to Low Logic Voltage Level (VIL).
  2. A 32-bit key sequence is presented on the ICSP Data (ICSPDAT) pin while clocking ICSP Clock (ICSPCLK) pin.

Once the key sequence is complete, MCLR must be held at VIL for as long as Program/Verify mode is to be maintained.
Any of the Microchip Programmer/Debugger tools handle this setup through the MPLAB® X IDE.

Older 8-bit devices have a PGM pin that needs to be set to a logic level externally. Refer to the datasheet of your device for the correct LVP method.

MCLR Pin operation in LVP

MCLR is an input pin that can reset the device when it is enabled. The MCLR pin can also be configured as a standard digital input-only pin. The MCLRE Configuration Bit enables or disables the MCLR pin.

mclre

If LVP is enabled (LVP = 1), the MCLR pin is automatically enabled and cannot be disabled.

MCLR ENABLED

When MCLR is enabled and the pin is held low, the device is held in Reset. The MCLR pin is connected to VDD through an internal weak pull-up resistor.

MCLR DISABLED

When MCLR is disabled, the MCLR pin becomes a digital input-only pin and can have an internal weak pull-up resistor through software control.

MCLR WEAK PULL-UP

The MCLR/ Digital Input Only pin has an individually controlled weak internal pull-up resistor that is connected to VDD. A bit in the Weak PullUp (WPUxx) register enables 1 or disables 0 the pull-up when in digital input-only pin mode. There is also a configuration bit MCLRE that will enable 1 or disable the pull-up when the pin is set to MCLR mode.

When the LVP mode is enabled, (MCLRE = x and LVP = 1), the MCLR internal pull-up is enabled and the digital input-only weak pull-up resistor software setting has no effect.