drtio: adapt examples to Sayma

This commit is contained in:
Sebastien Bourdeauducq 2017-12-21 23:09:19 +08:00
parent a6ffe9f38d
commit 69d7e93e99
4 changed files with 31 additions and 70 deletions

View File

@ -1,4 +1,4 @@
core_addr = "kc705.lab.m-labs.hk" core_addr = "sayma1.lab.m-labs.hk"
device_db = { device_db = {
"core": { "core": {
@ -43,42 +43,17 @@ device_db = {
"class": "TTLOut", "class": "TTLOut",
"arguments": {"channel": 3}, "arguments": {"channel": 3},
}, },
"led4": { "ttl_sma_out": {
"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": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ttl", "module": "artiq.coredevice.ttl",
"class": "TTLInOut", "class": "TTLInOut",
"arguments": {"channel": 8} "arguments": {"channel": 4}
}, },
"sman": { "ttl_sma_in": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ttl", "module": "artiq.coredevice.ttl",
"class": "TTLInOut", "class": "TTLInOut",
"arguments": {"channel": 9} "arguments": {"channel": 5}
}, },
"rled0": { "rled0": {
@ -105,42 +80,17 @@ device_db = {
"class": "TTLOut", "class": "TTLOut",
"arguments": {"channel": 0x010003}, "arguments": {"channel": 0x010003},
}, },
"rled4": { "rttl_sma_out": {
"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": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ttl", "module": "artiq.coredevice.ttl",
"class": "TTLInOut", "class": "TTLInOut",
"arguments": {"channel": 0x010008} "arguments": {"channel": 0x010004}
}, },
"rsman": { "rttl_sma_in": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ttl", "module": "artiq.coredevice.ttl",
"class": "TTLInOut", "class": "TTLInOut",
"arguments": {"channel": 0x010009} "arguments": {"channel": 0x010005}
}, },
"converter_spi": { "converter_spi": {
@ -148,11 +98,17 @@ device_db = {
"module": "artiq.coredevice.spi", "module": "artiq.coredevice.spi",
"class": "NRTSPIMaster", "class": "NRTSPIMaster",
}, },
"ad9154_spi": { "ad9154_spi0": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ad9154_spi", "module": "artiq.coredevice.ad9154_spi",
"class": "AD9154", "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": { "rconverter_spi": {
"type": "local", "type": "local",
@ -160,10 +116,16 @@ device_db = {
"class": "NRTSPIMaster", "class": "NRTSPIMaster",
"arguments": {"busno": 0x010000} "arguments": {"busno": 0x010000}
}, },
"rad9154_spi": { "rad9154_spi0": {
"type": "local", "type": "local",
"module": "artiq.coredevice.ad9154_spi", "module": "artiq.coredevice.ad9154_spi",
"class": "AD9154", "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}
}, },
} }

View File

@ -5,8 +5,8 @@ from artiq.experiment import *
class Test(EnvExperiment): class Test(EnvExperiment):
def build(self): def build(self):
self.setattr_device("core") self.setattr_device("core")
self.setattr_device("ad9154_spi") self.ad9154_spi = self.get_device("ad9154_spi0")
self.setattr_device("rad9154_spi") self.rad9154_spi = self.get_device("rad9154_spi0")
@kernel @kernel
def run(self): def run(self):
@ -21,4 +21,3 @@ class Test(EnvExperiment):
def p(self, f, *a): def p(self, f, *a):
print(f % a) print(f % a)

View File

@ -4,8 +4,8 @@ from artiq.experiment import *
class BlinkForever(EnvExperiment): class BlinkForever(EnvExperiment):
def build(self): def build(self):
self.setattr_device("core") self.setattr_device("core")
self.rleds = [self.get_device("rled" + 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(8)] self.leds = [self.get_device("led" + str(i)) for i in range(4)]
@kernel @kernel
def run(self): def run(self):

View File

@ -4,7 +4,7 @@ from artiq.experiment import *
class PulseRate(EnvExperiment): class PulseRate(EnvExperiment):
def build(self): def build(self):
self.setattr_device("core") self.setattr_device("core")
self.setattr_device("rsmap") self.setattr_device("rttl_sma_out")
@kernel @kernel
def run(self): def run(self):
@ -14,7 +14,7 @@ class PulseRate(EnvExperiment):
while True: while True:
for i in range(10000): for i in range(10000):
try: try:
self.rsmap.pulse_mu(dt) self.rttl_sma_out.pulse_mu(dt)
delay_mu(dt) delay_mu(dt)
except RTIOUnderflow: except RTIOUnderflow:
dt += 1 dt += 1