Linduino  1.3.0
Linear Technology Arduino-Compatible Demonstration Board
DC998A.ino
Go to the documentation of this file.
1 /*!
2 Linear Technology DC998A Demonstration Board.
3 LTC4261: Negative Voltage Hot Swap Controllers with ADC and I2C Monitoring.
4 
5 @verbatim
6 
7 NOTES
8  Setup:
9  Set the terminal baud rate to 115200 and select the newline terminator. Provide
10  the board with an external power supply of -48 V. Ensure all jumpers on the
11  demo board are installed in their default positions from the factory. Refer to
12  Demo Manual DC998A.
13 
14  This program has options to measure voltage at ADIN pin (input voltage), SOURCE
15  VOLTAGE (output voltage), and SENSE CURRENT (current through sense resisitor).
16  There are also options to read and manipulate CONTROL register, ALERT register,
17  and FAULT register.
18 
19  Mass write option can be achieved using Device Address = 0xBE. Refer to datasheet
20  LTC4261.
21 
22 USER INPUT DATA FORMAT:
23  decimal : 1024
24  hex : 0x400
25  octal : 02000 (leading 0 "zero")
26  binary : B10000000000
27  float : 1024.0
28 
29 @endverbatim
30 
31 http://www.linear.com/product/LTC4261
32 
33 http://www.linear.com/product/LTC4261#demoboards
34 
35 
36 Copyright 2018(c) Analog Devices, Inc.
37 
38 All rights reserved.
39 
40 Redistribution and use in source and binary forms, with or without
41 modification, are permitted provided that the following conditions are met:
42  - Redistributions of source code must retain the above copyright
43  notice, this list of conditions and the following disclaimer.
44  - Redistributions in binary form must reproduce the above copyright
45  notice, this list of conditions and the following disclaimer in
46  the documentation and/or other materials provided with the
47  distribution.
48  - Neither the name of Analog Devices, Inc. nor the names of its
49  contributors may be used to endorse or promote products derived
50  from this software without specific prior written permission.
51  - The use of this software may or may not infringe the patent rights
52  of one or more patent holders. This license does not release you
53  from the requirement that you obtain separate licenses from these
54  patent holders to use this software.
55  - Use of the software either in source or binary form, must be run
56  on or directly connected to an Analog Devices Inc. component.
57 
58 THIS SOFTWARE IS PROVIDED BY ANALOG DEVICES "AS IS" AND ANY EXPRESS OR
59 IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, NON-INFRINGEMENT,
60 MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
61 IN NO EVENT SHALL ANALOG DEVICES BE LIABLE FOR ANY DIRECT, INDIRECT,
62 INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
63 LIMITED TO, INTELLECTUAL PROPERTY RIGHTS, PROCUREMENT OF SUBSTITUTE GOODS OR
64 SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
65 CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
66 OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
67 OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
68 */
69 
70 /*! @file
71  @ingroup LTC4261
72 */
73 
74 // Headerfiles
75 #include <Arduino.h>
76 #include <stdint.h>
77 #include "Linduino.h"
78 #include "LT_I2C.h"
79 #include "LT_SPI.h"
80 #include "UserInterface.h"
81 #include "QuikEval_EEPROM.h"
82 #include "LTC4261.h"
83 #include <Wire.h>
84 #include <SPI.h>
85 
86 // Function Declarations
87 void print_title();
88 void print_main_menu();
91 int8_t main_menu_3_send_ARA();
93 int8_t main_menu_5_settings();
95 
96 // Global Constants
97 const float resistor = .008;
98 const float current_lsb = 62.5E-06;
99 const float adin_lsb = 2.56/1023; // Vref of ADC = 2.56V and 2^10 - 1 = 1023 (10 bit ADC.)
100 const float resistive_ratio = 432.2 / 10.2;
101 // Global Variables
102 static int8_t demo_board_connected; //!< Set to 1 if the board is connected
103 //static uint8_t alert_code = 0; //!< Value stored or read from ALERT register. Shared between loop() and restore_alert_settings()
104 const char ack_error[] = "Error: No Acknowledge. Check I2C Address."; //!< Error message
105 
106 //! Initialize Linduino
107 void setup()
108 {
109  char demo_name[] = "DC998A"; // Demo Board Name stored in QuikEval EEPROM
110  quikeval_I2C_init(); //! Configure the EEPROM I2C port for 100kHz
111  quikeval_I2C_connect(); //! Connects to main I2C port
112  Serial.begin(115200); //! Initialize the serial port to the PC
113  print_title();
115  print_main_menu();
116 }
117 
118 //! Repeats Linduino loop
119 void loop()
120 {
122  {
123  int8_t ack = 0; // I2C acknowledge indicator
124  static uint8_t user_command; // The user input command
125  if (Serial.available()) //! Do nothing if serial is not available
126  {
127  user_command = read_int(); //! Read user input command
128  if (user_command != 'm')
129  Serial.println(user_command);
130  Serial.println();
131  ack = 0;
132  switch (user_command) //! Prints the appropriate submenu
133  {
134  case 1:
135  ack |= main_menu_1_continuous_mode(); // continous mode
136  break;
137  case 2:
138  ack |= main_menu_2_read_and_clear_faults(); // read and clear faults
139  break;
140  case 3:
141  ack |= main_menu_3_send_ARA();// read address of alert
142  break;
143  case 4:
144  ack |= main_menu_4_manage_alerts(); // manage alerts
145  break;
146  case 5:
147  ack |= main_menu_5_settings(); // settings
148  break;
149  case 6:
151  break;
152  default:
153  Serial.println("Incorrect Option");
154  break;
155  }
156  if (ack != 0)
157  Serial.println(ack_error);
158  Serial.print(F("*****************************************"));
159  print_main_menu();
160  }
161  }
162 }
163 
164 //! Print the title block
166 {
167  Serial.println(F("\n*****************************************************************"));
168  Serial.print(F("* DC998A Demonstration Program *\n"));
169  Serial.print(F("* *\n"));
170  Serial.print(F("* This program demonstrates how to send and receive data from *\n"));
171  Serial.print(F("* the Negative Voltage Hot Swap Controllers *\n"));
172  Serial.print(F("* with ADC and I2C Monitoring *\n"));
173  Serial.print(F("* Set the baud rate to 115200 and select the newline terminator.*\n"));
174  Serial.print(F("* *\n"));
175  Serial.print(F("*****************************************************************\n"));
176 }
177 
178 //! Print the main menu
180 {
181  Serial.print(F("\n\nMain Menu\n"));
182  Serial.print(F(" 1. Read current and voltage on continous mode\n"));
183  Serial.print(F(" 2. Read and clear faults\n"));
184  Serial.print(F(" 3. Request for alert response address (ARA)\n"));
185  Serial.print(F(" 4. Manage alerts\n"));
186  Serial.print(F(" 5. Settings\n"));
187  Serial.print(F(" 6. Read all registers\n\n"));
188  Serial.print(F("Enter a command: "));
189 }
190 
191 //! Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode
193 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
194 {
195  int8_t ack = 0;
196  float current, adin_voltage, adin2_voltage;
197  uint16_t current_code, adin_code, adin2_code;
198 
199  do
200  {
201  uint8_t faults;
202  Serial.print(F("********** Press Enter to Exit ***********\n\n"));
204  if (faults != 0)
205  {
206  Serial.println(F("Faults Detected :"));
207  if (faults & LTC4261_EXTERNAL_FAULT )
208  Serial.println(F(" EXTERNAL FAULT DETECTED"));
209  if (faults & LTC4261_PGIO_INPUT_HIGH )
210  Serial.println(F(" PGIO INPUT HIGH DETECTED"));
211  if (faults & LTC4261_FET_SHORT_FAULT )
212  Serial.println(F(" FET SHORT DETECTED"));
213  if (faults & LTC4261_EN_STATE_CHANGE)
214  Serial.println(F(" !EN STATE CHANGE DETECTED"));
215  if (faults & LTC4261_POWER_BAD_FAULT )
216  Serial.println(F(" BAD POWER DETECTED"));
217  if (faults & LTC4261_OVERCURRENT_FAULT )
218  Serial.println(F(" OVERCURRENT DETECTED"));
219  if (faults & LTC4261_UNDERVOLTAGE_FAULT )
220  Serial.println(F(" UNDERVOLTAGE DETECTED"));
221  if (faults & LTC4261_OVERVOLTAGE_FAULT )
222  Serial.println(F(" OVERVOLTAGE DETECTED"));
223  }
224  else
225  Serial.println(F(" NO FAULTS DETECTED"));
226 
230 
231  current = LTC4261_code_to_current(current_code, resistor, current_lsb);
232  adin_voltage = LTC4261_ADIN_code_to_voltage(adin_code, adin_lsb, resistive_ratio);
233  adin2_voltage = LTC4261_ADIN_code_to_voltage(adin2_code, adin_lsb, resistive_ratio);
234 
235  Serial.print(F("\nCURRENT CODE: "));
236  Serial.println(current_code);
237  Serial.print(F("CURRENT CALCULATED: "));
238  Serial.println(current,4);
239  Serial.print(F("\nADIN CODE: "));
240  Serial.println(adin_code, HEX);
241  Serial.print(F("VOLTAGE CALCULATED BY ADIN: "));
242  Serial.println(adin_voltage,4);
243  Serial.print(F("\nADIN2 CODE: "));
244  Serial.println(adin2_code, HEX);
245  Serial.print(F("VOLTAGE CALCULATED BY ADIN2: "));
246  Serial.println(adin2_voltage,4);
247  Serial.print("\n");
248  delay(2000);
249  }
250  while (Serial.available()==false && ack== 0);
251  if (Serial.available())
252  read_int(); // clears the Serial.available()
253  return (ack);
254 }
255 
256 //! Function to read and clear fault register
258 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
259 {
260  int8_t ack = 0;
261 
262  uint8_t faults;
264  if (faults != 0)
265  {
266  Serial.println(F("Faults Detected :"));
267  if (faults & LTC4261_EXTERNAL_FAULT)
268  Serial.println(F(" EXTERNAL FAULT DETECTED"));
269  if (faults & LTC4261_PGIO_INPUT_HIGH)
270  Serial.println(F(" PGIO INPUT HIGH DETECTED"));
271  if (faults & LTC4261_FET_SHORT_FAULT)
272  Serial.println(F(" FET SHORT DETECTED"));
273  if (faults & LTC4261_EN_STATE_CHANGE)
274  Serial.println(F(" !EN STATE CHANGE DETECTED"));
275  if (faults & LTC4261_POWER_BAD_FAULT)
276  Serial.println(F(" BAD POWER DETECTED"));
277  if (faults & LTC4261_OVERCURRENT_FAULT)
278  Serial.println(F(" OVERCURRENT DETECTED"));
279  if (faults & LTC4261_UNDERVOLTAGE_FAULT)
280  Serial.println(F(" UNDERVOLTAGE DETECTED"));
281  if (faults & LTC4261_OVERVOLTAGE_FAULT)
282  Serial.println(F(" OVERVOLTAGE DETECTED"));
283  }
285  Serial.print(F(" ALL FAULTS CLEARED \n\n"));
286 
287  return (ack);
288 }
289 //! Function to send alert response (0001100) and read back the address of device that pulled ALERT pin low.
291 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
292 {
293  int8_t ack = 0;
294  uint8_t address;
295  ack |=LTC4261_ARA(LTC4261_I2C_ALERT_RESPONSE, &address);// send ARA
296  Serial.print(F(" ALERT RESPONSE ADDRESS : 0x"));
297  Serial.println(address,HEX);
298  if (address == 0xFF && ack == 1)
299  {
300  ack = 0;
301  Serial.print(F(" NO RESPONSE\n\n"));
302  }
303  return(ack);
304 }
305 
306 //! Function to update alert register bits
308 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
309 {
310  int8_t ack = 0;
311  uint8_t alert_settings = 0;
312  int8_t user_command;
313  do
314  {
315  Serial.println(F("EXTERNAL FAULT ALERT"));
316  Serial.println(F(" 1. Enable"));
317  Serial.println(F(" 2. Disable"));
318  Serial.print(F("Enter a command: "));
319  user_command = read_int();
320  if (user_command == 'm')
321  Serial.println("m");
322  else
323  Serial.println(user_command);
324  Serial.println();
325  if (user_command == 1)
326  alert_settings |= LTC4261_EXTERNAL_FAULT_ENABLE;
327  else if (user_command ==2)
328  alert_settings &= LTC4261_EXTERNAL_FAULT_DISABLE;
329  else if (user_command != 'm')
330  Serial.println("Incorrect Option\n");
331  else
332  return(ack);
333 
334  Serial.println(F("PGIO OUTPUT"));
335  Serial.println(F(" 1. Enable"));
336  Serial.println(F(" 2. Disable"));
337  Serial.print(F("Enter a command: "));
338  user_command = read_int();
339  if (user_command == 'm')
340  Serial.println("m");
341  else
342  Serial.println(user_command);
343  Serial.println();
344  if (user_command == 1)
345  alert_settings |= LTC4261_PGIO_OUTPUT_ENABLE;
346  else if (user_command ==2)
347  alert_settings &= LTC4261_PGIO_OUTPUT_DISABLE;
348  else if (user_command != 'm')
349  Serial.println("Incorrect Option\n");
350  else
351  return(ack);
352 
353  Serial.println(F("FET SHORT ALERT"));
354  Serial.println(F(" 1. Enable"));
355  Serial.println(F(" 2. Disable"));
356  Serial.print(F("Enter a command: "));
357  user_command = read_int();
358  if (user_command == 'm')
359  Serial.println("m");
360  else
361  Serial.println(user_command);
362  Serial.println();
363  if (user_command == 1)
364  alert_settings |= LTC4261_FET_SHORT_ENABLE;
365  else if (user_command ==2)
366  alert_settings &= LTC4261_FET_SHORT_DISABLE;
367  else if (user_command != 'm')
368  Serial.println("Incorrect Option\n");
369  else
370  return(ack);
371 
372 
373  Serial.println(F("!EN STATE CHANGE ALERT"));
374  Serial.println(F(" 1. Enable"));
375  Serial.println(F(" 2. Disable"));
376  Serial.print(F("Enter a command: "));
377  user_command = read_int();
378  if (user_command == 'm')
379  Serial.println("m");
380  else
381  Serial.println(user_command);
382  Serial.println();
383  if (user_command == 1)
384  alert_settings |= LTC4261_EN_STATE_ENABLE;
385  else if (user_command ==2)
386  alert_settings &= LTC4261_EN_STATE_DISABLE;
387  else if (user_command != 'm')
388  Serial.println("Incorrect Option\n");
389  else
390  return(ack);
391 
392  Serial.println(F("POWER BAD ALERT"));
393  Serial.println(F(" 1. Enable"));
394  Serial.println(F(" 2. Disable"));
395  Serial.print(F("Enter a command: "));
396  user_command = read_int();
397  if (user_command == 'm')
398  Serial.println("m");
399  else
400  Serial.println(user_command);
401  Serial.println();
402  if (user_command == 1)
403  alert_settings |= LTC4261_POWER_BAD_ENABLE;
404  else if (user_command ==2)
405  alert_settings &= LTC4261_POWER_BAD_DISABLE;
406  else if (user_command != 'm')
407  Serial.println("Incorrect Option\n");
408  else
409  return(ack);
410 
411  Serial.println(F("OVERCURRENT ALERT"));
412  Serial.println(F(" 1. Enable"));
413  Serial.println(F(" 2. Disable"));
414  Serial.print(F("Enter a command: "));
415  user_command = read_int();
416  if (user_command == 'm')
417  Serial.println("m");
418  else
419  Serial.println(user_command);
420  Serial.println();
421  if (user_command == 1)
422  alert_settings |= LTC4261_OVERCURRENT_ENABLE;
423  else if (user_command ==2)
424  alert_settings &= LTC4261_OVERCURRENT_DISABLE;
425  else if (user_command != 'm')
426  Serial.println("Incorrect Option\n");
427  else
428  return(ack);
429 
430  Serial.println(F("UNDERVOLTAGE ALERT"));
431  Serial.println(F(" 1. Enable"));
432  Serial.println(F(" 2. Disable"));
433  Serial.print(F("Enter a command: "));
434  user_command = read_int();
435  if (user_command == 'm')
436  Serial.println("m");
437  else
438  Serial.println(user_command);
439  Serial.println();
440  if (user_command == 1)
441  alert_settings |= LTC4261_UNDERVOLTAGE_ENABLE;
442  else if (user_command ==2)
443  alert_settings &= LTC4261_UNDERVOLTAGE_DISABLE;
444  else if (user_command != 'm')
445  Serial.println("Incorrect Option\n");
446  else
447  return(ack);
448 
449  Serial.println(F("OVERVOLTAGE ALERT"));
450  Serial.println(F(" 1. Enable"));
451  Serial.println(F(" 2. Disable"));
452  Serial.print(F("Enter a command: "));
453  user_command = read_int();
454  if (user_command == 'm')
455  Serial.println("m");
456  else
457  Serial.println(user_command);
458  Serial.println();
459  if (user_command == 1)
460  alert_settings |= LTC4261_OVERVOLTAGE_ENABLE;
461  else if (user_command ==2)
462  alert_settings &= LTC4261_OVERVOLTAGE_DISABLE;
463  else if (user_command != 'm')
464  Serial.println("Incorrect Option\n");
465  else
466  return(ack);
467  ack |= LTC4261_write(LTC4261_I2C_Address, LTC4261_ALERT_REG, alert_settings);
468  Serial.print(F("\n ALERTS UPDATED\n\n"));
469  Serial.println(F(" m. Main Menu"));
470  Serial.println(F(" 1. Repeat"));
471  Serial.print(F("Enter a command: "));
472  user_command = read_int();
473  if (user_command == 'm')
474  Serial.println("m");
475  else
476  Serial.println(user_command);
477  Serial.println();
478  }
479  while (!((user_command == 'm') || (ack)));
480  return(ack);
481 
482 }
483 
484 //! Function to update control register bits
486 //! @return Returns the state of the acknowledge bit after the I2C address write. 0=acknowledge, 1=no acknowledge.
487 {
488  int8_t ack = 0;
489  uint8_t settings =0;
490  int8_t user_command;
491  do
492  {
493  Serial.println(F("PGIO"));
494  Serial.println(F(" 1. !POWER GOOD"));
495  Serial.println(F(" 2. POWER GOOD"));
496  Serial.println(F(" 3. General Purpose Output"));
497  Serial.println(F(" 4. General Purpose Input"));
498  Serial.print(F("Enter a command: "));
499  user_command = read_int();
500  if (user_command == 'm')
501  {
502  Serial.println("m");
503  return(ack);
504  }
505  else
506  Serial.println(user_command);
507  Serial.println();
508  switch (user_command)
509  {
510  case 1:
511  settings |= LTC4261_PGIO_POWER_GOODX;
512  break;
513  case 2:
514  settings |= LTC4261_PGIO_POWER_GOOD;
515  break;
516  case 3:
518  break;
519  case 4:
521  break;
522  default:
523  if (user_command != 'm')
524  Serial.println("Incorrect Option\n");
525  break;
526  }
527 
528  Serial.println(F("TEST MODE ENABLE"));
529  Serial.println(F(" 1. Enable"));
530  Serial.println(F(" 2. Disable"));
531  Serial.print(F("Enter a command: "));
532  user_command = read_int();
533  if (user_command == 'm')
534  Serial.println("m");
535  else
536  Serial.println(user_command);
537  Serial.println();
538  if (user_command == 1)
539  settings |= LTC4261_TEST_MODE_ENABLE;
540  else if (user_command ==2)
541  settings &= LTC4261_TEST_MODE_DISABLE;
542  else if (user_command != 'm')
543  Serial.println("Incorrect Option\n");
544  else
545  return(ack);
546 
547  Serial.println(F("POWER BAD AUTO RETRY"));
548  Serial.println(F(" 1. Enable"));
549  Serial.println(F(" 2. Disable"));
550  Serial.print(F("Enter a command: "));
551  user_command = read_int();
552  if (user_command == 'm')
553  Serial.println("m");
554  else
555  Serial.println(user_command);
556  Serial.println();
557  if (user_command == 1)
559  else if (user_command ==2)
561  else if (user_command != 'm')
562  Serial.println("Incorrect Option\n");
563  else
564  return(ack);
565 
566 
567  Serial.println(F("FET STATUS"));
568  Serial.println(F(" 1. ON"));
569  Serial.println(F(" 2. OFF"));
570  Serial.print(F("Enter a command: "));
571  user_command = read_int();
572  if (user_command == 'm')
573  Serial.println("m");
574  else
575  Serial.println(user_command);
576  Serial.println();
577  if (user_command == 1)
578  settings |= LTC4261_FET_ON;
579  else if (user_command ==2)
580  settings &= LTC4261_FET_OFF;
581  else if (user_command != 'm')
582  Serial.println("Incorrect Option\n");
583  else
584  return(ack);
585 
586  Serial.println(F("OVERCURRENT AUTO RETRY"));
587  Serial.println(F(" 1. Enable"));
588  Serial.println(F(" 2. Disable"));
589  Serial.print(F("Enter a command: "));
590  user_command = read_int();
591  if (user_command == 'm')
592  Serial.println("m");
593  else
594  Serial.println(user_command);
595  Serial.println();
596  if (user_command == 1)
598  else if (user_command ==2)
600  else if (user_command != 'm')
601  Serial.println("Incorrect Option\n");
602  else
603  return(ack);
604 
605  Serial.println(F("UNDERVOLTAGE AUTO RETRY"));
606  Serial.println(F(" 1. Enable"));
607  Serial.println(F(" 2. Disable"));
608  Serial.print(F("Enter a command: "));
609  user_command = read_int();
610  if (user_command == 'm')
611  Serial.println("m");
612  else
613  Serial.println(user_command);
614  Serial.println();
615  if (user_command == 1)
617  else if (user_command ==2)
619  else if (user_command != 'm')
620  Serial.println("Incorrect Option\n");
621  else
622  return(ack);
623 
624 
625  Serial.println(F("OVERVOLTAGE AUTO RETRY"));
626  Serial.println(F(" 1. Enable"));
627  Serial.println(F(" 2. Disable"));
628  Serial.print(F("Enter a command: "));
629  user_command = read_int();
630  if (user_command == 'm')
631  Serial.println("m");
632  else
633  Serial.println(user_command);
634  Serial.println();
635  if (user_command == 1)
637  else if (user_command ==2)
639  else if (user_command != 'm')
640  Serial.println("Incorrect Option\n");
641  else
642  return(ack);
644  Serial.print(F("\nSETTINGS UPDATED\n\n"));
645  Serial.println(F(" m. Main Menu"));
646  Serial.println(F(" 1. Repeat"));
647  Serial.print(F("Enter a command: "));
648  user_command = read_int();
649  if (user_command == 'm')
650  Serial.println("m");
651  else
652  Serial.println(user_command);
653  Serial.println();
654  }
655  while (!((user_command == 'm') || (ack)));
656  return(ack);
657 }
658 
659 //! Function to read all registers.
661 //! @return Returns the state of the acknowledge bit after the I2C address read. 0=acknowledge, 1=no acknowledge.
662 {
663  int8_t ack = 0;
664  uint8_t faults;
666  Serial.print(" FAULT REGISTER : 0b");
667  Serial.println(faults, BIN);
669  Serial.print(" STATUS REGISTER : 0b");
670  Serial.println(faults, BIN);
672  Serial.print(" ALERT REGISTER : 0b");
673  Serial.println(faults, BIN);
675  Serial.print(" CONTROL REGISTER : 0b");
676  Serial.println(faults, BIN);
677  Serial.println();
678  return ack;
679 }
#define LTC4261_OVERVOLTAGE_FAULT
Definition: LTC4261.h:171
#define LTC4261_POWER_BAD_FAULT
Definition: LTC4261.h:168
#define LTC4261_TEST_MODE_ENABLE
Definition: LTC4261.h:143
#define LTC4261_POWER_BAD_DISABLE
Definition: LTC4261.h:185
#define LTC4261_TEST_MODE_DISABLE
Definition: LTC4261.h:144
#define LTC4261_EXTERNAL_FAULT_ENABLE
Definition: LTC4261.h:176
unsigned char user_command
#define LTC4261_PGIO_GENERAL_PURPOSE_OUTPUT
Definition: LTC4261.h:140
#define LTC4261_EXTERNAL_FAULT_DISABLE
Definition: LTC4261.h:177
static void setup()
Initialize Linduino.
Definition: DC998A.ino:107
int8_t LTC4261_write(uint8_t i2c_address, uint8_t command, uint8_t code)
Write an 8-bit code to the LTC4261.
Definition: LTC4261.cpp:73
static void loop()
Repeats Linduino loop.
Definition: DC998A.ino:119
#define LTC4261_OVERCURRENT_DISABLE
Definition: LTC4261.h:187
static int8_t main_menu_2_read_and_clear_faults()
Function to read and clear fault register.
Definition: DC998A.ino:257
#define LTC4261_PGIO_POWER_GOODX
Definition: LTC4261.h:138
const float adin_lsb
Definition: DC998A.ino:99
#define LTC4261_ADIN2_MSB_REG
Definition: LTC4261.h:130
Header File for Linduino Libraries and Demo Code.
#define LTC4261_FET_ON
Definition: LTC4261.h:149
#define LTC4261_SENSE_MSB_REG
Definition: LTC4261.h:128
#define LTC4261_PGIO_OUTPUT_ENABLE
Definition: LTC4261.h:178
static int8_t demo_board_connected
Set to 1 if the board is connected.
Definition: DC998A.ino:102
const float resistive_ratio
Definition: DC998A.ino:100
#define LTC4261_FET_OFF
Definition: LTC4261.h:150
LTC4261: Negative Voltage Hot Swap Controller with ADC and I2C Monitoring.
#define LTC4261_CONTROL_REG
Definition: LTC4261.h:127
int8_t LTC4261_read_10_bits(uint8_t i2c_address, uint8_t adc_command, uint16_t *adc_code)
Reads a 10-bit adc_code from LTC4261.
Definition: LTC4261.cpp:91
static uint8_t address
Definition: DC2091A.ino:83
#define LTC4261_UNDERVOLTAGE_AUTO_RETRY_ENABLE
Definition: LTC4261.h:155
#define LTC4261_POWER_BAD_ENABLE
Definition: LTC4261.h:184
#define LTC4261_STATUS_REG
Definition: LTC4261.h:124
static void print_title()
Print the title block.
Definition: DC998A.ino:165
int8_t LTC4261_ARA(uint8_t alert_response_address, uint8_t *i2c_address)
SMBus Alert Response Protocol: Sends an alert response command and releases /ALERT pin...
Definition: LTC4261.cpp:102
#define LTC4261_OVERVOLTAGE_ENABLE
Definition: LTC4261.h:190
int8_t LTC4261_read(uint8_t i2c_address, uint8_t command, uint8_t *code)
Reads an 8-bit adc_code from LTC4261.
Definition: LTC4261.cpp:82
#define LTC4261_EXTERNAL_FAULT
Definition: LTC4261.h:164
static void settings()
Configures the output.
Definition: DC726B_A.ino:202
const float resistor
Definition: DC998A.ino:97
#define LTC4261_UNDERVOLTAGE_FAULT
Definition: LTC4261.h:170
#define LTC4261_POWER_BAD_AUTO_RETRY_DISABLE
Definition: LTC4261.h:147
#define LTC4261_I2C_Address
Definition: LTC4261.h:109
#define LTC4261_OVERVOLTAGE_AUTO_RETRY_DISABLE
Definition: LTC4261.h:159
#define LTC4261_EN_STATE_DISABLE
Definition: LTC4261.h:183
#define LTC4261_FAULT_REG
Definition: LTC4261.h:125
#define LTC4261_PGIO_INPUT_HIGH
Definition: LTC4261.h:165
#define LTC4261_I2C_ALERT_RESPONSE
Definition: LTC4261.h:117
const char ack_error[]
Error message.
Definition: DC998A.ino:104
QuikEval EEPROM Library.
#define LTC4261_UNDERVOLTAGE_DISABLE
Definition: LTC4261.h:189
#define LTC4261_FET_SHORT_ENABLE
Definition: LTC4261.h:180
#define LTC4261_OVERCURRENT_ENABLE
Definition: LTC4261.h:186
#define LTC4261_PGIO_OUTPUT_DISABLE
Definition: LTC4261.h:179
#define LTC4261_PGIO_GENERAL_PURPOSE_INPUT
Definition: LTC4261.h:141
#define LTC4261_UNDERVOLTAGE_AUTO_RETRY_DISABLE
Definition: LTC4261.h:156
int8_t discover_demo_board(char *demo_name)
Read the ID string from the EEPROM and determine if the correct board is connected.
static int8_t main_menu_6_read_all_registers()
Function to read all registers.
Definition: DC998A.ino:660
const float current_lsb
Definition: DC998A.ino:98
LT_SPI: Routines to communicate with ATmega328P&#39;s hardware SPI port.
#define LTC4261_PGIO_POWER_GOOD
Definition: LTC4261.h:139
LT_I2C: Routines to communicate with ATmega328P&#39;s hardware I2C port.
#define LTC4261_UNDERVOLTAGE_ENABLE
Definition: LTC4261.h:188
#define LTC4261_POWER_BAD_AUTO_RETRY_ENABLE
Definition: LTC4261.h:146
char demo_name[]
Demo Board Name stored in QuikEval EEPROM.
Definition: DC1880A.ino:97
static int8_t main_menu_1_continuous_mode()
Function to read Rsense current, ADIN voltage and ADIN2 voltage in continous mode.
Definition: DC998A.ino:192
int32_t read_int()
#define LTC4261_EN_STATE_ENABLE
Definition: LTC4261.h:182
#define LTC4261_ALERT_REG
Definition: LTC4261.h:126
#define LTC4261_EN_STATE_CHANGE
Definition: LTC4261.h:167
#define LTC4261_FET_SHORT_FAULT
Definition: LTC4261.h:166
#define LTC4261_FET_SHORT_DISABLE
Definition: LTC4261.h:181
static void print_main_menu()
Print the main menu.
Definition: DC998A.ino:179
static int8_t main_menu_5_settings()
Function to update control register bits.
Definition: DC998A.ino:485
float LTC4261_code_to_current(uint16_t adc_code, float resistor, float LTC4261_DELTA_SENSE_lsb)
Calculate the LTC4261 current with a sense resistor.
Definition: LTC4261.cpp:119
void quikeval_I2C_init(void)
Initializes Linduino I2C port.
Definition: LT_I2C.cpp:394
void quikeval_I2C_connect(void)
Switch MUX to connect I2C pins to QuikEval connector.
Definition: LT_I2C.cpp:401
#define LTC4261_OVERCURRENT_AUTO_RETRY_DISABLE
Definition: LTC4261.h:153
static uint16_t current
the current measurement from the LTC3335&#39;s counter test mode.
Definition: DC2343A.ino:114
#define LTC4261_OVERCURRENT_FAULT
Definition: LTC4261.h:169
#define LTC4261_OVERCURRENT_AUTO_RETRY_ENABLE
Definition: LTC4261.h:152
float LTC4261_ADIN_code_to_voltage(uint16_t adc_code, float LTC4261_ADIN_lsb, float resistor_divider_ratio)
Calculate the LTC4261 ADIN voltage.
Definition: LTC4261.cpp:110
static int8_t main_menu_4_manage_alerts()
Function to update alert register bits.
Definition: DC998A.ino:307
static int8_t main_menu_3_send_ARA()
Function to send alert response (0001100) and read back the address of device that pulled ALERT pin l...
Definition: DC998A.ino:290
#define LTC4261_ADIN_MSB_REG
Definition: LTC4261.h:132
#define LTC4261_OVERVOLTAGE_AUTO_RETRY_ENABLE
Definition: LTC4261.h:158
#define LTC4261_OVERVOLTAGE_DISABLE
Definition: LTC4261.h:191