Commit 54b2c930 authored by Andrey Filippov's avatar Andrey Filippov

minor clean up

parent beb06b1f
...@@ -326,7 +326,7 @@ ...@@ -326,7 +326,7 @@
AWID_IN_r <= id; AWID_IN_r <= id;
AWADDR_IN_r <= addr; AWADDR_IN_r <= addr;
AWLEN_IN_r <= len; AWLEN_IN_r <= len;
AWSIZE_IN_r <= 3'b010; AWSIZE_IN_r <= 2'b10;
AWBURST_IN_r <= burst; AWBURST_IN_r <= burst;
AW_SET_CMD_r <= 1'b1; AW_SET_CMD_r <= 1'b1;
if (data_en && W_READY) begin if (data_en && W_READY) begin
...@@ -414,14 +414,14 @@ ...@@ -414,14 +414,14 @@
ARID_IN_r <= id; ARID_IN_r <= id;
ARADDR_IN_r <= addr; ARADDR_IN_r <= addr;
ARLEN_IN_r <= len; ARLEN_IN_r <= len;
ARSIZE_IN_r <= 3'b010; ARSIZE_IN_r <= 2'b10;
ARBURST_IN_r <= burst; ARBURST_IN_r <= burst;
AR_SET_CMD_r <= 1'b1; AR_SET_CMD_r <= 1'b1;
wait (CLK); wait (CLK);
ARID_IN_r <= 12'hz; ARID_IN_r <= 12'hz;
ARADDR_IN_r <= 'hz; ARADDR_IN_r <= 'hz;
ARLEN_IN_r <= 4'hz; ARLEN_IN_r <= 4'hz;
ARSIZE_IN_r <= 3'hz; ARSIZE_IN_r <= 2'hz;
ARBURST_IN_r <= 2'hz; ARBURST_IN_r <= 2'hz;
AR_SET_CMD_r <= 1'b0; AR_SET_CMD_r <= 1'b0;
LAST_ARID <= id; LAST_ARID <= id;
......
...@@ -997,10 +997,15 @@ print_status_sensor_io all ...@@ -997,10 +997,15 @@ print_status_sensor_io all
setup_all_sensors True None 0x4 setup_all_sensors True None 0x4
################## Parallel ################## ################## Parallel ##################
cd /usr/local/verilog/; test_mcntrl.py @tpargs -x
cd /usr/local/verilog/; test_mcntrl.py @hargs cd /usr/local/verilog/; test_mcntrl.py @hargs
bitstream_set_path /usr/local/verilog/x393_parallel.bit bitstream_set_path /usr/local/verilog/x393_parallel.bit
#fpga_shutdown #fpga_shutdown
setupSensorsPower "PAR12" #setupSensorsPower "PAR12"
setupSensorsPower "PAR12" all 0 0.0
measure_all "*DI" measure_all "*DI"
setup_all_sensors True None 0xf setup_all_sensors True None 0xf
#set quadrants #set quadrants
......
...@@ -236,7 +236,12 @@ class X393SensCmprs(object): ...@@ -236,7 +236,12 @@ class X393SensCmprs(object):
def get_circbuf_byte_end(self): # should be 4KB page aligned def get_circbuf_byte_end(self): # should be 4KB page aligned
global BUFFER_ADDRESS, BUFFER_LEN global BUFFER_ADDRESS, BUFFER_LEN
return BUFFER_ADDRESS + BUFFER_LEN return BUFFER_ADDRESS + BUFFER_LEN
def sleep_ms(self, time_ms):
"""
Sleep for specified number of milliseconds
@param time_ms - sleep time in milliseconds
"""
time.sleep(0.001*time_ms)
def setSensorClock(self, freq_MHz = 24.0, iface = "2V5_LVDS", quiet = 0): def setSensorClock(self, freq_MHz = 24.0, iface = "2V5_LVDS", quiet = 0):
""" """
Set up external clock for sensor-synchronous circuitry (and sensor(s) themselves. Set up external clock for sensor-synchronous circuitry (and sensor(s) themselves.
...@@ -279,7 +284,14 @@ class X393SensCmprs(object): ...@@ -279,7 +284,14 @@ class X393SensCmprs(object):
print ("Set sensors %s interface voltage to %d mV"%(("0, 1","2, 3")[sub_pair],voltage_mv)) print ("Set sensors %s interface voltage to %d mV"%(("0, 1","2, 3")[sub_pair],voltage_mv))
time.sleep(0.1) time.sleep(0.1)
def setupSensorsPower(self, ifaceType, pairs = "all", quiet=0): def setupSensorsPower(self, ifaceType, pairs = "all", quiet=0, dly=0.1):
"""
Set interface voltage and turn on power for interface and the sensors
according to sensor type
@param pairs - 'all' or list/tuple of pairs of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param quiet - reduce output
@param dly - debug feature: step delay in sec
"""
try: try:
if (pairs == all) or (pairs[0].upper() == "A"): #all is a built-in function if (pairs == all) or (pairs[0].upper() == "A"): #all is a built-in function
pairs = (0,1) pairs = (0,1)
...@@ -288,44 +300,39 @@ class X393SensCmprs(object): ...@@ -288,44 +300,39 @@ class X393SensCmprs(object):
if not isinstance(pairs,(list,tuple)): if not isinstance(pairs,(list,tuple)):
pairs = (pairs,) pairs = (pairs,)
for pair in pairs: for pair in pairs:
self.setSensorIfaceVoltagePower(pair, SENSOR_INTERFACES[ifaceType]["mv"]) self.setSensorIfaceVoltagePower(sub_pair = pair,
voltage_mv = SENSOR_INTERFACES[ifaceType]["mv"],
quiet = quiet,
dly = dly)
def setSensorIfaceVoltagePower(self, sub_pair, voltage_mv, quiet=0): def setSensorIfaceVoltagePower(self, sub_pair, voltage_mv, quiet=0, dly=0.1):
""" """
Set interface voltage and turn on power for interface and the sensors Set interface voltage and turn on power for interface and the sensors
@param sub_pair - pair of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4 @param sub_pair - pair of the sensors: 0 - sensors 1 and 2, 1 - sensors 3 and 4
@param voltage_mv - desired interface voltage (1800..2800 mv) @param voltage_mv - desired interface voltage (1800..2800 mv)
@param quiet - reduce output @param quiet - reduce output
@param dly - debug feature: step delay in sec
""" """
self.setSensorPower(sub_pair = sub_pair, power_on = 0) self.setSensorPower(sub_pair = sub_pair, power_on = 0)
time.sleep(0.2) time.sleep(2*dly)
self.setSensorIfaceVoltage(sub_pair=sub_pair, voltage_mv = voltage_mv) self.setSensorIfaceVoltage(sub_pair=sub_pair, voltage_mv = voltage_mv)
time.sleep(0.2) time.sleep(2*dly)
if self.DRY_MODE: if self.DRY_MODE:
print ("Not defined for simulation mode") print ("Not defined for simulation mode")
return return
if quiet == 0: if quiet == 0:
print ("Turning on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair])) print ("Turning on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair]))
time.sleep(0.3) time.sleep(3*dly)
with open (POWER393_PATH + "/channels_en","w") as f: with open (POWER393_PATH + "/channels_en","w") as f:
print(("vcc_sens01", "vcc_sens23")[sub_pair], file = f) print(("vcc_sens01", "vcc_sens23")[sub_pair], file = f)
if quiet == 0: if quiet == 0:
print ("Turned on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair])) print ("Turned on interface power %f V for sensors %s"%(voltage_mv*0.001,("0, 1","2, 3")[sub_pair]))
time.sleep(0.3) time.sleep(3*dly)
with open (POWER393_PATH + "/channels_en","w") as f: with open (POWER393_PATH + "/channels_en","w") as f:
print(("vp33sens01", "vp33sens23")[sub_pair], file = f) print(("vp33sens01", "vp33sens23")[sub_pair], file = f)
if quiet == 0: if quiet == 0:
print ("Turned on +3.3V power for sensors %s"%(("0, 1","2, 3")[sub_pair])) print ("Turned on +3.3V power for sensors %s"%(("0, 1","2, 3")[sub_pair]))
time.sleep(0.2) time.sleep(2*dly)
# for sub_pair in (0,1):
# self.setSensorIfaceVoltagePower(sub_pair, SENSOR_INTERFACES[ifaceType]["mv"])
# def getSensorInterfaceType(self):
# """
# Get sensor interface type by reading status register 0xfe that is set to 0 for parallel and 1 for HiSPi
# @return "PAR12" or "HISPI"
# """
# return (SENSOR_INTERFACE_PARALLEL, SENSOR_INTERFACE_HISPI)[self.x393_axi_tasks.read_status(address=0xfe)] # "PAR12" , "HISPI"
def setupSensorsPowerClock(self, setPower=False, quiet=0): def setupSensorsPowerClock(self, setPower=False, quiet=0):
......
...@@ -378,7 +378,7 @@ module sensor_i2c#( ...@@ -378,7 +378,7 @@ module sensor_i2c#(
if (reset_on) page_r <= 0; if (reset_on) page_r <= 0;
else if (page_r_inc[0]) page_r <= page_r+1; else if (page_r_inc[0]) page_r <= page_r+1;
`else `else
if (reset_on) page_r <= frame_num_seq; if (sync_to_seq) page_r <= frame_num_seq;
else if (page_r_inc[0]) page_r <= page_r+1; else if (page_r_inc[0]) page_r <= page_r+1;
`endif `endif
......
This diff is collapsed.
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