PACMAN IO Interface¶
-
class
larpix.io.pacman_io.
PACMAN_IO
(config_filepath=None, hwm=20000, relaxed=True, timeout=-1, raw_directory='./', raw_filename=None)[source]¶ The PACMAN_IO object interfaces with a network of PACMAN boards each running a pacman-cmdserver and pacman-dataserver.
This object handles the ZMQ messaging protocol to send and receive formatted messages to/from the PACMAN boards. If you want more info on how messages are formatted, see
larpix.format.pacman_msg_format
.The PACMAN_IO object has five flags for optimizing communications which you may or may not want to enable:
group_packets_by_io_group
interleave_packets_by_io_channel
double_send_packets
enable_raw_file_writing
disable_packet_parsing
To enable each option set the flag to
True
; to disable, set toFalse
.- The
group_packets_by_io_group
option is enabled by default and assembles the packets sent in each call tosend
into as few messages as possible destined for a single io group. E.g. sending three packets (2 forio_group=1
, 1 forio_group=2
) will combine the packets forio_group=1
into a single message to transfer over the network. This reduces overhead associated with network latency and allows large data transfers to happen much faster. - The
interleave_packets_by_io_channel
option is enabled by default and interleaves packets within a given message to each io_channel on a given io_group. E.g. 3 packets destined forio_channel=1
,io_channel=1
, andio_channel=2
will be reordered toio_channel=1
,io_channel=2
, andio_channel=1
. The order of the packets is preserved for each io_channel. This increases the data throughput by about a factor of N, where N is the number of io channels in the message. - The
double_send_packets
option is disabled by default and duplicates each packet sent to the PACMAN by a call tosend()
. This is potentially useful for working around the 512 bug when you need to insure that a packet reaches a chip, but you don’t care about introducing extra packets into the system (i.e. when configuring chips). - The
enable_raw_file_writing
option will directly dump data to a larpix raw hdf5 formatted file. This is used as a more performant means of logging data (seelarpix.format.rawhdf5format
). The data file name can be accessed or changed via theraw_filename
attribute, or can be set when creating thePACMAN_IO
object with theraw_directory
andraw_filename
keyword args. - The
disable_packet_parsing
option will skip converting PACMAN messages intolarpix.packet
types. Thus ifdisable_packet_parsing=True
, every call toempty_queue
will return[], b''
. Typically used in conjunction withenable_raw_file_writing
, this allows the PACMAN_IO class to read data much faster.
-
empty_queue
()[source]¶ Fetch and parse waiting packets on pacman data socket
returns tuple of list of packets, full bytestream of all messages
-
cleanup
()[source]¶ Close the ZMQ objects to prevent a memory leak.
This method is only required if you plan on instantiating a new
PACMAN_IO
object.
-
get_reg
(reg, io_group=None)[source]¶ Read a 32-bit register from the pacman PL
If no
io_group
is specified, returns adict
ofio_group, reg_value
else returns reg_value
-
ping
(io_group=None)[source]¶ Send a ping message
If no
io_group
is specified, returns adict
ofio_group, response
else returns response
-
get_vddd
(io_group=None)[source]¶ Gets PACMAN VDDD voltage
Returns VDDD and IDDD values from the built-in ADC as a tuple of mV and mA respectively
-
set_vddd
(vddd_dac=54691, io_group=None, settling_time=0.1)[source]¶ Sets PACMAN VDDD voltage
If no
vddd_dac
value is specified, sets VDDD to default of ~1.8VReturns the resulting VDDD and IDDD values from the built-in ADC as a tuple of mV and mA respectively
-
get_vdda
(io_group=None)[source]¶ Gets PACMAN VDDA voltage
Returns VDDA and IDDA values from the built-in ADC as a tuple of mV and mA respectively
-
set_vdda
(vdda_dac=54691, io_group=None, settling_time=0.1)[source]¶ Sets PACMAN VDDA voltage
If no
vdda_dac
value is specified, sets VDDA to default of ~1.8VReturns the resulting VDDA and IDDA values from the built-in ADC as a tuple of mV and mA respectively
-
get_vplus
(io_group=None)[source]¶ Gets PACMAN Vplus voltage
Returns Vplus and Iplus values from the built-in ADC as a tuple of mV and mA respectively
-
enable_tile
(tile_indices=None, io_group=None)[source]¶ Enables the specified pixel tile(s) (first tile is index=0, second tile is index=1, …).
Returns the value of the new tile enable mask
-
disable_tile
(tile_indices=None, io_group=None)[source]¶ Disables the specified pixel tile(s) (first tile is index=0, second tile is index=1, …).
Returns the value of the new tile enable mask