Esempio n. 1
0
from larpix import Controller
from larpix.io import PACMAN_IO

ctl = Controller()

# Bring up communications with io group
ctl.io = PACMAN_IO(
    'io/manual_io.json')  # specifies ip addresses + etc for io group
ctl.io.ping()

# Load network configuration
ctl.load('controller/testing_network.json')

# Fiddle with root chip
ctl.init_network(1, 1, 2)
ctl.verify_network('1-1-2')
ctl['1-1-2'].config.load('chip/manual_base.json')
ctl.write_configuration('1-1-2')
ctl.verify_configuration('1-1-2')

# do stuff

# Fiddle with next chip
ctl.init_network(1, 1, 3)
ctl.verify_network('1-1-3')
ctl['1-1-3'].config.load('chip/manual_base.json')
ctl.write_configuration('1-1-3')
ctl.verify_configuration('1-1-3')

# ...
# Bring up communications with io groups
ctl.io = PACMAN_IO('io/testing_io.json') # specifies ip addresses + etc for io groups
if not ctl.io.ping():
    raise RuntimeError

# Load network configuration
ctl.load('controller/testing_network.json')
for io_group in ctl.network:
    for io_channel in ctl.network[io_group]:
        chip_keys = ctl.get_network_keys(io_group, io_channel)
        for chip_key in chip_keys:
            # Initialize network node
            chip_id = chip_key.chip_id
            ctl.init_network(io_group, io_channel, chip_id) # assume upstream nodes of chip key are configured and configure specified chip
            ok, diff = ctl.verify_network(chip_key)
            if not ok:
                raise RuntimeError

            ctl[chip_key].config.load('chip/testing_base.json') # load base configuration (don't specify chip_id, mosi, miso_*)
            ctl.write_configuration(chip_key)
            ok, diff = ctl.verify_configuration(chip_key)
            if not ok:
                raise RuntimeError

            # Chip level tests
            ctl[chip_key].config.global_threshold = 30
            ctl.write_configuration(chip_key, chip_key.config.register_map['global_threshold'])
            # etc

            test_channel = 4
Esempio n. 3
0
from larpix import Controller
from larpix.io import PACMAN_IO

ctl = Controller()

# Bring up communications with io groups
ctl.io = PACMAN_IO('io/production_io.json') # specifies ip addresses + etc for io groups
if not ctl.io.ping():
    raise RuntimeError

# Bring up Hydra networks
ctl.load('controller/production_hydra_networks.json') # specifies hydra network on each io channel / group
for io_group in ctl.network:
    for io_channel in ctl.network[io_group]:
        ctl.init_network(io_group, io_channel) # loads network configurations
valid, configs = ctl.verify_network() # performs read back of each chip's miso/mosi config
if not valid:
    raise RuntimeError

# Enable channels and set thresholds
for chip_key, chip in ctl.chips.items():
    chip.config.load('chip/{}.json'.format(chip_key)) # loads chip specific configurations
for chip_key, chip in ctl.chips.items():
    ctl.write_configuration(chip_key) # writes chip specific configurations
valid, configs = ctl.verify_configuration() # performs read back of each chip's full configuration
if not valid:
    raise RuntimeError

# RUN!