hartytp Thank you very much! This is immensely clarifying. We're still having some issues though. We have some code constructed based on your example, and it runs without errors, but doesn't seem to generate an output. We're using the SUServo bitstream available in the M-Labs Anaconda repository and the device database that comes with the ARTIQ package.
Below is our code:
from artiq.experiment import *
import numpy as np
class SUServoTest(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("urukul0_cpld")
self.setattr_device("suservo0")
self.setattr_device("suservo0_ch0")
@kernel
def run(self):
# Prepare core
self.core.reset()
self.core.break_realtime()
#Initialize and activate SUServo
self.suservo0.init()
self.suservo0.set_config(enable=1)
# Configure channel 0 to output 100 MHz
self.suservo0.cpld0.set_att(0, 0.0)
self.suservo0_ch0.set_dds(profile=0, frequency=100000000, offset=0.0)
self.suservo0_ch0.set_y(0, 1.0)
self.suservo0_ch0.set(en_out=1, en_iir=0, profile=0)
and our device_db.py file:
core_addr = "169.254.234.70"
device_db = {
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"host": core_addr, "ref_period": 1e-9}
},
"core_log": {
"type": "controller",
"host": "::1",
"port": 1068,
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr
},
"core_cache": {
"type": "local",
"module": "artiq.coredevice.cache",
"class": "CoreCache"
},
"core_dma": {
"type": "local",
"module": "artiq.coredevice.dma",
"class": "CoreDMA"
},
"i2c_switch0": {
"type": "local",
"module": "artiq.coredevice.i2c",
"class": "PCA9548",
"arguments": {"address": 0xe0}
},
"i2c_switch1": {
"type": "local",
"module": "artiq.coredevice.i2c",
"class": "PCA9548",
"arguments": {"address": 0xe2}
},
"ttl0": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLInOut",
"arguments": {"channel": 0},
},
"ttl1": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLInOut",
"arguments": {"channel": 1},
},
"ttl2": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLInOut",
"arguments": {"channel": 2},
},
"ttl3": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLInOut",
"arguments": {"channel": 3},
},
"ttl4": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 4},
},
"ttl5": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 5},
},
"ttl6": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 6},
},
"ttl7": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 7},
},
"ttl8": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 8},
},
"ttl9": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 9},
},
"ttl10": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 10},
},
"ttl11": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 11},
},
"ttl12": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 12},
},
"ttl13": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 13},
},
"ttl14": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 14},
},
"ttl15": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 15},
},
"suservo0_ch0": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 16, "servo_device": "suservo0"}
},
"suservo0_ch1": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 17, "servo_device": "suservo0"}
},
"suservo0_ch2": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 18, "servo_device": "suservo0"}
},
"suservo0_ch3": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 19, "servo_device": "suservo0"}
},
"suservo0_ch4": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 20, "servo_device": "suservo0"}
},
"suservo0_ch5": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 21, "servo_device": "suservo0"}
},
"suservo0_ch6": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 22, "servo_device": "suservo0"}
},
"suservo0_ch7": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 23, "servo_device": "suservo0"}
},
"suservo0": {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "SUServo",
"arguments": {
"channel": 24,
"pgia_device": "spi_sampler0_pgia",
"cpld0_device": "urukul0_cpld",
"cpld1_device": "urukul1_cpld",
"dds0_device": "urukul0_dds",
"dds1_device": "urukul1_dds"
}
},
"spi_sampler0_pgia": {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 25}
},
"spi_urukul0": {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 26}
},
"urukul0_cpld": {
"type": "local",
"module": "artiq.coredevice.urukul",
"class": "CPLD",
"arguments": {
"spi_device": "spi_urukul0",
"refclk": 125e6,
"clk_sel": 2
}
},
"urukul0_dds": {
"type": "local",
"module": "artiq.coredevice.ad9910",
"class": "AD9910",
"arguments": {
"pll_n": 32,
"chip_select": 3,
"cpld_device": "urukul0_cpld",
}
},
"spi_sampler0_adc": {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 27}
},
"spi_sampler0_cnv": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 28},
},
"sampler0": {
"type": "local",
"module": "artiq.coredevice.sampler",
"class": "Sampler",
"arguments": {
"spi_adc_device": "spi_sampler0_adc",
"spi_pgia_device": "spi_sampler0_pgia",
"cnv_device": "spi_sampler0_cnv"
}
},
"spi_urukul1": {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 27}
},
"urukul1_cpld": {
"type": "local",
"module": "artiq.coredevice.urukul",
"class": "CPLD",
"arguments": {
"spi_device": "spi_urukul1",
"refclk": 100e6,
"clk_sel": 0
}
},
"urukul1_dds": {
"type": "local",
"module": "artiq.coredevice.ad9910",
"class": "AD9910",
"arguments": {
"pll_n": 40,
"chip_select": 3,
"cpld_device": "urukul1_cpld",
}
},
"led0": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 28}
},
"led1": {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 29}
}
}
We're quite certain that our DIP switches are set correctly and that our boards are connected via the right EEMs. At a glance, is there anything that might be wrong with the code, or is it possibly a hardware/gateware issue?
Thank you again.