driver: boA trigger proto

This commit is contained in:
morgan 2024-12-19 15:20:26 +08:00
parent 86434281d8
commit 56775c63da

View File

@ -234,20 +234,58 @@ class IdleKernel(EnvExperiment):
# self.cxp.start() # self.cxp.start()
# self.cxp.trigger(0, 0) # self.cxp.trigger(0, 0)
# self.cxp.stop() # self.cxp.stop()
# cxp_debug_frame_print()
# TODO: use TEST_PACKET_COUNT_TX to compare with readu64 # TODO: use TEST_PACKET_COUNT_TX to compare with readu64
# self.cxp.read_wide(self.cxp.acq_start_addr, 2) # self.cxp.read_wide(self.cxp.acq_start_addr, 2)
# NOTE: but why the acq start reg keep its value # NOTE: but why the acq start reg keep its value
# So acq_start is a u32 register, the extra bits are useless # So acq_start is a u32 register, the extra bits are useless
self.cxp.get_xml_data(0xc0000000, self.vals) # DEBUG: download xml file on camera
# self.cxp.get_xml_data(0xc0000000, self.vals)
# DEBUG: Try to setup trigger
# All address below is from the XML, what's the point of bootstrap anyway?
# NOTE: setting persistent over ConnectionReset but NOT power cycle
_USER_SET_SELECTOR = 0x10000050
_REAL_ACQ_MODE = 0x10000bb4
_REAL_ACQ_START = 0x10000498
_REAL_ACQ_STOP = 0x100004a4
_REAL_ACQ_ABORT = 0x100004b0 #stop all acq immediately
# self.cxp.write_u32(_REAL_ACQ_MODE, 1) # single frame mode
# self.cxp.write_u32(_REAL_ACQ_START, 1) # single acq start
# self.cxp.write_u32(_REAL_ACQ_STOP, 1) # single acq end
# self.cxp.write_u32(_REAL_ACQ_ABORT, 1) # single acq ABORT
_BSL_SENSOR_STAND_BY = 0x100004c8 # put sensor in standby mode, certain parameter can only be change during standby
_BSL_POWER_MODE = 0x100000b4
# boA2448-250cm is area scan camera:
# see https://docs.baslerweb.com/triggered-image-acquisition#hardware-and-software-triggering to setup triggering properly
# 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
# 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
self.cxp.write_u32(_TRIG_SRC_INDEX_3, 7) # CXPTrigger0
self.cxp.write_u32(_TRIG_ACT_INDEX_3, 2) # trig on anyedge
self.cxp.write_u32(_REAL_ACQ_MODE, 1) # single frame mode
self.cxp.write_u32(_REAL_ACQ_START, 1) # single acq start
# self.cxp.write_u32(_REAL_ACQ_STOP, 1) # single acq end
# self.cxp.write_u32(_REAL_ACQ_ABORT, 1) # single acq ABORT
# self.cxp.write_u32(_BSL_SENSOR_STAND_BY, 1)
return self.cxp.read_u32(_BSL_POWER_MODE)
def print_hex(self, arr: TList(TInt32)): def print_hex(self, arr: TList(TInt32)):
print("[{}]".format(", ".join(hex(np.uint32(x)) for x in arr))) print("[{}]".format(", ".join(hex(np.uint32(x)) for x in arr)))
def run(self): def run(self):
self.kernel() print(self.kernel())
self.cxp.print_xml_url() # self.cxp.print_xml_url()
self.cxp.write_xml_data(self.vals, "genicam_16e13898.zip") # self.cxp.write_xml_data(self.vals, "genicam_16e13898.zip")