Power system management with Linduino

May 02, 2016

anon5328962-May 02, 2016

Most Power System Management designs follow a set and forget model. Setup and debug of Power System Management (PSM) devices is simple with LTpowerPlay® and when combined with a bulk programing solution, there is no need for firmware. However, many large systems require a Board Management Controller (BMC), begging the question: “What can firmware do for PSM?”

The foundation of PSM firmware is PMBus; the foundation of PMBus is SMBus; and the foundation of SMBus is I2C. Building a BMC that adds value with PSM firmware requires some level of knowledge of each protocol, or a pre-existing library that frees the programmer from the details.

The Linduino® libraries handle each protocol layer, and provide an Application Programming Interface (API), that makes writing PSM firmware easy. Linduino PSM is not a replacement for a BMC, but rather a set of libraries and examples that are compatible with typical BMC firmware.

Linduino can also be used with Linear Technology Demo Circuits as a learning tool. Many BMC designs already have an SMBus API and all this is needed is a quick study of how PMBus works. It is quite common to see engineers copy/paste Linduino code snippets into an existing application and use them. But it is also possible to implement one of the Linduino layers and then reuse the whole library, including:

• Device and Rail Discovery

• Command API

• Fault Log Decoding

• In System Programming

This article will present the Linduino libraries, Power System Management programming, setup and use of Linduino PSM with demo circuits, and PSM debugging techniques. For detailed information on the protocols and generic programming questions, refer to Linear Technology’s Application Note 135, Implementing Robust PMBus Software for the LTC3880, and the industry standards for I2C/SMBus/ PMBus.

LINDUINO PSM HARDWARE

Linduino PSM hardware consists of a Linduino (DC2026), and a shield to connect (DC2294) the I2C pins of the Linduino to a PMBus/SMBus/I2CBus of a demo board or product board.

For optimal learning, start with a DC2026 (Linduino), DC2294 (Shield), DC1962 (Power Stick), and a Total Phase Beagle (I2C Sniffer). This allows programming, debugging, and learning of controllers (LTC388X) and managers (LTC297X).

Figure 1, Evaluation Hardware, shows the suggested evaluation hardware all connected together. To use this hardware, connect the Linduino and Beagle to a computer with two USB cables. If you do not have the Beagle USB connected, disconnect the Beagle ribbon cable from the DC2294 to prevent interference with PMBus traffic to/from the DC1962.

Figure 1. Evaluation Hardware

If you are connecting to a system board, a DC2086 works for most situations.

The DC2086 (Figure 2) will accept a connection from the DC2294, and supports 12-pin ribbon, 14-pin ribbon, and 4-pin cables. The DC2086 also supports an external power input for system boards that require more power than the Linduino can supply.

Figure 2. System Hardware

LINDUINO PSM SKETCHES

Before jumping into how the PMBus libraries work, a quick walk through of a DC1962 Sketch will clarify the general use model of Linduino PSM. It will also demonstrate how easy it is to write code, even for non-programmers.

To follow along, two downloads are required: the Arduino tools, and the Linduino Sketchbook. The Arduino tools can be downloaded from www.arduino.cc, and the Linduino Sketchbook can be downloaded from www.linear.com/linduino.

The Arduino tools run on multiple platforms. This Application Note was built and run using Arduino 1.6.4 running on 64-bit Ubuntu 14 TLS.

Let’s get started:

Step 1: Configuration

When the Arudino software is run the first time, it will be using a default Sketchbook, not the Linduino Sketchbook downloaded from www.linear.com.

To change to the Linduino Sketchbook, use the File | Preferences selection on the menu bar as shown in Figure 3, Finding Preferences Dialog.

Figure 3. Finding Preferences Dialog

Figure 4, Preferences Dialog, shows that the Sketchbook Location is at the top of the dialog box. Using the Browse button, navigate to the LTSketchbook that was downloaded from www.linear.com/linduino. It is also helpful to check ON Display line numbers, and Show verbose output during compilation. The latter setting scrolls compiler messages on the command line where they are easier to see.

Figure 4. Preferences Dialog

After setting the path, all Arduino windows must be closed, and the Arduino software must be restarted. When Arduino is restarted, it re-scans the Sketchbook directory and builds up the Arduino menus. If the Arduino software is not restarted, the menus will not reflect the LTSketchbook, and will instead point to the previous Sketchbook.

Step 2: Load Your First Sketch

Load the hello_world Sketch by imitating Figure 5, Loading hello_world.

 

Figure 5. Loading hello.world

After the Sketch is loaded, a window with the Sketch pops up, as shown in Figure 6, Sketch Window.

Figure 6. Sketch Window

 


Step 3: Compile and Run

Compile the Sketch by pressing the checkmark on the toolbar, as shown in Figure 7, Arduino Toolbar.





Figure 7. Arduino Toolbar

 

The arrow pointing right will compile and load the compiled Sketch into the Linduino hardware. The magnifier displays the output of the Sketch. Think of the arrow as sending the code to the display console, or compiling and sending the code to the Linduino hardware so that the display console has something to talk to.

Note: The Arduino Board type should be set to Arduino Uno, and the port should be selected. See Tools Menu.

 

After the Sketch is loaded, press the magnifier on the right side of the toolbar to open the console window. Set the line ending to Carriage return and baud rate to 115200 to match Figure 8, Arduino Command Window.

Figure 8. Arduino Command Window

To interact with the sketch, put the cursor in the box at the top (left of the Send button), type a number from the menu, and then press the Send button or <CR>. The Sketch will then execute the command and then re-display the menu.

Step 4: Explore Menu Items

Figure 9, Sketch Menus, shows what happens when pressing 1 to change to the Basic Commands window, followed by pressing 1 to Read All Voltages. The measured VOUT values of all rails of the DC1962 are read and printed.

 

Figure 9. Sketch Menus

The Sketch runs until the console is closed by pressing the X in the top left corner. If the console is reopened, it will restart the Sketch.

You can now explore the other menu options, and if you are familiar with a Beagle, run some traces and examine the bus transactions.

Step 5: Modifying of Code

The Sketch has two entry points. There is a setup() function that is called once, and a loop() function that is called forever in a loop. These are part of the Arduino coding environment. If you are an experienced C programmer, you are probably wondering where is main()? The Arduino libraries have a predefined main() that calls setup() and an infinite loop calling loop().

The menus are coded as helper functions inside the Sketch, and loop() calls the main menu. Each menu is supported with a case statement, where each case handles one menu number.

Continue reading the next page on Embedded's sister site, EDN: "Linduino for power system management."

 

Loading comments...