66 #define LTC2972_0_I2C_ADDRESS 0x5C 67 #define LTC2972_1_I2C_ADDRESS 0x5D 68 #define MFR_PG_CONFIG_ORIGINAL 0xC046 69 #define MFR_PG_CONFIG_WRITE_PG 0xC044 99 uint8_t *addresses = NULL;
101 if (Serial.available())
104 if (user_command !=
'm')
105 Serial.println(user_command);
107 switch (user_command)
131 addresses = smbus->
probe(0);
132 while (*addresses != 0)
134 Serial.print(F(
"ADDR 0x"));
135 Serial.println(*addresses++, HEX);
145 Serial.println(F(
"Incorrect Option"));
159 Serial.print(F(
"\n*****************************************************************\n"));
160 Serial.print(F(
"* DC2675A Hello World Demonstration Program *\n"));
161 Serial.print(F(
"* *\n"));
162 Serial.print(F(
"* This program demonstrates how to send and receive data from *\n"));
163 Serial.print(F(
"* the LTC2675A demo board. *\n"));
164 Serial.print(F(
"* *\n"));
165 Serial.print(F(
"* Set the baud rate to 115200 and select the newline terminator.*\n"));
166 Serial.print(F(
"* *\n"));
167 Serial.print(F(
"*****************************************************************\n"));
175 Serial.print(F(
" 1-Read Input Telemetry\n"));
176 Serial.print(F(
" 2-Read Output Telemetry\n"));
177 Serial.print(F(
" 3-Read All Status\n"));
178 Serial.print(F(
" 4-PG Commands\n"));
179 Serial.print(F(
" 5-Margin Commands\n"));
180 Serial.print(F(
" 6-PEC Options\n"));
181 Serial.print(F(
" 7-Sequence Off/On\n"));
182 Serial.print(F(
" 8-Bus Probe\n"));
183 Serial.print(F(
" 9-Reset\n"));
184 Serial.print(F(
"\nEnter a command:"));
191 Serial.println(F(
"\nWarning: Demo board not detected. Linduino will attempt to proceed."));
201 for (page = 0; page < 2; page++)
205 Serial.print(F(
" LTC2972:U0:CH"));
206 Serial.print(page, DEC);
207 Serial.print(F(
" VOUT = "));
208 Serial.println(voltage, DEC);
212 for (page = 0; page < 2; page++)
216 Serial.print(F(
" LTC2972:U1:CH"));
217 Serial.print(page, DEC);
218 Serial.print(F(
" VOUT = "));
219 Serial.println(voltage, DEC);
230 Serial.print(F(
" LTC2972:U0 VIN = "));
231 Serial.println(voltage, DEC);
233 Serial.print(F(
" LTC2972:U1 VIN = "));
234 Serial.println(voltage, DEC);
245 for (page = 0; page < 2; page++)
249 Serial.print(F(
" LTC2972:U0:CH"));
250 Serial.print(page, DEC);
251 Serial.print(F(
" IOUT = "));
252 Serial.println(current, DEC);
255 for (page = 0; page < 2; page++)
259 Serial.print(F(
" LTC2972:U1:CH"));
260 Serial.print(page, DEC);
261 Serial.print(F(
" IOUT = "));
262 Serial.println(current, DEC);
273 Serial.print(F(
" LTC2972:U0 Iin = "));
274 Serial.println(current, DEC);
276 Serial.print(F(
" LTC2972:U1 Iin = "));
277 Serial.println(current, DEC);
288 for (page = 0; page < 2; page++)
292 Serial.print(F(
" LTC2972:U0:CH"));
293 Serial.print(page, DEC);
294 Serial.print(F(
" POUT = "));
295 Serial.println(power, DEC);
298 for (page = 0; page < 2; page++)
302 Serial.print(F(
" LTC2972:U1:CH"));
303 Serial.print(page, DEC);
304 Serial.print(F(
" POUT = "));
305 Serial.println(power, DEC);
316 Serial.print(F(
" LTC2972:U0 Pin = "));
317 Serial.println(power, DEC);
319 Serial.print(F(
" LTC2972:U1 Pin = "));
320 Serial.println(power, DEC);
332 for (page = 0; page < 2; page++)
334 Serial.print(F(
"U0:CH"));
335 Serial.println(page, DEC);
338 Serial.print(F(
" LTC2972 STATUS BYTE 0x"));
339 Serial.println(b, HEX);
341 Serial.print(F(
" LTC2972 STATUS WORD 0x"));
342 Serial.println(w, HEX);
345 for (page = 0; page < 2; page++)
347 Serial.print(F(
"U1:CH"));
348 Serial.println(page, DEC);
351 Serial.print(F(
" LTC2972 STATUS BYTE 0x"));
352 Serial.println(b, HEX);
354 Serial.print(F(
" LTC2972 STATUS WORD 0x"));
355 Serial.println(w, HEX);
367 Serial.print(F(
" PG0 = LOGIC"));
368 if (pg_status & 0x01)
370 Serial.print(F(
" HIGH\n"));
374 Serial.print(F(
" LOW\n"));
376 Serial.print(F(
" PG1 = LOGIC"));
377 if (pg_status & 0x02)
379 Serial.print(F(
" HIGH\n"));
383 Serial.print(F(
" LOW\n"));
388 Serial.print(F(
" PG2 = LOGIC"));
389 if (pg_status & 0x01)
391 Serial.print(F(
" HIGH\n"));
395 Serial.print(F(
" LOW\n"));
397 Serial.print(F(
" PG3 = LOGIC"));
398 if (pg_status & 0x02)
400 Serial.print(F(
" HIGH\n"));
404 Serial.print(F(
" LOW\n"));
498 Serial.print(F(
" 1-Read Input Voltages\n"));
499 Serial.print(F(
" 2-Read Input Currents\n"));
500 Serial.print(F(
" 3-Read Input Power\n"));
501 Serial.print(F(
" 4-Read All Input Telemetry\n"));
502 Serial.print(F(
" m-Main Menu\n"));
503 Serial.print(F(
"\nEnter a command: "));
506 if (user_command ==
'm')
508 Serial.print(F(
"m\n"));
511 Serial.println(user_command);
513 switch (user_command)
533 if (user_command !=
'm')
534 Serial.println(F(
"Invalid Selection"));
538 while (user_command !=
'm');
551 Serial.print(F(
" 1-Read Output Voltages\n"));
552 Serial.print(F(
" 2-Read Output Currents\n"));
553 Serial.print(F(
" 3-Read Output Power\n"));
554 Serial.print(F(
" 4-Read All Output Telemetry\n"));
555 Serial.print(F(
" m-Main Menu\n"));
556 Serial.print(F(
"\nEnter a command: "));
559 if (user_command ==
'm')
561 Serial.print(F(
"m\n"));
564 Serial.println(user_command);
566 switch (user_command)
586 if (user_command !=
'm')
588 Serial.println(F(
"Invalid Selection"));
592 while (user_command !=
'm');
605 Serial.print(F(
" 1-Read All PG States\n"));
606 Serial.print(F(
" 2-Force PG0 Low (1 sec)\n"));
607 Serial.print(F(
" 3-Force PG1 Low (1 sec)\n"));
608 Serial.print(F(
" 4-Force PG2 Low (1 sec)\n"));
609 Serial.print(F(
" 5-Force PG3 Low (1 sec)\n"));
610 Serial.print(F(
" m-Main Menu\n"));
611 Serial.print(F(
"\nEnter a command: "));
614 if (user_command ==
'm')
616 Serial.print(F(
"m\n"));
619 Serial.println(user_command);
621 switch (user_command)
639 if (user_command !=
'm')
640 Serial.println(F(
"Invalid Selection"));
644 while (user_command !=
'm');
658 Serial.print(F(
" 1-Margin High\n"));
659 Serial.print(F(
" 2-Margin Low\n"));
660 Serial.print(F(
" 3-Margin Off\n"));
661 Serial.print(F(
" m-Main Menu\n"));
662 Serial.print(F(
"\nEnter a command: "));
665 if (user_command ==
'm')
667 Serial.print(F(
"m\n"));
670 Serial.println(user_command);
672 switch (user_command)
690 if (user_command !=
'm')
691 Serial.println(F(
"Invalid Selection"));
695 while (user_command !=
'm');
708 Serial.print(F(
" 1-PEC On\n"));
709 Serial.print(F(
" 2-PEC Off\n"));
710 Serial.print(F(
" m-Main Menu\n"));
711 Serial.print(F(
"\nEnter a command: "));
714 if (user_command ==
'm')
716 Serial.print(F(
"m\n"));
719 Serial.println(user_command);
721 switch (user_command)
730 Serial.print(F(
"\n PEC Enabled"));
739 Serial.print(F(
"\n PEC Disabled"));
742 if (user_command !=
'm')
743 Serial.println(F(
"Invalid Selection"));
747 while (user_command !=
'm');
static void print_all_output_power()
Print all output power.
static void toggle_pg3()
Toggle PG3.
float readPout(uint8_t address, bool polling)
Get the measured output power.
unsigned char user_command
static uint8_t ltc2972_1_i2c_address
#define LTC2972_0_I2C_ADDRESS
static void menu_4_margin_commands()
Display menu 4.
static void setup()
Initialize Linduino.
static void menu_5_pec_commands()
Display menu 5.
static void margin_low()
Margin low.
LTC SMBus Support: Implementation for a shared SMBus layer.
uint8_t readStatusByte(uint8_t address)
Get the status byte.
static void toggle_pg1()
Toggle PG0.
Header File for Linduino Libraries and Demo Code.
void enablePec(uint8_t address)
Enable pec for all transactions.
#define LTC2972_1_I2C_ADDRESS
uint16_t readStatusWord(uint8_t address)
Get the status word.
float readIout(uint8_t address, bool polling)
Get the measured output current.
static void toggle_pg0()
Toggle PG0.
#define MFR_PG_CONFIG_WRITE_PG
virtual void writeWord(uint8_t address, uint8_t command, uint16_t data)=0
SMBus write word command.
static void print_all_input_currents()
Print all input currents.
static void menu_2_output_telemetry()
Display menu 2.
static void loop()
Repeats Linduino loop.
static void menu_3_pg_commands()
Display menu 3.
float readPin(uint8_t address, bool polling)
Get the measured input power.
void startGroupProtocol(void)
starts group protocol
float readVout(uint8_t address, bool polling)
Get the measured output voltage.
LT_I2CBus: Routines to communicate to I2C by Wire Library.
static void margin_high()
Margin high.
static uint8_t ltc2972_0_i2c_address
static void print_all_input_voltages()
Print all input voltages.
virtual void writeByte(uint8_t address, uint8_t command, uint8_t data)=0
SMBus write byte command.
void setPage(uint8_t address, uint8_t page)
Set the page.
void marginLowGlobal(void)
Margin all rails low.
static void menu_1_input_telemetry()
Display menu 1.
void sequenceOnGlobal(void)
Sequence on all rails.
virtual uint8_t * probe(uint8_t command)=0
SMBus bus probe.
static void print_title()
Prints the title block when program first starts.
static void print_all_pg()
Print all PG states.
float readIin(uint8_t address, bool polling)
Get the input current.
LTC SMBus Support: Implementation for a shared SMBus layer.
#define MFR_PG_CONFIG_ORIGINAL
static void toggle_pg2()
Toggle PG2.
static void sequence_off_on()
Sequence off then on.
void sequenceOffGlobal(void)
Sequence off all rails.
float readVin(uint8_t address, bool polling)
Get the input voltage.
void executeGroupProtocol(void)
ends group protocol
static void print_all_input_power()
Print all input power.
static LT_PMBusMath * math
void restoreFromNvm(uint8_t address)
Restore device from NVM.
static void print_all_status()
Print all status bytes and words.
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 margin_off()
Go to nominal.
static void print_prompt()
Prints main menu.
static void print_all_output_currents()
Print all output currents.
virtual uint16_t readWord(uint8_t address, uint8_t command)=0
SMBus read word command.
static void print_all_output_voltages()
Print all output voltages.
static void print_warning_prompt()
Prints a warning if the demo board is not detected.