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
1c50ea54
Commit
1c50ea54
authored
Apr 13, 2019
by
Andrey Filippov
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
adding control for lwir sensor
parent
37190574
Changes
4
Hide whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
59 additions
and
44 deletions
+59
-44
x393_export_c.py
py393/x393_export_c.py
+1
-1
x393_sens_cmprs.py
py393/x393_sens_cmprs.py
+8
-5
x393_sensor.py
py393/x393_sensor.py
+46
-37
status_read.v
util_modules/status_read.v
+4
-1
No files found.
py393/x393_export_c.py
View file @
1c50ea54
...
@@ -1891,7 +1891,7 @@ class X393ExportC(object):
...
@@ -1891,7 +1891,7 @@ class X393ExportC(object):
dw
.
append
((
"in_busy"
,
8
,
1
,
0
,
"Frame segments are waited for or received to FIFO"
))
dw
.
append
((
"in_busy"
,
8
,
1
,
0
,
"Frame segments are waited for or received to FIFO"
))
dw
.
append
((
"out_busy"
,
9
,
1
,
0
,
"received frame is being transferred to video memory"
))
dw
.
append
((
"out_busy"
,
9
,
1
,
0
,
"received frame is being transferred to video memory"
))
dw
.
append
((
"crc_err"
,
10
,
1
,
0
,
"At least 1 CRC error happened since reset by command bit"
))
dw
.
append
((
"crc_err"
,
10
,
1
,
0
,
"At least 1 CRC error happened since reset by command bit"
))
dw
.
append
((
"fake
in"
,
11
,
1
,
0
,
"Just to keep hardware"
))
dw
.
append
((
"fake
_
in"
,
11
,
1
,
0
,
"Just to keep hardware"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state (0 means non-FPGA SFE is present)"
))
dw
.
append
((
"senspgmin"
,
24
,
1
,
0
,
"senspgm pin state (0 means non-FPGA SFE is present)"
))
dw
.
append
((
"busy"
,
25
,
1
,
0
,
"in_busy OR out_busy"
))
dw
.
append
((
"busy"
,
25
,
1
,
0
,
"in_busy OR out_busy"
))
dw
.
append
((
"seq_num"
,
26
,
6
,
0
,
"Sequence number"
))
dw
.
append
((
"seq_num"
,
26
,
6
,
0
,
"Sequence number"
))
...
...
py393/x393_sens_cmprs.py
View file @
1c50ea54
...
@@ -130,11 +130,13 @@ FRAME_START_ADDRESS_INC = 0x80000
...
@@ -130,11 +130,13 @@ FRAME_START_ADDRESS_INC = 0x80000
#SENSOR_INTERFACE_HISPI = "HISPI"
#SENSOR_INTERFACE_HISPI = "HISPI"
# for now - single sensor type per interface
# for now - single sensor type per interface
SENSOR_INTERFACES
=
{
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
:
{
"mv"
:
2800
,
"freq"
:
24.0
,
"iface"
:
"2V5_LVDS"
},
SENSOR_INTERFACES
=
{
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
:
{
"mv"
:
2800
,
"freq"
:
24.0
,
"iface"
:
"2V5_LVDS"
},
x393_sensor
.
SENSOR_INTERFACE_HISPI
:
{
"mv"
:
1820
,
"freq"
:
24.444
,
"iface"
:
"1V8_LVDS"
}}
x393_sensor
.
SENSOR_INTERFACE_HISPI
:
{
"mv"
:
1820
,
"freq"
:
24.444
,
"iface"
:
"1V8_LVDS"
},
x393_sensor
.
SENSOR_INTERFACE_LWIR
:
{
"mv"
:
2800
,
"freq"
:
24.0
,
"iface"
:
"2V5_LVDS"
}}
# x393_sensor.SENSOR_INTERFACE_HISPI: {"mv":2500, "freq":24.444, "iface":"1V8_LVDS"}}
# x393_sensor.SENSOR_INTERFACE_HISPI: {"mv":2500, "freq":24.444, "iface":"1V8_LVDS"}}
SENSOR_DEFAULTS
=
{
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
:
{
"width"
:
2592
,
"height"
:
1944
,
"top"
:
0
,
"left"
:
0
,
"slave"
:
0x48
,
"i2c_delay"
:
100
,
"bayer"
:
3
},
SENSOR_DEFAULTS
=
{
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
:
{
"width"
:
2592
,
"height"
:
1944
,
"top"
:
0
,
"left"
:
0
,
"slave"
:
0x48
,
"i2c_delay"
:
100
,
"bayer"
:
3
},
x393_sensor
.
SENSOR_INTERFACE_HISPI
:
{
"width"
:
4384
,
"height"
:
3288
,
"top"
:
0
,
"left"
:
0
,
"slave"
:
0x10
,
"i2c_delay"
:
100
,
"bayer"
:
2
}}
x393_sensor
.
SENSOR_INTERFACE_HISPI
:
{
"width"
:
4384
,
"height"
:
3288
,
"top"
:
0
,
"left"
:
0
,
"slave"
:
0x10
,
"i2c_delay"
:
100
,
"bayer"
:
2
},
x393_sensor
.
SENSOR_INTERFACE_LWIR
:
{
"width"
:
160
,
"height"
:
120
,
"top"
:
0
,
"left"
:
0
,
"slave"
:
0x2a
,
"i2c_delay"
:
100
,
"bayer"
:
2
}}
#SENSOR_DEFAULTS_SIMULATION= {x393_sensor.SENSOR_INTERFACE_PARALLEL: {"width":2592, "height":1944, "top":0, "left":0, "slave":0x48, "i2c_delay":100, "bayer":3},
#SENSOR_DEFAULTS_SIMULATION= {x393_sensor.SENSOR_INTERFACE_PARALLEL: {"width":2592, "height":1944, "top":0, "left":0, "slave":0x48, "i2c_delay":100, "bayer":3},
# x393_sensor.SENSOR_INTERFACE_HISPI: {"width":4384, "height":3288, "top":0, "left":0, "slave":0x10, "i2c_delay":100, "bayer":2}}
# x393_sensor.SENSOR_INTERFACE_HISPI: {"width":4384, "height":3288, "top":0, "left":0, "slave":0x10, "i2c_delay":100, "bayer":2}}
...
@@ -173,6 +175,7 @@ class X393SensCmprs(object):
...
@@ -173,6 +175,7 @@ class X393SensCmprs(object):
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"height"
]
=
vrlg
.
WOI_HEIGHT
+
4
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"height"
]
=
vrlg
.
WOI_HEIGHT
+
4
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"top"
]
=
0
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"top"
]
=
0
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"left"
]
=
0
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_HISPI
][
"left"
]
=
0
# do not update LWIR defaults !!!
if
nomargins
:
if
nomargins
:
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
][
"width"
]
=
vrlg
.
WOI_WIDTH
+
0
# 4
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
][
"width"
]
=
vrlg
.
WOI_WIDTH
+
0
# 4
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
][
"height"
]
=
vrlg
.
WOI_HEIGHT
+
0
SENSOR_DEFAULTS
[
x393_sensor
.
SENSOR_INTERFACE_PARALLEL
][
"height"
]
=
vrlg
.
WOI_HEIGHT
+
0
...
@@ -1540,9 +1543,9 @@ class X393SensCmprs(object):
...
@@ -1540,9 +1543,9 @@ class X393SensCmprs(object):
if
histogram_top
is
None
:
if
histogram_top
is
None
:
histogram_top
=
0
histogram_top
=
0
if
histogram_width_m1
is
None
:
if
histogram_width_m1
is
None
:
histogram_width_m1
=
window_width
-
33
histogram_width_m1
=
window_width
-
1
#
33
if
histogram_height_m1
is
None
:
if
histogram_height_m1
is
None
:
histogram_height_m1
=
window_height
-
1145
histogram_height_m1
=
window_height
-
1
# 1
145
self
.
specify_phys_memory
(
circbuf_chn_size
=
circbuf_chn_size
)
self
.
specify_phys_memory
(
circbuf_chn_size
=
circbuf_chn_size
)
"""
"""
...
...
py393/x393_sensor.py
View file @
1c50ea54
...
@@ -48,6 +48,7 @@ import subprocess
...
@@ -48,6 +48,7 @@ import subprocess
#import x393_sens_cmprs
#import x393_sens_cmprs
SENSOR_INTERFACE_PARALLEL
=
"PAR12"
SENSOR_INTERFACE_PARALLEL
=
"PAR12"
SENSOR_INTERFACE_HISPI
=
"HISPI"
SENSOR_INTERFACE_HISPI
=
"HISPI"
SENSOR_INTERFACE_LWIR
=
"LWIR"
class
X393Sensor
(
object
):
class
X393Sensor
(
object
):
DRY_MODE
=
True
# True
DRY_MODE
=
True
# True
...
@@ -74,8 +75,11 @@ class X393Sensor(object):
...
@@ -74,8 +75,11 @@ class X393Sensor(object):
@return "PAR12" or "HISPI"
@return "PAR12" or "HISPI"
"""
"""
if
self
.
DRY_MODE
is
True
:
if
self
.
DRY_MODE
is
True
:
print
(
"===== Running in dry mode, using parallel sensor======"
)
return
SENSOR_INTERFACE_PARALLEL
return
SENSOR_INTERFACE_PARALLEL
return
(
SENSOR_INTERFACE_PARALLEL
,
SENSOR_INTERFACE_HISPI
)[
self
.
x393_axi_tasks
.
read_status
(
address
=
0xfe
)]
# "PAR12" , "HISPI"
sens_type
=
(
SENSOR_INTERFACE_PARALLEL
,
SENSOR_INTERFACE_HISPI
,
SENSOR_INTERFACE_LWIR
)[
self
.
x393_axi_tasks
.
read_status
(
address
=
0xfe
)]
# "PAR12" , "HISPI"
print
(
"===== Sensor type read from FPGA = >>>
%
s <<< ======"
%
(
sens_type
))
return
sens_type
def
program_status_sensor_i2c
(
self
,
def
program_status_sensor_i2c
(
self
,
num_sensor
,
num_sensor
,
...
@@ -155,7 +159,7 @@ class X393Sensor(object):
...
@@ -155,7 +159,7 @@ class X393Sensor(object):
address
=
(
vrlg
.
SENSI2C_STATUS_REG_BASE
+
num_sensor
*
vrlg
.
SENSI2C_STATUS_REG_INC
+
vrlg
.
SENSIO_STATUS_REG_REL
))
address
=
(
vrlg
.
SENSI2C_STATUS_REG_BASE
+
num_sensor
*
vrlg
.
SENSI2C_STATUS_REG_INC
+
vrlg
.
SENSIO_STATUS_REG_REL
))
def
print_status_sensor_io
(
self
,
def
print_status_sensor_io
(
self
,
num_sensor
=
"All"
):
num_sensor
=
"All"
,
sensorType
=
SENSOR_INTERFACE_PARALLEL
):
"""
"""
Print sensor_io status word (no sync)
Print sensor_io status word (no sync)
@param num_sensor - number of the sensor port (0..3)
@param num_sensor - number of the sensor port (0..3)
...
@@ -164,47 +168,52 @@ class X393Sensor(object):
...
@@ -164,47 +168,52 @@ class X393Sensor(object):
if
(
num_sensor
==
all
)
or
(
num_sensor
[
0
]
.
upper
()
==
"A"
):
#all is a built-in function
if
(
num_sensor
==
all
)
or
(
num_sensor
[
0
]
.
upper
()
==
"A"
):
#all is a built-in function
for
num_sensor
in
range
(
4
):
for
num_sensor
in
range
(
4
):
print
(
"
\n
==== Sensor
%
d"
%
(
num_sensor
))
print
(
"
\n
==== Sensor
%
d"
%
(
num_sensor
))
self
.
print_status_sensor_io
(
num_sensor
=
num_sensor
)
self
.
print_status_sensor_io
(
num_sensor
=
num_sensor
,
sensorType
=
sensorType
)
return
return
except
:
except
:
pass
pass
status
=
self
.
get_status_sensor_io
(
num_sensor
)
status
=
self
.
get_status_sensor_io
(
num_sensor
)
print
(
"print_status_sensor_io(
%
d):"
%
(
num_sensor
))
print
(
"print_status_sensor_io(
%
d):"
%
(
num_sensor
))
if
(
sensorType
==
SENSOR_INTERFACE_LWIR
):
pass
else
:
#last_in_line_1cyc_mclk, dout_valid_1cyc_mclk
#last_in_line_1cyc_mclk, dout_valid_1cyc_mclk
"""
"""
print (" last_in_line_1cyc_mclk =
%
d"
%
((status>>23) & 1))
print (" last_in_line_1cyc_mclk =
%
d"
%
((status>>23) & 1))
print (" dout_valid_1cyc_mclk =
%
d"
%
((status>>22) & 1))
print (" dout_valid_1cyc_mclk =
%
d"
%
((status>>22) & 1))
print (" alive_hist0_gr =
%
d"
%
((status>>21) & 1))
print (" alive_hist0_gr =
%
d"
%
((status>>21) & 1))
print (" alive_hist0_rq =
%
d"
%
((status>>20) & 1))
print (" alive_hist0_rq =
%
d"
%
((status>>20) & 1))
print (" sof_out_mclk =
%
d"
%
((status>>19) & 1))
print (" sof_out_mclk =
%
d"
%
((status>>19) & 1))
print (" eof_mclk =
%
d"
%
((status>>18) & 1))
print (" eof_mclk =
%
d"
%
((status>>18) & 1))
print (" sof_mclk =
%
d"
%
((status>>17) & 1))
print (" sof_mclk =
%
d"
%
((status>>17) & 1))
print (" sol_mclk =
%
d"
%
((status>>16) & 1))
print (" sol_mclk =
%
d"
%
((status>>16) & 1))
"""
"""
"""
"""
#Folowing 5 bits may be just temporarily available
#Folowing 5 bits may be just temporarily available
print (" irst =
%
d"
%
((status>>20) & 1))
print (" irst =
%
d"
%
((status>>20) & 1))
print ("async_prst_with_sens_mrst =
%
d"
%
((status>>19) & 1))
print ("async_prst_with_sens_mrst =
%
d"
%
((status>>19) & 1))
print (" imrst =
%
d"
%
((status>>18) & 1))
print (" imrst =
%
d"
%
((status>>18) & 1))
print (" rst_mmcm =
%
d"
%
((status>>17) & 1))
print (" rst_mmcm =
%
d"
%
((status>>17) & 1))
print (" pxd_out_pre[1] =
%
d"
%
((status>>16) & 1))
print (" pxd_out_pre[1] =
%
d"
%
((status>>16) & 1))
"""
"""
print
(
" shifted TDO
%
d"
%
((
status
>>
16
)
&
0xff
))
print
(
" shifted TDO
%
d"
%
((
status
>>
16
)
&
0xff
))
print
(
" vact_alive =
%
d"
%
((
status
>>
15
)
&
1
))
print
(
" vact_alive =
%
d"
%
((
status
>>
15
)
&
1
))
print
(
" hact_ext_alive =
%
d"
%
((
status
>>
14
)
&
1
))
print
(
" hact_ext_alive =
%
d"
%
((
status
>>
14
)
&
1
))
# print (" hact_alive = %d"%((status>>13) & 1))
# print (" hact_alive = %d"%((status>>13) & 1))
print
(
" hact_run =
%
d"
%
((
status
>>
13
)
&
1
))
print
(
" hact_run =
%
d"
%
((
status
>>
13
)
&
1
))
print
(
" locked_pxd_mmcm =
%
d"
%
((
status
>>
12
)
&
1
))
print
(
" locked_pxd_mmcm =
%
d"
%
((
status
>>
12
)
&
1
))
print
(
" clkin_pxd_stopped_mmcm =
%
d"
%
((
status
>>
11
)
&
1
))
print
(
" clkin_pxd_stopped_mmcm =
%
d"
%
((
status
>>
11
)
&
1
))
print
(
" clkfb_pxd_stopped_mmcm =
%
d"
%
((
status
>>
10
)
&
1
))
print
(
" clkfb_pxd_stopped_mmcm =
%
d"
%
((
status
>>
10
)
&
1
))
print
(
" xfpgadone =
%
d"
%
((
status
>>
9
)
&
1
))
print
(
" xfpgadone =
%
d"
%
((
status
>>
9
)
&
1
))
print
(
" ps_rdy =
%
d"
%
((
status
>>
8
)
&
1
))
print
(
" ps_rdy =
%
d"
%
((
status
>>
8
)
&
1
))
print
(
" ps_out =
%
d"
%
((
status
>>
0
)
&
0xff
))
print
(
" ps_out =
%
d"
%
((
status
>>
0
)
&
0xff
))
print
(
" xfpgatdo =
%
d"
%
((
status
>>
25
)
&
1
))
print
(
" xfpgatdo =
%
d"
%
((
status
>>
25
)
&
1
))
print
(
" senspgmin =
%
d"
%
((
status
>>
24
)
&
1
))
print
(
" senspgmin =
%
d"
%
((
status
>>
24
)
&
1
))
print
(
" seq =
%
d"
%
((
status
>>
26
)
&
0x3f
))
print
(
" seq =
%
d"
%
((
status
>>
26
)
&
0x3f
))
#vact_alive, hact_ext_alive, hact_alive
#vact_alive, hact_ext_alive, hact_alive
def
get_status_sensor_i2c
(
self
,
def
get_status_sensor_i2c
(
self
,
num_sensor
=
"All"
):
num_sensor
=
"All"
):
...
...
util_modules/status_read.v
View file @
1c50ea54
...
@@ -101,7 +101,10 @@ module status_read#(
...
@@ -101,7 +101,10 @@ module status_read#(
initial
begin
initial
begin
ram
[
DATA_2DEPTH
]
=
FPGA_VERSION
;
ram
[
DATA_2DEPTH
]
=
FPGA_VERSION
;
`ifdef
HISPI
`ifdef
HISPI
ram
[
DATA_2DEPTH
-
1
]
=
1
;
//0 - parallel sensor, 1 - HiSPi sensor
ram
[
DATA_2DEPTH
-
1
]
=
1
;
//0 - parallel sensor, 1 - HiSPi sensor, 2 - LWIR 160x120 sensor
`elsif
LWIR
ram
[
DATA_2DEPTH
-
1
]
=
2
;
//0 - parallel sensor, 1 - HiSPi sensor, 2 - LWIR 160x120 sensor
`endif
`endif
end
end
always
@
(
posedge
axi_clk
)
begin
always
@
(
posedge
axi_clk
)
begin
...
...
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