LTC4215 and LTC4215-2 - Hot Swap Controller with I2C Compatible Monitoring

Features

  • Allows Safe Insertion into Live Backplane
  • 8-Bit ADC Monitors Current and Voltage
  • I2C/SMBus Interface
  • Wide Operating Voltage Range: 2.9V to 15V
  • 20μs (LTC4215) or 420μs (LTC4215-2) Circuit Breaker Timeout
  • dI/dt Controlled Soft-Start
  • High Side Drive for External N-Channel MOSFET
  • No External Gate Capacitor Required
  • Input Overvoltage/Undervoltage Protection
  • Optional Latchoff or Auto-Retry After Faults
  • Alerts Host After Faults
  • Inrush Current Limit with Foldback
  • Available in 24-Pin (4mm × 5mm) QFN Package
  • LTC4215 also available in 16-Lead Narrow SSOP Package

Typical Application

LTC4215 Typical Application
LTC4215 Typical Application

Description

The LTC4215/LTC4215-2 Hot Swap controllers allow a board to be safely inserted and removed from a live backplane. Using an external N-channel pass transistor, board supply voltage and inrush current are ramped up at an adjustable rate. An I2C interface and onboard ADC allow for monitoring of load current, voltage and fault status.

The device features adjustable foldback current limit and a soft-start pin that sets the dI/dt of the inrush current. An I2C interface may configure the part to latch off or automatically restart after the LTC4215 detects a current limit fault.

The controller has additional features to interrupt the host when a fault has occurred, notify when output power is good, detect insertion of a load card, and power-up either automatically upon insertion or wait for an I2C command to turn on.

The LTC4215 has a 20μs circuit breaker filter for applications that require a fast fault response time and it defaults to latchoff after an overcurrent fault. The LTC4215-2 has an extended 420μs circuit breaker filter for applications where supply transients may exceed 20μs and it defaults to restart automatically after an overcurrent fault.

  Circuit Breaker Timeout
General Purpose Outputs
LTC4215 20us 1
LTC4215-1 20us 3
LTC4215-2 420us 1
LTC4215-3 420us 3

Packaging

CAD Symbols and Footprints: The downloadable Zip file below contains the schematic symbol and PCB footprints.

For complete and up to date package information and drawings, please refer to our packaging page

Part Number Package Code Temp Package
Drawing
RoHS
LTC4215CGN#PBF SSOP-16 GN C 05-08-1641 (GN16) Yes
LTC4215CGN#TRPBF SSOP-16 GN C 05-08-1641 (GN16) Yes
LTC4215CUFD-2#PBF 4x5 QFN-24 UFD C 05-08-1696 Yes
LTC4215CUFD-2#TRPBF 4x5 QFN-24 UFD C 05-08-1696 Yes
LTC4215CUFD#PBF 4x5 QFN-24 UFD C 05-08-1696 Yes
LTC4215CUFD#TRPBF 4x5 QFN-24 UFD C 05-08-1696 Yes
LTC4215IGN#PBF SSOP-16 GN I 05-08-1641 (GN16) Yes
LTC4215IGN#TRPBF SSOP-16 GN I 05-08-1641 (GN16) Yes
LTC4215IUFD-2#PBF 4x5 QFN-24 UFD I 05-08-1696 Yes
LTC4215IUFD-2#TRPBF 4x5 QFN-24 UFD I 05-08-1696 Yes
LTC4215IUFD#PBF 4x5 QFN-24 UFD I 05-08-1696 Yes
LTC4215IUFD#TRPBF 4x5 QFN-24 UFD I 05-08-1696 Yes


LTC4215 Package Drawing
LTC4215 Package Drawing

Order Info

  • Part numbers ending in PBF are lead free. Solder plated terminal finish (SnPb) versions are non-standard and special terms and conditions and pricing applies if available. Please contact LTC marketing for information.
  • Part numbers containing TR or TRM are shipped in tape and reel or 500 unit mini tape and reel, respectively
  • Please refer to our general ordering information or the product datasheet for more details

Package Variations and Pricing

Part Number Package Temp Price
(1-99)
Price
(1k)*
RoHS
LTC4215CGN#PBF SSOP-16 C $5.49 $3.75 Yes
LTC4215CGN#TRPBF SSOP-16 C $3.81 Yes
LTC4215CUFD-2#PBF 4x5 QFN-24 C $5.78 $3.95 Yes
LTC4215CUFD-2#TRPBF 4x5 QFN-24 C $4.01 Yes
LTC4215CUFD#PBF 4x5 QFN-24 C $5.78 $3.95 Yes
LTC4215CUFD#TRPBF 4x5 QFN-24 C $4.01 Yes
LTC4215IGN#PBF SSOP-16 I $6.59 $4.50 Yes
LTC4215IGN#TRPBF SSOP-16 I $4.56 Yes
LTC4215IUFD-2#PBF 4x5 QFN-24 I $6.94 $4.74 Yes
LTC4215IUFD-2#TRPBF 4x5 QFN-24 I $4.80 Yes
LTC4215IUFD#PBF 4x5 QFN-24 I $6.94 $4.74 Yes
LTC4215IUFD#TRPBF 4x5 QFN-24 I $4.80 Yes
Buy NowRequest Samples
* The USA list pricing shown is for BUDGETARY USE ONLY, shown in United States dollars (FOB USA per unit for the stated volume), and is subject to change. International prices may differ due to local duties, taxes, fees and exchange rates. For volume-specific price or delivery quotes, please contact your local Linear Technology sales office or authorized distributor.

Demo Boards

Linear Technology offers many demo boards free of charge to qualified customers. Contact your local sales office or distributor to inquire about a demo board. Certain demo boards are also available for sale via credit card on this website. Demo boards are for evaluation purposes only. It remains the customer’s responsibility to verify proper and reliable operation in the actual end application.

Part Number Description Price Documentation
DC874A LTC4215 Hot Swap Controller with ADC (req DC590) $100.00
Buy Now

Companion Boards

Part Number Description Price Documentation
DC2026C Linduino One Isolated USB Demo Board: An Arduino- and QuikEval-Compatible Code Development Platform $75.00
DC590B Isolated USB Serial Controller for Linear Technology QuikEval-Compatible Demo Boards $50.00
Buy Now
Click here to view our complete list of demo boards

Applications

  • Live Board Insertion
  • Electronic Circuit Breakers
  • Computers, Servers
  • Platform Management

Product Notifications

Please login to your MyLinear account for notifications of datasheet updates, new document releases and LTspice model announcements for your favorite products. If you do not have a MyLinear account you may Sign Up Now.

Forgot your password? Click here.
Need help? Email mylinear@linear.com with questions and comments.

Design Tools

LTspice

LTspice® software is a powerful, fast and free simulation tool, schematic capture and waveform viewer with enhancements and models for improving the simulation of switching regulators. Click here to download LTspice

Models for the following parts are available in LTspice:
LTC4215
LTC4215-1
LTC4215-2
LTC4215-3

Linduino

Linduino is an Arduino compatible platform for developing and distributing firmware libraries and code for SPI and I²C-compatible integrated circuits. The Linduino One board interfaces to more than 300 QuikEval demonstration cards, supporting a variety of product types including analog-to-digital converters (ADCs)digital-to-analog converters (DACs)power monitors, and more. Firmware libraries for individual devices are written in C and designed to be portable to a wide variety of processors and microcontrollers. Each library has a demonstration program that can be uploaded to the Linduino One platform to allow the circuit and software to be quickly and easily verified.

Click here for more information on Linduino

Code

Linduino is Linear Technology's Arduino compatible system for developing and distributing firmware libraries and example code for Linear Technology’s integrated circuits. The code below can be downloaded or copied and pasted into your project. Please visit the Linduino Home Page for demo board, manual and setup information.

This part is Code Supported: There is example code available for this part. The code below may rely on other drivers available in the full library.

Download LTC4215 - DC874A Linduino.INO File

/*!
Linear Technology DC874A Demonstration Board.
LTC4215: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

NOTES
  Setup:
   Set the terminal baud rate to 115200 and select the newline terminator. Provide
   the board with an external power supply of 12 V.   Ensure all jumpers on the
   demo board are installed in their default positions from the factory. Refer to
   Demo Manual DC874A.

   This program has options to measure voltage at ADIN pin (input voltage), SOURCE
   VOLTAGE (output voltage), and SENSE CURRENT (current through sense resisitor).
   There are also options to read and manipulate CONTROL register, ALERT register,
   and FAULT register.

   Mass write option can be achieved using Device Address = 0xBE. Refer to datasheet
   LTC4215.

USER INPUT DATA FORMAT:
 decimal : 1024
 hex     : 0x400
 octal   : 02000  (leading 0 "zero")
 binary  : B10000000000
 float   : 1024.0

@endverbatim

http://www.linear.com/product/LTC4215

http://www.linear.com/product/LTC4215#demoboards

REVISION HISTORY
$Revision: 6066 $
$Date: 2016-11-17 09:23:26 -0800 (Thu, 17 Nov 2016) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4215
*/

// Headerfiles
#include <Arduino.h>
#include <stdint.h>
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "QuikEval_EEPROM.h"
#include <Wire.h>
#include <SPI.h>
#include "LTC4215.h"

// Macros
#define SENSE_RESISTOR 0.004

// Function Declarations
void print_title();
void print_prompt();
int8_t main_menu_1_continuous_mode();
int8_t main_menu_2_read_and_clear_faults();
int8_t main_menu_3_send_ARA();
int8_t main_menu_4_manage_alerts();
int8_t main_menu_5_settings();
int8_t main_menu_6_read_all_registers();

//! Initialize Linduino
void setup()
{
  quikeval_I2C_init();                    // Enable the I2C port
  quikeval_I2C_connect();
  Serial.begin(115200);                   // Initialize the serial port to the PC
  print_title();
  print_prompt();
}

//! Repeats Linduino loop
void loop()
{
  if (1)
  {
    int8_t ack = 0;                            // I2C acknowledge indicator
    static uint8_t user_command;               // The user input command
    if (Serial.available())                     //! Do nothing if serial is not available
    {
      user_command = read_int();                //! Read user input command
      if (user_command != 'm')
        Serial.println(user_command);
      Serial.println();
      ack = 0;
      switch (user_command)                     //! Prints the appropriate submenu
      {
        case 1:
          ack |= main_menu_1_continuous_mode();       // continous mode
          break;
        case 2:
          ack |= main_menu_2_read_and_clear_faults(); // read and clear faults
          break;
        case 3:
          ack |= main_menu_3_send_ARA();// read address of alert
          break;
        case 4:
          ack |= main_menu_4_manage_alerts();         // manage alerts
          break;
        case 5:
          ack |= main_menu_5_settings();              // settings
          break;
        case 6:
          ack |= main_menu_6_read_all_registers();
          break;
        default:
          Serial.println("Incorrect Option");
          break;
      }

      print_prompt();
    }
  }
}

//! Print the title block
void print_title()
{
  Serial.println(F("\n*****************************************************************"));
  Serial.print(F("* DC874A Demonstration Program                                  *\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("* This program demonstrates how to send and receive data from   *\n"));
  Serial.print(F("* LTC4215 Hot Swap Controller with I2C Compatible Monitoring    *\n"));
  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
  Serial.print(F("*                                                               *\n"));
  Serial.print(F("*****************************************************************\n"));
}

//! Print the main menu
void print_prompt()
{
  Serial.print(F("\n\nMain Menu\n"));
  Serial.print(F("  1. Read current and voltage on continous mode\n"));
  Serial.print(F("  2. Read and clear faults\n"));
  Serial.print(F("  3. Request for alert response address (ARA)\n"));
  Serial.print(F("  4. Manage alerts\n"));
  Serial.print(F("  5. Settings\n"));
  Serial.print(F("  6. Read all registers\n\n"));
  Serial.print(F("Enter a command: "));
}

//! Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode
int8_t main_menu_1_continuous_mode()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  float sense_voltage, source_voltage, adin_voltage;
  uint8_t sense_code, source_code, adin_code;
  float adin_lsb = (1.23/255), adin_resisive_ratio = (155.4/12.4);
  float source_lsb = (15.44/255), source_resisive_ratio = 1;  // Set voltage divider ratio to 1, for no resistor divider circuit.
  float sense_lsb = (0.03845/255), sense_resisive_ratio = 1;

  do
  {
    uint8_t faults;
    Serial.print(F("********** Press Enter to Exit ***********\n\n"));
    ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_FAULT_REG, &faults);
    if (faults != 0)
    {
      Serial.println(F("Faults Detected :"));
      if (faults & LTC4215_FET_SHORT_FAULT )
        Serial.println(F("  FET SHORT DETECTED"));
      if (faults & LTC4215_EN_STATE_CHANGE)
        Serial.println(F("  !EN STATE CHANGE DETECTED"));
      if (faults & LTC4215_POWER_BAD_FAULT )
        Serial.println(F("  BAD POWER DETECTED"));
      if (faults & LTC4215_OVERCURRENT_FAULT )
        Serial.println(F("  OVERCURRENT DETECTED"));
      if (faults & LTC4215_UNDERVOLTAGE_FAULT )
        Serial.println(F("  UNDERVOLTAGE DETECTED"));
      if (faults & LTC4215_OVERVOLTAGE_FAULT )
        Serial.println(F("  OVERVOLTAGE DETECTED"));
    }
    else
      Serial.println(F("  NO FAULTS DETECTED"));

    ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_SENSE_REG, &sense_code);
    ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_SOURCE_REG, &source_code);
    ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_ADIN_REG, &adin_code);

    sense_voltage = LTC4215_code_to_voltage(sense_code, sense_lsb, sense_resisive_ratio);
    source_voltage = LTC4215_code_to_voltage(source_code, source_lsb, source_resisive_ratio);
    adin_voltage = LTC4215_code_to_voltage(adin_code, adin_lsb, adin_resisive_ratio);

    Serial.print(F("\nSENSE VOLTAGE CODE: "));
    Serial.println(sense_code);
    Serial.print(F("SENSE CURRENT CALCULATED: "));
    Serial.println((sense_voltage / SENSE_RESISTOR), 4);
    Serial.print(F("\nSOURCE VOLTAGE CODE: "));
    Serial.println(source_code, HEX);
    Serial.print(F("SOURCE VOLTAGE CALCULATED: "));
    Serial.println(source_voltage, 4);
    Serial.print(F("\nADIN CODE: "));
    Serial.println(adin_code, HEX);
    Serial.print(F("VOLTAGE CALCULATED AT ADIN: "));
    Serial.println(adin_voltage, 4);
    Serial.print("\n");
    delay(2000);
  }
  while (Serial.available()==false && ack== 0);
  if (Serial.available())
    read_int(); // clears the Serial.available()
  return (ack);
}

//! Function to read and clear fault register
int8_t main_menu_2_read_and_clear_faults()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;

  uint8_t faults;
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_FAULT_REG, &faults);
  if (faults != 0)
  {
    Serial.println(F("Faults Detected :"));
    if (faults & LTC4215_FET_SHORT_FAULT)
      Serial.println(F("  FET SHORT DETECTED"));
    if (faults & LTC4215_EN_STATE_CHANGE)
      Serial.println(F("  !EN STATE CHANGE DETECTED"));
    if (faults & LTC4215_POWER_BAD_FAULT)
      Serial.println(F("  BAD POWER DETECTED"));
    if (faults & LTC4215_OVERCURRENT_FAULT)
      Serial.println(F("  OVERCURRENT DETECTED"));
    if (faults & LTC4215_UNDERVOLTAGE_FAULT)
      Serial.println(F("  UNDERVOLTAGE DETECTED"));
    if (faults & LTC4215_OVERVOLTAGE_FAULT)
      Serial.println(F("  OVERVOLTAGE DETECTED"));
  }
  ack |= LTC4215_write(LTC4215_I2C_ADDRESS, LTC4215_FAULT_REG, 0x00);
  Serial.print(F("\nALL FAULTS CLEARED \n\n"));

  return (ack);
}

//! Function to send alert response (0001100) and read back the address of device that pulled ALERT pin low.
int8_t main_menu_3_send_ARA()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t address;
  ack |= LTC4215_ARA(LTC4215_I2C_ALERT_RESPONSE, &address);// send ARA
  Serial.print(F("  ALERT RESPONSE ADDRESS : 0x"));
  Serial.println(address,HEX);
  if (address == 0xFF && ack == 1)
  {
    ack = 0;
    Serial.print(F("  NO RESPONSE\n\n"));
  }
  return(ack);
}

//! Function to update alert register bits
int8_t main_menu_4_manage_alerts()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t alert_settings = 0;
  int8_t user_command;
  do
  {
    Serial.println(F("GPIO OUTPUT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_GPIO_OUTPUT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_GPIO_OUTPUT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("FET SHORT ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_FET_SHORT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_FET_SHORT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("!EN STATE CHANGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_EN_STATE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_EN_STATE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("POWER BAD ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_POWER_BAD_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_POWER_BAD_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERCURRENT ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_OVERCURRENT_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_OVERCURRENT_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("UNDERVOLTAGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_UNDERVOLTAGE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_UNDERVOLTAGE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERVOLTAGE ALERT"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      alert_settings |= LTC4215_OVERVOLTAGE_ENABLE;
    else if (user_command ==2)
      alert_settings &= LTC4215_OVERVOLTAGE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);
    ack |= LTC4215_write(LTC4215_I2C_ADDRESS, LTC4215_ALERT_REG, alert_settings);
    Serial.print(F("\n  ALERTS UPDATED\n\n"));
    Serial.println(F("  m. Main Menu"));
    Serial.println(F("  1. Repeat"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
  }
  while (!((user_command == 'm') || (ack)));
  return(ack);
}

//! Function to update control register bits
int8_t main_menu_5_settings()
//! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t settings =0;
  int8_t user_command;
  do
  {
    Serial.println(F("PGIO"));
    Serial.println(F("  1. !POWER GOOD"));
    Serial.println(F("  2. POWER GOOD"));
    Serial.println(F("  3. General Purpose Output"));
    Serial.println(F("  4. General Purpose Input"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
    {
      Serial.println("m");
      return(ack);
    }
    else
      Serial.println(user_command);
    Serial.println();
    switch (user_command)
    {
      case 1:
        settings |= LTC4215_PGIO_POWER_GOODX;
        break;
      case 2:
        settings |= LTC4215_PGIO_POWER_GOOD;
        break;
      case 3:
        settings |= LTC4215_PGIO_GENERAL_PURPOSE_OUTPUT;
        break;
      case 4:
        settings |= LTC4215_PGIO_GENERAL_PURPOSE_INPUT;
        break;
      default:
        if (user_command != 'm')
          Serial.println("Incorrect Option\n");
        break;
    }

    Serial.println(F("TEST MODE ENABLE"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_TEST_MODE_ENABLE;
    else if (user_command ==2)
      settings &= LTC4215_TEST_MODE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("MASS WRITE ENABLE"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_MASS_WRITE_ENABLE;
    else if (user_command ==2)
      settings &= LTC4215_MASS_WRITE_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("FET STATUS"));
    Serial.println(F("  1. ON"));
    Serial.println(F("  2. OFF"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_FET_ON;
    else if (user_command ==2)
      settings &= LTC4215_FET_OFF;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERCURRENT AUTO RETRY"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_OVERCURRENT_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4215_OVERCURRENT_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("UNDERVOLTAGE AUTO RETRY"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_UNDERVOLTAGE_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4215_UNDERVOLTAGE_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);

    Serial.println(F("OVERVOLTAGE AUTO RETRY"));
    Serial.println(F("  1. Enable"));
    Serial.println(F("  2. Disable"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
    if (user_command == 1)
      settings |= LTC4215_OVERVOLTAGE_AUTO_RETRY_ENABLE;
    else if (user_command ==2)
      settings &= LTC4215_OVERVOLTAGE_AUTO_RETRY_DISABLE;
    else if (user_command != 'm')
      Serial.println("Incorrect Option\n");
    else
      return(ack);
    ack |= LTC4215_write(LTC4215_I2C_ADDRESS, LTC4215_CONTROL_REG, settings);
    Serial.print(F("\nSETTINGS UPDATED\n\n"));
    Serial.println(F("  m. Main Menu"));
    Serial.println(F("  1. Repeat"));
    Serial.print(F("Enter a command: "));
    user_command = read_int();
    if (user_command == 'm')
      Serial.println("m");
    else
      Serial.println(user_command);
    Serial.println();
  }
  while (!((user_command == 'm') || (ack)));
  return(ack);
}

//! Function to read all registers.
int8_t main_menu_6_read_all_registers()
//! @return Returns the state of the acknowledge bit after the I2C address read. 0=acknowledge, 1=no acknowledge.
{
  int8_t ack = 0;
  uint8_t faults;
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_FAULT_REG, &faults);
  Serial.print("  FAULT REGISTER   : 0b");
  Serial.println(faults, BIN);
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_STATUS_REG, &faults);
  Serial.print("  STATUS REGISTER  : 0b");
  Serial.println(faults, BIN);
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_ALERT_REG, &faults);
  Serial.print("  ALERT REGISTER   : 0b");
  Serial.println(faults, BIN);
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_CONTROL_REG, &faults);
  Serial.print("  CONTROL REGISTER : 0b");
  Serial.println(faults, BIN);
  Serial.println();
  return ack;
}

Download LTC4215 Linduino Header File

/*!
LTC4215: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

The LTC4215 Hot Swap controller allows a board to be safely inserted and removed
from a live backplane. Using an external N-channel pass transistor, board supply
voltage and inrush current are ramped up at an adjustable rate. An I2C interface
and onboard ADC allow for monitoring of load current, voltage and fault status.

I2C DATA FORMAT (MSB FIRST):

Data Out:
Byte #1                                    Byte #2                       Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  C7  C6 C5 C4 C3 C2 C1 C0 SACK D7 D6 D5 D4 D3 D2 D1 D0 SACK  STOP

Data In:
Byte #1                                    Byte #2                                      Byte #3

START  SA6 SA5 SA4 SA3 SA2 SA1 SA0 W SACK  C7  C6  C5 C4 C3 C2 C1 C0 SACK  Repeat Start SA6 SA5 SA4 SA3 SA2 SA1 SA0 R SACK

Byte #4                                   Byte #5
MSB                                       LSB
D15 D14  D13  D12  D11  D10  D9 D8 MACK   D7 D6 D5 D4 D3  D2  D1  D0  MNACK  STOP

START       : I2C Start
Repeat Start: I2C Repeat Start
STOP        : I2C Stop
SAx         : I2C Address
SACK        : I2C Slave Generated Acknowledge (Active Low)
MACK        : I2C Master Generated Acknowledge (Active Low)
MNACK       : I2C Master Generated Not Acknowledge
W           : I2C Write (0)
R           : I2C Read  (1)
Cx          : Command Code
Dx          : Data Bits
X           : Don't care


Example Code:

  float adin_lsb = (1.23/255);          // ADIN Voltage Data is 8-Bit Data with 4.82mV LSB and 1.23V Full Scale
    float adin_resisive_ratio = (155.4/12.4);   // Resistor divider circuit at ADIN pin.
  ack |= LTC4215_read(LTC4215_I2C_ADDRESS, LTC4215_ADIN_REG, &adin_code);       // Read ADIN Register
  adin_voltage = LTC4215_code_to_voltage(adin_code, adin_lsb, adin_resisive_ratio); // Calculate ADIN Voltage from ADIN Register data

@endverbatim

http://www.linear.com/product/LTC4215

http://www.linear.com/product/LTC4215#demoboards

REVISION HISTORY
$Revision: 3360 $
$Date: 2015-04-14 16:10:23 -0700 (Tue, 14 Apr 2015) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

/*! @file
    @ingroup LTC4215
    Header for LTC4215: Hot Swap Controller with I2C Compatible Monitoring
*/

#ifndef LTC4215_H
#define LTC4215_H

//! @name LTC4261 Address Assignment
//! @{
#define LTC4215_I2C_ADDRESS                      0x55 //ADDR2 = H, ADDR1 = H, ADDR0 = H
#define LTC4215_I2C_ALERT_RESPONSE               0x0C
#define LTC4215_I2C_MASS_WRITE                   0x5F
//!@}

//! @name LTC4215 Register addresses
//! @{
// Register Addresses
#define LTC4215_CONTROL_REG                      0x00
#define LTC4215_ALERT_REG                        0x01
#define LTC4215_STATUS_REG                       0x02
#define LTC4215_FAULT_REG                        0x03
#define LTC4215_SENSE_REG                        0x04
#define LTC4215_SOURCE_REG                       0x05
#define LTC4215_ADIN_REG                         0x06
//!@}

//! @name LTC4215 Fault Register Bits
//! @{
// Fault Register Bit Positions
#define LTC4215_FET_SHORT_FAULT                  0x20
#define LTC4215_EN_STATE_CHANGE                  0x10
#define LTC4215_POWER_BAD_FAULT                  0x08
#define LTC4215_OVERCURRENT_FAULT                0x04
#define LTC4215_UNDERVOLTAGE_FAULT               0x02
#define LTC4215_OVERVOLTAGE_FAULT                0x01
//!@}

//! @name LTC4215 Alert Register Bits
//! @{
// Alert Register Bits
#define LTC4215_GPIO_OUTPUT_ENABLE               0x40
#define LTC4215_GPIO_OUTPUT_DISABLE              0xBF
#define LTC4215_FET_SHORT_ENABLE                 0x20
#define LTC4215_FET_SHORT_DISABLE                0xDF
#define LTC4215_EN_STATE_ENABLE                  0x10
#define LTC4215_EN_STATE_DISABLE                 0xEF
#define LTC4215_POWER_BAD_ENABLE                 0x08
#define LTC4215_POWER_BAD_DISABLE                0xF7
#define LTC4215_OVERCURRENT_ENABLE               0x04
#define LTC4215_OVERCURRENT_DISABLE              0xFB
#define LTC4215_UNDERVOLTAGE_ENABLE              0x02
#define LTC4215_UNDERVOLTAGE_DISABLE             0xFD
#define LTC4215_OVERVOLTAGE_ENABLE               0x01
#define LTC4215_OVERVOLTAGE_DISABLE              0xFE
//!@}

//! @name LTC4215 Control Register Bits
//! @{
// Control Register Bit Positions
#define LTC4215_PGIO_POWER_GOODX                 0x00
#define LTC4215_PGIO_POWER_GOOD                  0x80
#define LTC4215_PGIO_GENERAL_PURPOSE_OUTPUT      0x40
#define LTC4215_PGIO_GENERAL_PURPOSE_INPUT       0xC0

#define LTC4215_TEST_MODE_ENABLE                 0x20
#define LTC4215_TEST_MODE_DISABLE                0xDF

#define LTC4215_MASS_WRITE_ENABLE                0x10
#define LTC4215_MASS_WRITE_DISABLE               0xEF

#define LTC4215_FET_ON                           0x08
#define LTC4215_FET_OFF                          0xF7

#define LTC4215_OVERCURRENT_AUTO_RETRY_ENABLE    0x04
#define LTC4215_OVERCURRENT_AUTO_RETRY_DISABLE   0xFB

#define LTC4215_UNDERVOLTAGE_AUTO_RETRY_ENABLE   0x02
#define LTC4215_UNDERVOLTAGE_AUTO_RETRY_DISABLE  0xFD

#define LTC4215_OVERVOLTAGE_AUTO_RETRY_ENABLE    0x01
#define LTC4215_OVERVOLTAGE_AUTO_RETRY_DISABLE   0xFE
//!@}

//! Calculates voltage from register code data
//! @return The function returns valtage calculated from register data
float LTC4215_code_to_voltage(uint8_t register_code,    //! Data from registers
                              float LSB,          //! Smallest incremental voltage
                              float resistor_divider_ratio  //! the ratio that the voltages have been divided down. Set to 1 for no resistir divider circuit
                             );

//! SMBus Alert ResponseProtocol: Sends an alert response command and releases /ALERT pin. LTC4215 responds with its address
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge
int8_t LTC4215_ARA(uint8_t alert_response_address,      //!< the Alert Response Address on the I2C bus
                   uint8_t *i2c_address           //!< the address of the alert source
                  );

//! Write an 8-bit code to the LTC4215
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4215_write(uint8_t i2c_address,  //! LTC4215 I2C ADDRESS
                     uint8_t command,      //! Register address to be written into
                     uint8_t code      //! Data to be written into the register
                    );


//! Reads an 8-bit adc_code from LTC4215
//! @return The function returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
int8_t LTC4215_read(uint8_t i2c_address, //! LTC4215 I2C ADDRESS
                    uint8_t command,   //! Register address to read from
                    uint8_t *code    //! Contents of the requested register
                   );

#endif

Download LTC4215 Linduino.CPP

/*!
LTC4215: Hot Swap Controller with I2C Compatible Monitoring

@verbatim

The LTC4215 Hot Swap controller allows a board to be safely inserted and removed
from a live backplane. Using an external N-channel pass transistor, board supply
voltage and inrush current are ramped up at an adjustable rate. An I2C interface
and onboard ADC allow for monitoring of load current, voltage and fault status.

@endverbatim

http://www.linear.com/product/LTC4215

http://www.linear.com/product/LTC4215#demoboards

REVISION HISTORY
$Revision: 6066 $
$Date: 2016-11-17 09:23:26 -0800 (Thu, 17 Nov 2016) $

Copyright (c) 2013, Linear Technology Corp.(LTC)
All rights reserved.

Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:

1. Redistributions of source code must retain the above copyright notice, this
   list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
   this list of conditions and the following disclaimer in the documentation
   and/or other materials provided with the distribution.

THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

The views and conclusions contained in the software and documentation are those
of the authors and should not be interpreted as representing official policies,
either expressed or implied, of Linear Technology Corp.

The Linear Technology Linduino is not affiliated with the official Arduino team.
However, the Linduino is only possible because of the Arduino team's commitment
to the open-source community.  Please, visit http://www.arduino.cc and
http://store.arduino.cc , and consider a purchase that will help fund their
ongoing work.
*/

//! @defgroup LTC4215 LTC4215: Hot Swap Controller with I2C Compatible Monitoring

/*! @file
    @ingroup LTC4215
    Library for LTC4215 Hot Swap Controller with I2C Compatible Monitoring
*/
#include <Arduino.h>
#include <stdint.h>
#include "LT_I2C.h"
#include "LT_SPI.h"
#include "UserInterface.h"
#include "QuikEval_EEPROM.h"
#include <Wire.h>
#include <SPI.h>
#include "LTC4215.h"

// Calculates voltage from register code data
float LTC4215_code_to_voltage(uint8_t register_code, float LSB, float resistor_divider_ratio)
{
  float voltage;
  voltage = (float)register_code * LSB;   //! 1) Calculate voltage from code and ADIN lsb
  return(voltage * resistor_divider_ratio);
}


// SMBus Alert ResponseProtocol: Sends an alert response command and releases /ALERT pin. LTC4215 responds with its address
int8_t LTC4215_ARA(uint8_t alert_response_address, uint8_t *i2c_address)
{
  int8_t ack;
  ack = i2c_read_byte(alert_response_address, i2c_address);
  return ack;
}

// Write an 8-bit code to the LTC4215
int8_t LTC4215_write(uint8_t i2c_address, uint8_t command, uint8_t code)
{
  int8_t ack;
  ack = i2c_write_byte_data(i2c_address,command,code);
  return ack;
}

// Reads an 8-bit adc_code from LTC4215
int8_t LTC4215_read(uint8_t i2c_address, uint8_t command, uint8_t *code)
{
  int8_t ack;
  ack = i2c_read_byte_data(i2c_address,command,code);
  return ack;
}

Technical Support