daniel-p-carvalho opened a new pull request, #20848:
URL: https://github.com/apache/nuttx/pull/20848

   > **Depends on #20847.** This branch is stacked on that PR (the fix for the 
open count of the SMPS upper half): its first commit is the commit of #20847 
and will disappear when this branch is rebased after that PR is merged. Please 
review only the two commits after it: the driver and its documentation.
   
   ## Summary
   
   Add a lower-half driver for the Texas Instruments LM51772 buck-boost 
controller, controlled over I2C, on top of the common SMPS interface 
(`nuttx/power/smps.h`, `/dev/smpsN`).
   
   - The converter regulates a constant output voltage (`SMPS_OPMODE_CV`, the 
only mode) with an output current limit.
   - The controller is enabled through a board callback (the EN/UVLO pin) and 
configured on the first `PWRIOC_START`. The register list of the board is 
written, the step of the output voltage is read back from `MFR_SPECIFIC_D8`, 
and the output target and the current limit are applied before the power stage 
is turned on. `PWRIOC_STOP` stops switching and discharges the output, and the 
last close disables the controller.
   - The board describes the hardware in `lm51772_config_s`: the I2C bus, 
frequency and address, the output sense resistor, the enable callback, the 
registers written at start and optional absolute maximum ratings (minimum and 
maximum output voltage, output current and output power). The limits and the 
parameters set through the SMPS interface are refused when they exceed the 
ratings, including a `v_out * i_out` above the power rating.
   - Faults come from `STATUS_BYTE`.
   - `smps.h` now includes `nuttx/mutex.h`, which it already needs for the 
close lock.
   - Two documentation pages are added to the power-related drivers: the SMPS 
upper half and the LM51772.
   
   ## Impact
   
   - New option `CONFIG_SMPS_LM51772`, default `n`, depends on 
`CONFIG_DRIVERS_SMPS` and `CONFIG_I2C`. Existing configurations are not 
affected.
   - `smps.h` gets one `#include`. It already uses `mutex_t`, so this only 
makes the header self-contained.
   - No board in the tree uses the driver yet. It runs on an out-of-tree board 
(STM32G474 with the LM51772 on I2C2), which is not part of this PR.
   - Documentation: `Documentation/os/drivers/special/power/smps.rst`, 
`lm51772.rst` and two lines in the index.
   
   ## Testing
   
   Hardware: an LM51772 on a custom STM32G4 board, 24 V input, no load, 400 kHz 
I2C bus.
   
   Tested:
   - Repeated start and stop at 9, 12, 15, 20 and 24 V without a power cycle.
   - Readback of the configured registers and of `STATUS_BYTE`.
   - Refusal of an output voltage, current or power above the ratings.
   - A start with a controller that does not answer: the error is returned by 
`PWRIOC_START` and the controller is left disabled.
   - Input undervoltage: `VIN_UV` is reported as `SMPS_FAULT_OTHER` and the 
state becomes `SMPS_STATE_FAULT`. The output stopped at about 6.7 V and came 
back at about 8 V (`VDET` set to 6.9 V falling and 8.0 V rising), and `VIN_UV` 
stays latched until the faults are cleaned.
   
   Not tested:
   - Load: regulation, current limit and hiccup protection.
   - An overcurrent fault.
   - I2C failure while the converter runs.
   - The input overvoltage protection.
   
   Host: `tools/nxstyle` passes on the new C files and headers. The 
documentation builds with Sphinx 6.2.1 without warnings in the new pages.
   


-- 
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

To unsubscribe, e-mail: [email protected]

For queries about this service, please contact Infrastructure at:
[email protected]

Reply via email to