Commit e002f02b authored by Matthieu Cattin's avatar Matthieu Cattin

test20: Work in progress. Get calibration data from EEPROM instead of file.

parent 224c87dc
......@@ -16,9 +16,11 @@ import os
sys.path.append('../../../')
sys.path.append('../../../gnurabbit/python/')
sys.path.append('../../../common/')
sys.path.append('../../fmceeprom/python/')
# Import common modules
from ptsexcept import *
from fmc_eeprom import *
import rr
# Import specific modules
......@@ -34,6 +36,7 @@ from PAGE.SineWaveform import *
from ctypes import *
"""
test20: Calibration verification
......@@ -232,6 +235,8 @@ def main (default_directory = '.'):
AWG_BAUD = 57600
CALIBR_FILENAME = "calibration_data.txt"
EEPROM_BIN_FILENAME = "eeprom_content.out"
EEPROM_SIZE = 8192 # in Bytes
start_test_time = time.time()
......@@ -312,9 +317,32 @@ def main (default_directory = '.'):
f_in = open(in_filename,"r+")
for line in f_in:
all_corr_data.append(int(line,16))
print "0x%04X" % all_corr_data[-1]
# print "0x%04X" % all_corr_data[-1]
f_in.close()
for item in all_corr_data:
print "0x%04X" % item
# Read entire EEPROM
eeprom_data_read = fmc.sys_i2c_eeprom_read(0, EEPROM_SIZE)
# Write EEPROM data to binary file
f_eeprom = open(EEPROM_BIN_FILENAME, "wb")
for byte in eeprom_data_read:
f_eeprom.write(chr(byte))
f_eeprom.close()
# Get calibration data
print "Get calibration data from EEPROM."
eeprom_data = open(EEPROM_BIN_FILENAME, "rb").read()
eeprom_corr_data = ipmi_get_internal_use_data(eeprom_data)
#print "Calibration data length (bytes): %d" % len(eeprom_corr_data)
print "correction data from eeprom"
print eeprom_corr_data
#for item in eeprom_corr_data:
# print "0x%s" % item
print "\nGet ADC correctioon parameters:"
for IN_RANGE in RANGES:
for ch in range(NB_CHANNELS):
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment