Switched-Mode Power Supply (smps)
The SMPS driver is split into an “upper half” character driver
(drivers/power/supply/smps.c) and chip-specific “lower half” drivers.
It is enabled with CONFIG_DRIVERS_SMPS. The application interface is
defined in include/nuttx/power/smps.h and
include/nuttx/power/power_ioctl.h. A lower half registers itself with
smps_register() as /dev/smpsN.
Application interface
IOCTL |
Argument |
Description |
|---|---|---|
|
|
Select the operation mode |
|
|
Set the absolute limits |
|
|
Set the output voltage, current and power |
|
none |
Start the converter |
|
none |
Stop the converter |
|
|
Get the state and the faults |
|
|
Get the faults |
|
|
Set a fault |
|
|
Clear the latched faults |
Commands that the upper half does not know are forwarded to the ioctl
operation of the lower half.
Sequence
Select a mode with
PWRIOC_SET_MODE. The upper half refusesPWRIOC_STARTwhile the mode isSMPS_OPMODE_INIT.Set the limits with
PWRIOC_SET_LIMITS, withlockset to true. The limits can not be changed after they are locked, and the upper half refusesPWRIOC_STARTandPWRIOC_SET_PARAMSuntil they are set and locked.Set the parameters with
PWRIOC_SET_PARAMS. The upper half refuses parameters above the limits with-EPERM. The parameter that the mode regulates must be set:v_outforSMPS_OPMODE_CV,i_outforSMPS_OPMODE_CCandp_outforSMPS_OPMODE_CP. The parameters can be set again while the converter runs, unless they are locked.Start and stop the converter with
PWRIOC_STARTandPWRIOC_STOP.
The lower half setup operation is called when the device is opened for
the first time and shutdown when it is closed for the last time, with
interrupts disabled. The open count is kept for every open, so closing a
descriptor does not shut the converter down while another one is open.
Supported chips
Chip |
Bus |
Notes |
|---|---|---|
LM51772 |
I2C |
Buck-boost controller, constant voltage only. See TI LM51772 buck-boost controller. |
The b-g474e-dpow1 and stm32f334-disco boards register an SMPS
device that is driven by the smps Switched-Mode Power Supply
example.