71 #define LTC2971_0_I2C_ADDRESS 0x5C 72 #define LTC2971_1_I2C_ADDRESS 0x5D 74 #define MFR_PG_CONFIG_ORIGINAL 0xC046 75 #define MFR_PG_CONFIG_WRITE_PG 0xC044 102 uint8_t revision[10];
103 uint8_t *addresses = NULL;
105 if (Serial.available())
108 if (user_command !=
'm')
109 Serial.println(user_command);
111 switch (user_command)
135 addresses = smbus->
probe(0);
136 while (*addresses != 0)
138 Serial.print(F(
"ADDR 0x"));
139 Serial.println(*addresses++, HEX);
149 Serial.println(F(
"Incorrect Option"));
162 Serial.print(F(
"\n*****************************************************************\n"));
163 Serial.print(F(
"* DC2875A Hello World Demonstration Program *\n"));
164 Serial.print(F(
"* *\n"));
165 Serial.print(F(
"* This program demonstrates how to send and receive data from *\n"));
166 Serial.print(F(
"* the LTC2875A demo board. *\n"));
167 Serial.print(F(
"* *\n"));
168 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
169 Serial.print(F(
"* *\n"));
170 Serial.print(F(
"*****************************************************************\n"));
177 Serial.print(F(
" 1-Read Input Telemetry\n"));
178 Serial.print(F(
" 2-Read Output Telemetry\n"));
179 Serial.print(F(
" 3-Read All Status\n"));
180 Serial.print(F(
" 4-PG Commands\n"));
181 Serial.print(F(
" 5-Margin Commands\n"));
182 Serial.print(F(
" 6-PEC Options\n"));
183 Serial.print(F(
" 7-Sequence Off/On\n"));
184 Serial.print(F(
" 8-Bus Probe\n"));
185 Serial.print(F(
" 9-Reset\n"));
186 Serial.print(F(
"\nEnter a command:"));
192 Serial.println(F(
"\nWarning: Demo board not detected. Linduino will attempt to proceed."));
201 float scaled_voltage;
204 for (page = 0; page < 2; page++)
209 Serial.print(F(
" LTC2971:U0:CH"));
210 Serial.print(page, DEC);
211 Serial.print(F(
" VOUT = "));
212 Serial.print(voltage, DEC);
215 Serial.println(F(
" V"));
218 for (page = 0; page < 2; page++)
222 Serial.print(F(
" LTC2971:U1:CH"));
223 Serial.print(page, DEC);
224 Serial.print(F(
" VOUT = "));
225 Serial.print(voltage, DEC);
226 Serial.println(F(
" V"));
241 Serial.print(F(
" LTC2971:U0 VIN = "));
242 Serial.print(voltage, DEC);
243 Serial.println(F(
" V"));
245 Serial.print(F(
" LTC2971:U1 VIN = "));
246 Serial.print(voltage, DEC);
247 Serial.println(F(
" V"));
258 for (page = 0; page < 2; page++)
262 Serial.print(F(
" LTC2971:U0:CH"));
263 Serial.print(page, DEC);
264 Serial.print(F(
" IOUT = "));
265 Serial.print(current, DEC);
266 Serial.println(F(
" A"));
269 for (page = 0; page < 2; page++)
273 Serial.print(F(
" LTC2971:U1:CH"));
274 Serial.print(page, DEC);
275 Serial.print(F(
" IOUT = "));
276 Serial.print(current, DEC);
277 Serial.println(F(
" A"));
288 Serial.print(F(
" LTC2971:U0 Iin = "));
289 Serial.print(current, DEC);
290 Serial.println(F(
" A"));
292 Serial.print(F(
" LTC2971:U1 Iin = "));
293 Serial.print(current, DEC);
294 Serial.println(F(
" A"));
306 for (page = 0; page < 2; page++)
310 Serial.print(F(
" LTC2971:U0:CH"));
311 Serial.print(page, DEC);
312 Serial.print(F(
" POUT = "));
313 Serial.print(power, DEC);
314 Serial.println(F(
" W"));
317 for (page = 0; page < 2; page++)
321 Serial.print(F(
" LTC2971:U1:CH"));
322 Serial.print(page, DEC);
323 Serial.print(F(
" POUT = "));
324 Serial.print(power, DEC);
325 Serial.println(F(
" W"));
338 Serial.print(F(
" LTC2971:U0 Pin = "));
339 Serial.print(power, DEC);
340 Serial.println(F(
" W"));
342 Serial.print(F(
" LTC2971:U1 Pin = "));
343 Serial.print(power, DEC);
344 Serial.println(F(
" W"));
356 for (page = 0; page < 2; page++)
358 Serial.print(F(
"U0:CH"));
359 Serial.println(page, DEC);
362 Serial.print(F(
" LTC2971 STATUS BYTE 0x"));
363 Serial.println(b, HEX);
365 Serial.print(F(
" LTC2971 STATUS WORD 0x"));
366 Serial.println(w, HEX);
369 for (page = 0; page < 2; page++)
371 Serial.print(F(
"U1:CH"));
372 Serial.println(page, DEC);
375 Serial.print(F(
" LTC2971 STATUS BYTE 0x"));
376 Serial.println(b, HEX);
378 Serial.print(F(
" LTC2971 STATUS WORD 0x"));
379 Serial.println(w, HEX);
393 Serial.print(F(
" PG0 = LOGIC"));
394 if (pg_status & 0x01)
396 Serial.print(F(
" HIGH\n"));
400 Serial.print(F(
" LOW\n"));
402 Serial.print(F(
" PG1 = LOGIC"));
403 if (pg_status & 0x02)
405 Serial.print(F(
" HIGH\n"));
409 Serial.print(F(
" LOW\n"));
414 Serial.print(F(
" PG2 = LOGIC"));
415 if (pg_status & 0x01)
417 Serial.print(F(
" HIGH\n"));
421 Serial.print(F(
" LOW\n"));
423 Serial.print(F(
" PG3 = LOGIC"));
424 if (pg_status & 0x02)
426 Serial.print(F(
" HIGH\n"));
430 Serial.print(F(
" LOW\n"));
527 Serial.print(F(
" 1-Read Input Voltages\n"));
528 Serial.print(F(
" 2-Read Input Currents\n"));
529 Serial.print(F(
" 3-Read Input Power\n"));
530 Serial.print(F(
" 4-Read All Input Telemetry\n"));
531 Serial.print(F(
" m-Main Menu\n"));
532 Serial.print(F(
"\nEnter a command: "));
535 if (user_command ==
'm')
537 Serial.print(F(
"m\n"));
540 Serial.println(user_command);
542 switch (user_command)
562 if (user_command !=
'm')
563 Serial.println(F(
"Invalid Selection"));
567 while (user_command !=
'm');
580 Serial.print(F(
" 1-Read Output Voltages\n"));
581 Serial.print(F(
" 2-Read Output Currents\n"));
582 Serial.print(F(
" 3-Read Output Power\n"));
583 Serial.print(F(
" 4-Read All Output Telemetry\n"));
584 Serial.print(F(
" m-Main Menu\n"));
585 Serial.print(F(
"\nEnter a command: "));
588 if (user_command ==
'm')
590 Serial.print(F(
"m\n"));
593 Serial.println(user_command);
595 switch (user_command)
615 if (user_command !=
'm')
617 Serial.println(F(
"Invalid Selection"));
621 while (user_command !=
'm');
634 Serial.print(F(
" 1-Read All PG States\n"));
635 Serial.print(F(
" 2-Force PG0 Low (1 sec)\n"));
636 Serial.print(F(
" 3-Force PG1 Low (1 sec)\n"));
637 Serial.print(F(
" 4-Force PG2 Low (1 sec)\n"));
638 Serial.print(F(
" 5-Force PG3 Low (1 sec)\n"));
639 Serial.print(F(
" m-Main Menu\n"));
640 Serial.print(F(
"\nEnter a command: "));
643 if (user_command ==
'm')
645 Serial.print(F(
"m\n"));
648 Serial.println(user_command);
650 switch (user_command)
668 if (user_command !=
'm')
669 Serial.println(F(
"Invalid Selection"));
673 while (user_command !=
'm');
687 Serial.print(F(
" 1-Margin High\n"));
688 Serial.print(F(
" 2-Margin Low\n"));
689 Serial.print(F(
" 3-Margin Off\n"));
690 Serial.print(F(
" m-Main Menu\n"));
691 Serial.print(F(
"\nEnter a command: "));
694 if (user_command ==
'm')
696 Serial.print(F(
"m\n"));
699 Serial.println(user_command);
701 switch (user_command)
719 if (user_command !=
'm')
720 Serial.println(F(
"Invalid Selection"));
724 while (user_command !=
'm');
738 Serial.print(F(
" 1-PEC On\n"));
739 Serial.print(F(
" 2-PEC Off\n"));
740 Serial.print(F(
" m-Main Menu\n"));
741 Serial.print(F(
"\nEnter a command: "));
744 if (user_command ==
'm')
746 Serial.print(F(
"m\n"));
749 Serial.println(user_command);
751 switch (user_command)
760 Serial.print(F(
"\n PEC Enabled"));
769 Serial.print(F(
"\n PEC Disabled"));
772 if (user_command !=
'm')
773 Serial.println(F(
"Invalid Selection"));
777 while (user_command !=
'm');
float readPout(uint8_t address, bool polling)
Get the measured output power.
static void menu_1_input_telemetry()
Display menu 1.
unsigned char user_command
static void print_title()
Prints the title block when program first starts.
LTC SMBus Support: API for a shared SMBus layer.
LTC SMBus Support: Implementation for a shared SMBus layer.
LTC SMBus Support: Implementation for a shared SMBus layer.
#define MFR_PG_CONFIG_ORIGINAL
uint8_t readStatusByte(uint8_t address)
Get the status byte.
static void toggle_pg2()
Toggle PG2.
static void sequence_off_on()
Sequence off then on.
Header File for Linduino Libraries and Demo Code.
void enablePec(uint8_t address)
Enable pec for all transactions.
static void print_all_input_power()
Print all input power.
static LT_PMBusMath * math
#define LTC2971_0_I2C_ADDRESS
static void print_all_pg()
Print all PG states.
uint16_t readStatusWord(uint8_t address)
Get the status word.
float readIout(uint8_t address, bool polling)
Get the measured output current.
static uint8_t ltc2971_0_i2c_address
static void print_prompt()
Prints main menu.
virtual void writeWord(uint8_t address, uint8_t command, uint16_t data)=0
SMBus write word command.
TwoWire.h - TWI/I2C library for Arduino & Wiring Copyright (c) 2006 Nicholas Zambetti.
static void print_all_output_voltages()
Print all output voltages.
static void print_all_status()
Print all status bytes and words.
float readPin(uint8_t address, bool polling)
Get the measured input power.
void startGroupProtocol(void)
starts group protocol
#define LTC2971_1_I2C_ADDRESS
float readVout(uint8_t address, bool polling)
Get the measured output voltage.
static void print_all_output_power()
Print all output power.
static void margin_off()
Go to nominal.
static void toggle_pg3()
Toggle PG3.
LT_I2CBus: Routines to communicate to I2C by Wire Library.
static void print_all_output_currents()
Print all output currents.
LTC PMBus Support: Implementation for a LTC Fault Log.
virtual void writeByte(uint8_t address, uint8_t command, uint8_t data)=0
SMBus write byte command.
static void menu_5_pec_commands()
Display menu 5.
static void print_warning_prompt()
Prints a warning if the demo board is not detected.
static void margin_low()
Margin low.
void setPage(uint8_t address, uint8_t page)
Set the page.
void marginLowGlobal(void)
Margin all rails low.
static uint8_t ltc2971_1_i2c_address
static void toggle_pg1()
Toggle PG0.
void sequenceOnGlobal(void)
Sequence on all rails.
virtual uint8_t * probe(uint8_t command)=0
SMBus bus probe.
static void menu_4_margin_commands()
Display menu 4.
static void setup()
Initialize Linduino.
float readIin(uint8_t address, bool polling)
Get the input current.
LTC SMBus Support: Implementation for a shared SMBus layer.
static void toggle_pg0()
Toggle PG0.
void sequenceOffGlobal(void)
Sequence off all rails.
float readVin(uint8_t address, bool polling)
Get the input voltage.
void executeGroupProtocol(void)
ends group protocol
void restoreFromNvm(uint8_t address)
Restore device from NVM.
static void loop()
Repeats Linduino loop.
#define MFR_PG_CONFIG_WRITE_PG
static uint16_t current
the current measurement from the LTC3335's counter test mode.
void marginHighGlobal(void)
Margin all rails high.
LTC PMBus Support: Math conversion routines.
static void print_all_input_currents()
Print all input currents.
static void menu_2_output_telemetry()
Display menu 2.
static void margin_high()
Margin high.
virtual uint16_t readWord(uint8_t address, uint8_t command)=0
SMBus read word command.
static void print_all_input_voltages()
Print all input voltages.
static void menu_3_pg_commands()
Display menu 3.
LTC SMBus Support: Implementation for a shared SMBus layer.