From 69d7e93e99eb0cfc3104e06efe7f6c78286d6d1b Mon Sep 17 00:00:00 2001 From: Sebastien Bourdeauducq Date: Thu, 21 Dec 2017 23:09:19 +0800 Subject: [PATCH] drtio: adapt examples to Sayma --- artiq/examples/drtio/device_db.py | 88 ++++++------------- artiq/examples/drtio/repository/ad9154_spi.py | 5 +- .../drtio/repository/blink_forever.py | 4 +- artiq/examples/drtio/repository/pulse_rate.py | 4 +- 4 files changed, 31 insertions(+), 70 deletions(-) diff --git a/artiq/examples/drtio/device_db.py b/artiq/examples/drtio/device_db.py index f6ccac422..09f70c544 100644 --- a/artiq/examples/drtio/device_db.py +++ b/artiq/examples/drtio/device_db.py @@ -1,4 +1,4 @@ -core_addr = "kc705.lab.m-labs.hk" +core_addr = "sayma1.lab.m-labs.hk" device_db = { "core": { @@ -43,42 +43,17 @@ device_db = { "class": "TTLOut", "arguments": {"channel": 3}, }, - "led4": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 4}, - }, - "led5": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 5}, - }, - "led6": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 6}, - }, - "led7": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 7}, - }, - - "smap": { + "ttl_sma_out": { "type": "local", "module": "artiq.coredevice.ttl", "class": "TTLInOut", - "arguments": {"channel": 8} + "arguments": {"channel": 4} }, - "sman": { + "ttl_sma_in": { "type": "local", "module": "artiq.coredevice.ttl", "class": "TTLInOut", - "arguments": {"channel": 9} + "arguments": {"channel": 5} }, "rled0": { @@ -105,42 +80,17 @@ device_db = { "class": "TTLOut", "arguments": {"channel": 0x010003}, }, - "rled4": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 0x010004}, - }, - "rled5": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 0x010005}, - }, - "rled6": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 0x010006}, - }, - "rled7": { - "type": "local", - "module": "artiq.coredevice.ttl", - "class": "TTLOut", - "arguments": {"channel": 0x010007}, - }, - - "rsmap": { + "rttl_sma_out": { "type": "local", "module": "artiq.coredevice.ttl", "class": "TTLInOut", - "arguments": {"channel": 0x010008} + "arguments": {"channel": 0x010004} }, - "rsman": { + "rttl_sma_in": { "type": "local", "module": "artiq.coredevice.ttl", "class": "TTLInOut", - "arguments": {"channel": 0x010009} + "arguments": {"channel": 0x010005} }, "converter_spi": { @@ -148,11 +98,17 @@ device_db = { "module": "artiq.coredevice.spi", "class": "NRTSPIMaster", }, - "ad9154_spi": { + "ad9154_spi0": { "type": "local", "module": "artiq.coredevice.ad9154_spi", "class": "AD9154", - "arguments": {"spi_device": "converter_spi", "chip_select": 1} + "arguments": {"spi_device": "converter_spi", "chip_select": 2} + }, + "ad9154_spi1": { + "type": "local", + "module": "artiq.coredevice.ad9154_spi", + "class": "AD9154", + "arguments": {"spi_device": "converter_spi", "chip_select": 3} }, "rconverter_spi": { "type": "local", @@ -160,10 +116,16 @@ device_db = { "class": "NRTSPIMaster", "arguments": {"busno": 0x010000} }, - "rad9154_spi": { + "rad9154_spi0": { "type": "local", "module": "artiq.coredevice.ad9154_spi", "class": "AD9154", - "arguments": {"spi_device": "rconverter_spi", "chip_select": 1} + "arguments": {"spi_device": "rconverter_spi", "chip_select": 2} + }, + "rad9154_spi1": { + "type": "local", + "module": "artiq.coredevice.ad9154_spi", + "class": "AD9154", + "arguments": {"spi_device": "rconverter_spi", "chip_select": 3} }, } diff --git a/artiq/examples/drtio/repository/ad9154_spi.py b/artiq/examples/drtio/repository/ad9154_spi.py index b4754c019..8e55a5919 100644 --- a/artiq/examples/drtio/repository/ad9154_spi.py +++ b/artiq/examples/drtio/repository/ad9154_spi.py @@ -5,8 +5,8 @@ from artiq.experiment import * class Test(EnvExperiment): def build(self): self.setattr_device("core") - self.setattr_device("ad9154_spi") - self.setattr_device("rad9154_spi") + self.ad9154_spi = self.get_device("ad9154_spi0") + self.rad9154_spi = self.get_device("rad9154_spi0") @kernel def run(self): @@ -21,4 +21,3 @@ class Test(EnvExperiment): def p(self, f, *a): print(f % a) - diff --git a/artiq/examples/drtio/repository/blink_forever.py b/artiq/examples/drtio/repository/blink_forever.py index a7b1294b5..ededc57b9 100644 --- a/artiq/examples/drtio/repository/blink_forever.py +++ b/artiq/examples/drtio/repository/blink_forever.py @@ -4,8 +4,8 @@ from artiq.experiment import * class BlinkForever(EnvExperiment): def build(self): self.setattr_device("core") - self.rleds = [self.get_device("rled" + str(i)) for i in range(8)] - self.leds = [self.get_device("led" + str(i)) for i in range(8)] + self.rleds = [self.get_device("rled" + str(i)) for i in range(4)] + self.leds = [self.get_device("led" + str(i)) for i in range(4)] @kernel def run(self): diff --git a/artiq/examples/drtio/repository/pulse_rate.py b/artiq/examples/drtio/repository/pulse_rate.py index 055d7450b..f430a2a67 100644 --- a/artiq/examples/drtio/repository/pulse_rate.py +++ b/artiq/examples/drtio/repository/pulse_rate.py @@ -4,7 +4,7 @@ from artiq.experiment import * class PulseRate(EnvExperiment): def build(self): self.setattr_device("core") - self.setattr_device("rsmap") + self.setattr_device("rttl_sma_out") @kernel def run(self): @@ -14,7 +14,7 @@ class PulseRate(EnvExperiment): while True: for i in range(10000): try: - self.rsmap.pulse_mu(dt) + self.rttl_sma_out.pulse_mu(dt) delay_mu(dt) except RTIOUnderflow: dt += 1