Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
X
x393
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Commits
Open sidebar
Elphel
x393
Commits
54b2c930
Commit
54b2c930
authored
May 17, 2016
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
minor clean up
parent
beb06b1f
Changes
5
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
5 changed files
with
80 additions
and
82 deletions
+80
-82
x393_tasks01.vh
includes/x393_tasks01.vh
+3
-3
x393_jpeg.py
py393/x393_jpeg.py
+6
-1
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+25
-18
sensor_i2c.v
sensor/sensor_i2c.v
+1
-1
x393_testbench03.tf
x393_testbench03.tf
+45
-59
No files found.
includes/x393_tasks01.vh
View file @
54b2c930
...
@@ -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'b0
10;
AWSIZE_IN_r <=
2'b
10;
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'b0
10;
ARSIZE_IN_r <=
2'b
10;
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;
...
...
py393/x393_jpeg.py
View file @
54b2c930
...
@@ -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
...
...
py393/x393_sens_cmprs.py
View file @
54b2c930
...
@@ -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
):
...
...
sensor/sensor_i2c.v
View file @
54b2c930
...
@@ -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
...
...
x393_testbench03.tf
View file @
54b2c930
This diff is collapsed.
Click to expand it.
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment