Microchip® Advanced Software Framework

Quick start guide for PMIC driver

This is the quick start guide for the PMIC driver and the closely related global interrupt driver, with step-by-step instructions on how to configure and use the drivers in a selection of use cases.

The use cases contain several code fragments. The code fragments in the steps for setup can be copied into a custom initialization function, while the steps for usage can be copied into, e.g., the main application function.

Basic use case

In this basic use case, the PMIC is configured for:

  • all interrupt levels enabled
  • round-robin scheduling

This will allow for interrupts from other modules being used.

Setup steps

Prerequisites

For the setup code of this use case to work, the following must be added to the project:

  1. Interrupts for the module requiring the PMIC module have to be enabled.
  2. An Interrupt Service Routine (ISR) for a given interrupt vector has to be defined, where the interrupt vectors available are defined by toolchain and listed in the subsection 'Interrupt Vector Summary' in the data sheet.
    ISR(interrupt_vector){
    //Interrupt Service Routine
    }

Example code

Add to the initialization code:

Workflow

  1. call the PMIC driver's own init function to enable all interrupt levels:
  2. enable round-robin instead of fixed priority interrupt scheduling:
  3. enable interrupts globally:
    • Attention
      Interrupts will not trigger without this step.

Advanced use cases

For more advanced use of the PMIC driver, see the following use cases: