AM62Px MCU+ SDK  10.01.00
PMIC

The PMIC driver provides API to control I2C based PMIC present in the board. It supports configuration of various features/modules in the PMIC. I2C controller is used to read/write to the PMIC registers. Refer to the corresponding PMIC datasheet for more details.

Features Supported

  • Support enable/disable watchdog
  • Watchdog in trigger and Q&A mode with interrupt/reset support upon failure
  • GPIO configuration
  • Thermal monitoring
  • Voltage monitoring

SysConfig Features

Note
It is strongly recommend to use SysConfig where it is available instead of using direct SW API calls. This will help simplify the SW application and also catch common mistakes early in the development cycle.
  • Option to specify I2C address for the register pages
  • Toggle watchdog functionality
  • Watchdog mode selection
  • Single/dual I2C communication mode selection
  • Watchdog parameters configuration
  • Warm reset option upon watchdog failure

Features NOT Supported

  • ADC
  • CRC check for read and write

Important Usage Guidelines

  • Power cycle the board to restore the PMIC register configurations.

Example Usage

Include the below file to access the APIs

#include <board/pmic.h>
#include <board/pmic/pmic_i2c.h>
#define CONFIG_PMIC0 (0U)
#define MAIN_I2C (0U)
#define CONFIG_PMIC_NUM_INSTANCES (1U)
/* PMIC Driver handles - opened during Board_pmicOpen() */
PMIC_Handle gPmicHandle[CONFIG_PMIC_NUM_INSTANCES];
/* PMIC LLD Driver handles - opened during Pmic_init() */
Pmic_CoreHandle_t gPmicCoreHandle[CONFIG_PMIC_NUM_INSTANCES];
Pmic_CoreCfg_t gPmicCoreCfg[CONFIG_PMIC_NUM_INSTANCES] =
{
{
.pmicDeviceType = PMIC_DEV_BURTON_TPS6522X,
.slaveAddr = 0x48,
.nvmSlaveAddr = 0x49,
.qaSlaveAddr = 0x12,
.i2c1Speed = PMIC_I2C_STANDARD_MODE,
.pFnPmicCommIoRead = &PMIC_i2cRead,
.pFnPmicCommIoWrite = &PMIC_i2cWrite,
.validParams = (PMIC_CFG_DEVICE_TYPE_VALID_SHIFT | PMIC_CFG_COMM_MODE_VALID_SHIFT | \
PMIC_CFG_SLAVEADDR_VALID_SHIFT | PMIC_CFG_QASLAVEADDR_VALID_SHIFT | \
PMIC_CFG_NVMSLAVEADDR_VALID_SHIFT | PMIC_CFG_COMM_IO_RD_VALID_SHIFT | \
PMIC_CFG_COMM_IO_WR_VALID_SHIFT | PMIC_CFG_I2C1_SPEED_VALID_SHIFT | \
PMIC_CFG_CRITSEC_START_VALID_SHIFT | PMIC_CFG_CRITSEC_STOP_VALID_SHIFT),
.instType = PMIC_MAIN_INST,
.commMode = PMIC_INTF_SINGLE_I2C,
.pFnPmicCritSecStart = &PMIC_critSecStartFn,
.pFnPmicCritSecStop = &PMIC_critSecStopFn,
},
};
/* PMIC Config */
PMIC_Config gPmicConfig[CONFIG_PMIC_NUM_INSTANCES] =
{
{
.pmicConfigData = (Pmic_CoreCfg_t *)&gPmicCoreCfg[CONFIG_PMIC0],
.pmicCoreHandle = (Pmic_CoreHandle_t *)&gPmicCoreHandle[CONFIG_PMIC0],
},
};
/* PMIC params */
PMIC_Params gPmicParams[CONFIG_PMIC_NUM_INSTANCES] =
{
{
.mainDrvinstance = MAIN_I2C,
},
};
uint32_t gPmicConfigNum = CONFIG_PMIC_NUM_INSTANCES;

Instance Open Example

gPmicHandle[CONFIG_PMIC0] = NULL;
gPmicHandle[CONFIG_PMIC0] = PMIC_open(CONFIG_PMIC0, &gPmicParams[CONFIG_PMIC0]);
if (!gPmicHandle[CONFIG_PMIC0])
{
}

Instance Close Example

PMIC_close(gPmicHandle[CONFIG_PMIC0]);

GPIO pin configuration example

/* Configure a GPIO pin in the PMIC */
int32_t status = PMIC_ST_SUCCESS;
Pmic_GpioCfg_t gpioCfg =
{
.pinDir = PMIC_GPIO_INPUT,
.pinFunc = PMIC_TPS6522X_GPIO_PINFUNC_GPIO6_NERR_MCU,
.pullCtrl = PMIC_GPIO_PULL_DOWN,
.deglitchEnable = PMIC_GPIO_DEGLITCH_ENABLE,
};
status = Pmic_gpioSetConfiguration(gPmicConfig[CONFIG_PMIC0].pmicCoreHandle, \
PMIC_TPS6522X_GPIO6_PIN, gpioCfg);
if (PMIC_ST_SUCCESS != status)
{
}

API

APIs for PMIC

status
uint32_t status
Definition: tisci_lpm.h:1
PMIC_critSecStartFn
void PMIC_critSecStartFn(void)
Initiates the start of a critical section for PMIC operations. This function attempts to acquire a se...
PMIC_init
void PMIC_init(void)
This function initializes the PMIC module.
PMIC_close
void PMIC_close(PMIC_Handle handle)
Close PMIC driver.
PMIC_critSecStopFn
void PMIC_critSecStopFn(void)
Concludes a critical section for PMIC operations. This function releases the semaphore,...
PMIC_Params
Parameters passed during PMIC_open()
Definition: pmic.h:106
NULL
#define NULL
Define NULL if not defined.
Definition: csl_types.h:100
PMIC_Config::pmicConfigData
Pmic_CoreCfg_t * pmicConfigData
Definition: pmic.h:82
pmic.h
PMIC_Params::mainDrvinstance
uint32_t mainDrvinstance
Definition: pmic.h:107
PMIC_open
PMIC_Handle PMIC_open(uint32_t instanceId, const PMIC_Params *params)
Open PMIC driver.
PMIC_Config
PMIC driver configuration, these are filled by SysCfg based on the device that is selected.
Definition: pmic.h:81
DebugP_assert
#define DebugP_assert(expression)
Function to call for assert check.
Definition: DebugP.h:175
PMIC_Handle
void * PMIC_Handle
Handle to the PMIC driver returned by PMIC_open()
Definition: pmic.h:65
FALSE
#define FALSE
Definition: csl_types.h:62