Low Power Application on PIC32CM LE00 Using MPLAB® Harmony v3 Peripheral Libraries: Step 4

Last modified by Microchip on 2023/11/16 06:59

Configure Power Manager (PM) Peripheral Library

Click on the Resource Management [MCC] tab, In the Device Resources, expand Peripherals > PM.
Double-click, or drag and drop, PM to add the PM peripheral library to the project graph.

PM box


Select the PM peripheral library and configure it as shown.

  • Set the Performance Level to 0 to reduce the power consumption of the device during Standby mode.
  • Enable Force device to run in PL0.
  • Enable Put RAM in low power during standby mode.
  • Enable Put TrustRAM in low power during standby mode.
  • Set the Power Domain Configuration to PDSW Forced ACTIVE
  • Enable Dynamic Power Gating: These options allow the device to turn off a power domain during Standby mode if no peripheral contained in this power domain requests its clock.
  • Set the Voltage Regulator to operate in Low-power oriented mode during standby to reduce the power consumption of the device even more.

PM configuration options

This completes the configuration of the PM peripheral library. In Standby mode, the CPU is stopped as well as the peripherals except those which are configured to run in Standby mode. The Standby Sleep mode provides very low power consumption with little overhead on wake-up time. CPU enters Standby mode by executing the Wait for Interrupt (WFI) instruction and exits from the Standby mode when an interrupt is generated.

Back to Top

Configure SUPC Peripheral Library

Click on the Resource Management [MCC] tab, In the Device Resources, expand Peripherals > SUPC.
Double-click, or drag and drop, SUPC to add the Supply Controller (SUPC) peripheral library to the project graph.

SUP box


Select the SUPC peripheral library and configure it as shown.

  • Select the VDD Brown-Out Detector (BOD) Configuration
    • Select the Select Active mode operation to Sampling Mode. This configuration optimizes and reduces power consumption in Idle mode. And enables monitoring of the power supply to settle at the right voltage on startup to monitor if the voltage goes too low and to react accordingly by triggering a reset, or an interrupt.
    • Set the BOD33 Voltage Reference Selection to Selects ULPVREF for the BOD33 for less power consumption which uses Ultra Low power Reference.
  • Select the Voltage Regulator (VREG) Configuration
    • Set the Voltage Regulator Voltage Reference Selection to Selects ULPVREF for the VREG for less power consumption which uses Ultra Low power Reference.
    • Enable the Increase low power mode efficiency bit to optimize and reduce power consumption in Standby mode.

SUPC configuration options

This completes the configuration of the SUPC peripheral library. The SUPC manages the voltage reference and power supply of the device. It also controls the voltage regulators for the core domain. Voltage regulators need to be configured for low power applications, which helps in reducing power consumption.

Back to Top

Configure NVMCTRL Peripheral Library

The Non-volatile Memory Controller (NVMCTRL) is added by default to the project graph. Select the NVMCTRL peripheral library and configure it as shown.

  • Set Wait States to 1 to read the non-volatile memory. When the device is put in performance level 0, the device clock frequency can not exceed 12 MHz, and one wait-state is required.
  • Set the Power Reduction Mode During Sleep to WAKEUP INSTANT. This bit configures the NVMCTRL to wake up the Flash memory when the CPU wakes up from Standby mode, which allows it to reduce device wake-up time.
  • Disable the Instruction Cache to reduce the device's wake-up time. When the cache is enabled, the device will look for an instruction to fetch upon interrupt in the cache at first. If the instruction is found, the device wakes up quicker, but if not, a cache miss occurs and the wake up time is longer. This option is good to enable when the instruction to fetch upon an interrupt is always stored in the cache memory, which is not the case here as we have different interrupt sources.

nvmctrl configuration options

This completes the configuration of the NVMCTRL peripheral library. The NVMCTRL is set to optimize the performance for waking the device up while keeping the power consumption as low as possible.

Back to Top

Configure LED

Open the Pin Configuration tab by clicking Project Graph > Plugins > Pin Configuration.

pin settings tool


Once the MCC Pin Settings window is opened, scroll down to pin number 59, and then configure this pin as shown:

  • Set the pin #59 as GPIO:
    • Pin ID = PC19
    • Custom Name = LED0
    • Function = GPIO
    • Direction = Out
    • Latch = Low

GPIO pin settings

Back to Top