Skip to content
Snippets Groups Projects
Commit 670ec4f9 authored by Gijs Schoonderbeek's avatar Gijs Schoonderbeek
Browse files

Added scripts to read UNB2 loc. POLs

Added 2 scripts, copied from JTAG project, to read out the power supplies of a single FPGA, known as local point of load (POL)
parent d7e4f8ca
No related branches found
No related tags found
1 merge request!2Modified the scripts to run on Raspberry Pi.
EEPROM_I2C_ADDR = 0x50 #"1010000"
LOC_POWER_CORE = 0x01 #"0000001" # 0x01
LOC_POWER_ERAM = 0x0D #"0001101" # 0x0D
LOC_POWER_TR_R = 0x0E #"0001110" # 0x0E
LOC_POWER_TR_T = 0x0F #"0001111" # 0x0F
LOC_POWER_BAT = 0x10 #"0010000" # 0x10
LOC_POWER_IO = 0x11 #"0010001" # 0x11
LOC_POWER_SUPPLIES = [LOC_POWER_CORE,LOC_POWER_ERAM,LOC_POWER_TR_R,LOC_POWER_TR_T,LOC_POWER_BAT,LOC_POWER_IO]
SWI_POWER_CORE = 0x0F #"0001111" # 0x0F
SWI_POWER_IO = 0x0E #"0001110" # 0x0E
CLK_PWR = 0x0D #"000000D" # 0x00
QSFP_BOT_PWR = 0x50 #"0000002" # 0x02
BRICK_PWR = 0x2c #"0000002" # 0x02
LP_VOUT_MODE = 0x20
LP_VOUT = 0x8B #
LP_temp = 0x8D #
LP_IOUT = 0x8C
QSFP_I2C_ADDR = 0x50 #"1010000"
QSFP_TEMP = 0x16 #"00010110" # (Byte1*256+Byte2)/256
QSFP_VOLT = 0x1A #"00011010" # (Byte1*256+Byte2)*0.0001
ETH_TEMP_I2C_ADDR = 0x4C #"1001100" # 0x29
ETH_LOC_TEMP = 0x00 #"00000000"
ETH_TEMP = 0x01 #"00000001"
MB_I_TEMP_I2C_ADDR = 0x18
MB_II_TEMP_I2C_ADDR = 0x19
MB_I_EEPROM = 0x50
MB_II_EEPROM = 0x51
MB_TEMP_REG = 0x05 # 5 #(Byte1*256+Byte2)*0.0625
MB_DATE = 0x143
MB_DATE_bytes = 2
MB_TYPE_NR = 0x149
MB_TYPE_NR_bytes = 20
PWR_CLK_I2C_ADDR = "0001101" # 0x0D
PWR_S3V3_I2C_ADDR = "0001110" # 0x0E
PWR_S1V2_I2C_ADDR = "0001111" # 0x0E
######################
# Functions
######################
# Calculate floating point value according PMBus lineair
def calc_lin_2bytes(data):
expo = ((data[1] & 0xf8)>>3)
if expo > 2**4:
expo = expo-2**5
mantisse = (data[1] & 0x7)*0x100 + data[0]
output = mantisse * 2**expo
return output
# Calculate floating point value according PMBus lineair
def calc_lin_3bytes(data,mode):
expo = (mode[0] & 0x1F)
if expo > 2**4:
expo = expo - 2**5
output = (data[1]*256 + data[0]) * 2**expo
return output
#******************************************#
# Application: JFT_1
# Created: 2015-05-21, 09:14:44
#******************************************#
#******************************************#
# Imports
#******************************************#
# Write your Imports here.
import sys
import time
sys.path.insert(0,'.')
import os
if os.name =="posix":
from I2C_serial_pi import *
else:
from I2C_serial import *
from UniBoard2_I2C import *
I2CBUSNR=1
LOC_PWR = I2C(LOC_POWER_SUPPLIES[0])
LOC_PWR.bus = I2CBUSNR
ret_ack, ret_value = LOC_PWR.read_bytes(0)
if ret_ack < 1:
print("no device found")
else:
pr_stri = "Found device at address 0x{:02x}".format(LOC_PWR.I2C_Address)
print(pr_stri)
value=[]
ret_ack,vout_mod = LOC_PWR.read_bytes(LP_VOUT_MODE, 1)
ret_ack,ret_value = LOC_PWR.read_bytes(LP_VOUT, 2)
vout = calc_lin_3bytes(ret_value, vout_mod)
print("vout = ", vout)
ret_ack,ret_value = LOC_PWR.read_bytes(LP_IOUT, 2)
iout = calc_lin_2bytes(ret_value)
print("Output Current :",iout)
ret_ack,ret_value = LOC_PWR.read_bytes(LP_temp, 2)
temp = calc_lin_2bytes(ret_value)
print("temperature :",temp)
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment