forked from M-Labs/artiq-zynq
driver: add power off to reduce temp
driver: add test pattern driver: add pixel format select
This commit is contained in:
parent
62c72c11b0
commit
6416dc6ea2
@ -244,15 +244,32 @@ _REAL_ACQ_MODE = 0x10000bb4
|
||||
_REAL_ACQ_START = 0x10000498
|
||||
_REAL_ACQ_STOP = 0x100004a4
|
||||
_REAL_ACQ_ABORT = 0x100004b0 #stop all acq immediately
|
||||
_BSL_SENSOR_ON = 0x100004d4 # power on sensor
|
||||
_BSL_SENSOR_STAND_BY = 0x100004c8 # put sensor in standby mode, certain parameter can only be change during standby
|
||||
_BSL_SENSOR_OFF = 0x100004bc # power down sensor
|
||||
_BSL_POWER_MODE = 0x100000b4
|
||||
# strange d_470 -> d_469 (= 3) perhaps a obscure security trick? So I guess looking @ Index"3" is fine?
|
||||
_TRIG_MODE_INDEX_3 = 0x10001424 # d_87
|
||||
_TRIG_SRC_INDEX_3 = 0x100081ac # d_479
|
||||
_TRIG_ACT_INDEX_3 = 0x1000293c # d_502
|
||||
_TRIG_SOFTWARE_INDEX_3 = 0x10000c34 # d_525
|
||||
# https://docs.baslerweb.com/test-patterns useful for testing out ROI
|
||||
_TEST_PATTERN = 0x10003500 # d_1431
|
||||
_PIXEL_FORMAT = 0x100078b4 #d_17
|
||||
|
||||
CXP_TRIG = True
|
||||
PIXELFORMAT = "MONO8"
|
||||
FORMAT_DICT = {
|
||||
"MONO8": 17301505,
|
||||
"MONO10": 17825795,
|
||||
"MONO12": 17825797,
|
||||
}
|
||||
TESTPATTERN = "OFF"
|
||||
PATTERN_DICT = {
|
||||
"OFF" : 0, # normal operation
|
||||
"BLACK" : 1, # all pixels set to 0
|
||||
"WHITE" : 2, # all pixels set to (2^N)-1
|
||||
}
|
||||
|
||||
class IdleKernel(EnvExperiment):
|
||||
def build(self):
|
||||
@ -280,7 +297,7 @@ class IdleKernel(EnvExperiment):
|
||||
self.cxp.init()
|
||||
|
||||
@kernel
|
||||
def camera_trigger_setup(self):
|
||||
def camera_trigger_setup(self, pixel_format, test_pattern):
|
||||
# DEBUG: Try to setup trigger
|
||||
# All address below is from the XML, what's the point of bootstrap anyway?
|
||||
# NOTE: setting is persistent over ConnectionReset but NOT power cycle
|
||||
@ -292,6 +309,11 @@ class IdleKernel(EnvExperiment):
|
||||
# boA2448-250cm is area scan camera:
|
||||
# see https://docs.baslerweb.com/triggered-image-acquisition#hardware-and-software-triggering to setup triggering properly
|
||||
|
||||
self.cxp.write_u32(_PIXEL_FORMAT, pixel_format)
|
||||
|
||||
# TEST parttern setup
|
||||
self.cxp.write_u32(_TEST_PATTERN, test_pattern)
|
||||
|
||||
# TRIGGER: setup
|
||||
# self.cxp.write_u32(_TRIG_SELECTOR, 3) # FrameStart by default, boA xml b_469 don't have an address for some reason
|
||||
self.cxp.write_u32(_TRIG_MODE_INDEX_3, 1) # ON
|
||||
@ -320,7 +342,7 @@ class IdleKernel(EnvExperiment):
|
||||
self.core.reset()
|
||||
self.core.break_realtime()
|
||||
|
||||
self.cxp.setup_roi(0, 1, 1, 10, 10)
|
||||
self.cxp.setup_roi(0, 1, 1, 2, 2)
|
||||
delay_mu(1000000)
|
||||
|
||||
if CXP_TRIG:
|
||||
@ -346,7 +368,7 @@ class IdleKernel(EnvExperiment):
|
||||
|
||||
# reduce power draw & temperature
|
||||
# overtemperature can cause unstable connection
|
||||
self.cxp.write_u32(_BSL_SENSOR_STAND_BY, 1)
|
||||
self.cxp.write_u32(_BSL_SENSOR_OFF, 1)
|
||||
|
||||
return self.cxp.read_u32(_BSL_POWER_MODE)
|
||||
|
||||
@ -354,8 +376,8 @@ class IdleKernel(EnvExperiment):
|
||||
print("[{}]".format(", ".join(hex(np.uint32(x)) for x in arr)))
|
||||
|
||||
def run(self):
|
||||
self.camera_init()
|
||||
print(f"power mode before trigger = {self.camera_trigger_setup()}")
|
||||
# self.camera_init()
|
||||
print(f"power mode before trigger = {self.camera_trigger_setup(FORMAT_DICT[PIXELFORMAT], PATTERN_DICT[TESTPATTERN])}")
|
||||
print(f"power mode after trigger = {self.camera_trigger()}")
|
||||
print(f"count = {np.uint32(self.cnt)} | timestamp = {self.timestamp}")
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user