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_groupinterleave_packets_by_io_channeldouble_send_packetsenable_raw_file_writingdisable_packet_parsing
To enable each option set the flag to
True; to disable, set toFalse.- The
group_packets_by_io_groupoption is enabled by default and assembles the packets sent in each call tosendinto 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=1into 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_channeloption 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=2will 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_packetsoption 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_writingoption 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_filenameattribute, or can be set when creating thePACMAN_IOobject with theraw_directoryandraw_filenamekeyword args. - The
disable_packet_parsingoption will skip converting PACMAN messages intolarpix.packettypes. Thus ifdisable_packet_parsing=True, every call toempty_queuewill 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_IOobject.
-
get_reg(reg, io_group=None)[source]¶ Read a 32-bit register from the pacman PL
If no
io_groupis specified, returns adictofio_group, reg_valueelse returns reg_value
-
ping(io_group=None)[source]¶ Send a ping message
If no
io_groupis specified, returns adictofio_group, responseelse 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_dacvalue 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_dacvalue 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