A script for reading current values using the Power Monitor

cancel
Showing results for 
Search instead for 
Did you mean: 
363 Discussions

A script for reading current values using the Power Monitor

A script for reading current values using the Power Monitor



Important: Request for Information

This work would be much more reliable if we had more information about the System Controller design. The system controller is implemented in a MAX II device, in the boards with power monitoring capability.

If you have any information to share, please drop me a note. Thanks!

Abstract

Scripts in TCL and Ruby for automating the power monitor circuit available in some FPGA boards.

Download the most recent version from GitHub (https://github.com/ricardo-jasinski/power_monitor_automation). Fork the project if you want to contribute with changes.

The scripts have been tested with:

  • Cyclone IV GX Transceiver Starter Kit
  • Cyclone IV GX FPGA Development Kit

Background

Some kits from Altera® include an LTC2148 ADC whose differential inputs are connected to shunt resistors in series with the power rails that supply current to the FPGA. The ADC is controller by an SLD node that can be controlled via JTAG using the System Console application.

If you know the shunt resistor values, you can calculate the current that passes through each rail. This is what this script does.

Installing

There is no installation, just put everything in the same folder.

To run the Ruby script, you need to have Ruby (the programming language) installed in your system. Download it from www.rubyinstaller.org. Version 2.0.0 should work.

Usage

Run the Ruby script. Depending on your environment, you could try:

ruby power_reader.rb

./power_reader.rb

power_reader

Here is a sample output:

Board detected: Cyclone IV GX Transceiver Starter Kit

Current readings:

2.5_VCC 0.041 A Rail 8 0xbf 0x0

1.2_VCCL_GXB 0.068 A Rail 1 0x3f 0x1

2.5_VCC_GXB 0.057 A Rail 2 0xa 0x1

2.5_VCCIO 0.006 A Rail 3 0x1e 0x0

1.2_VCCINT 0.166 A Rail 4 0xe 0x3

1.2_VCCD_PLL 0.033 A Rail 5 0x9d 0x0

open 0.004 A Rail 6 0x11 0x0

open 0.005 A Rail 7 0x16 0x0

Going low-level

If you want, you can bypass the Ruby script and run the TCL script with System Console:

\altera\14.0\quartus\sopc_builder\bin\system-console --script=read_power_rails.tcl

Compatibility

All scripts were developed and tested in Microsoft Windows 8.1 with Quartus II 14.0. Previous versions of Quartus should work as well (also tested with 13.1sp1). I have used Ruby 2.0.0p0, but other versions should work too.

This script has been tested with the following boards:

  • Cyclone IV GX Transceiver Starter Kit
  • Cyclone IV GX FPGA Development Kit

Adapting to other FPGA boards and environments

It should be possible to run it with little changes in other platforms compatible with the Power Monitor™ infrastructure. Here are some directions:

  • Change the value of QUARTUS_DIR in the Ruby script if it is not `\altera\13.0sp1\quartus`
  • Each of the two supported boards have different procedures for reading the ADC samples. You may have to adapt proc read_adc_channel in the TCL script.
  • The Ruby script is preconfigured with board information for the two mentioned kits. If you need to change it to support another kit:
  • Find the place in the Ruby script where the variable `rails` is set.
  • Look up the power rail names in the Power Monitor GUI and board schematics.
  • Look up the resistor values on the SMD resistors and in the board schematics.
  • Update the column `ADC_idx` with the index of the ADC channels for each rail.
  • Update the column `Rail #` with the values you see when you run the TCL script.

Please let me know if you succeed in doing so or if you need any help.

References

Acknowledgements

Much of the information came from the sources below. Many thanks to the respective authors for sharing their experience!

License

Public domain. Do with this code whatever you want, just don't hold me responsible for anything.

If you find it useful, please drop me a note so that I can gauge how much effort to put into this project. :)

Legal

Cyclone, Power Monitor, and System Console are trademarks of Altera Corporation.

Version history
Last update:
‎06-21-2019 06:26 PM
Updated by:
Contributors