Hi,
I am running a simple code to just initialise SUServo and setting some some parameters to channel 0 and reading them. This is my code:
from artiq.experiment import *
class UrukulInit(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("suservo0")
self.setattr_device("suservo0_ch0")
self.setattr_device("suservo0_ch1")
self.setattr_device("urukul0_cpld") #needed?
self.setattr_device("urukul0_dds")
@kernel
def run(self):
self.core.break_realtime()
self.core.reset()
print("core prepared")
delay(50*ms)
self.suservo0.init()
print("suservo0 initialised")
self.suservo0.set_config(enable=1) #activates servo
print("suservo0 activated")
self.suservo0_ch0.set_y(0, 0.9) #manually set amp to 1.0
print("ch 0 amp set")
# self.suservo0_ch0.get_y(0)
print(self.suservo0.get_status())
print("finished")
I was using the print statements to see which part of the code is not running properly and I can get everything to run until the print(self.suservo0.get_status())
line which doesn't generate any output and just runs indefinitely. The red LEDs are on so it looks like the DDSs' are not getting initialised. I have tried setting ch0 amplitude to 0.9 and reading back the parameters using get_y methods but that doesn't generate any output either.
Running artiq_sinara_tester
doesn't work either because nothing happens.
I have checked that the DIP switches are correct, the CLK input is okay, and the EEM connections are correct too. I even tried to plug in the Urukul board to a different Kasli and I ran into the same problem as before.
This is the device_db file:
core_addr = "10.236.88.163"
device_db = {
"core": {
"type": "local",
"module": "artiq.coredevice.core",
"class": "Core",
"arguments": {"host": core_addr, "ref_period": 1e-09, "target": "rv32g"},
},
"core_log": {
"type": "controller",
"host": "::1",
"port": 1068,
"command": "aqctl_corelog -p {port} --bind {bind} " + core_addr
},
"core_moninj": {
"type": "controller",
"host": "::1",
"port_proxy": 1383,
"port": 1384,
"command": "aqctl_moninj_proxy --port-proxy {port_proxy} --port-control {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": "I2CSwitch",
"arguments": {"address": 0xe0}
},
"i2c_switch1": {
"type": "local",
"module": "artiq.coredevice.i2c",
"class": "I2CSwitch",
"arguments": {"address": 0xe2}
},
}
# standalone peripherals
device_db["suservo0_ch0"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000000, "servo_device": "suservo0"}
}
device_db["suservo0_ch1"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000001, "servo_device": "suservo0"}
}
device_db["suservo0_ch2"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000002, "servo_device": "suservo0"}
}
device_db["suservo0_ch3"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000003, "servo_device": "suservo0"}
}
device_db["suservo0_ch4"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000004, "servo_device": "suservo0"}
}
device_db["suservo0_ch5"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000005, "servo_device": "suservo0"}
}
device_db["suservo0_ch6"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000006, "servo_device": "suservo0"}
}
device_db["suservo0_ch7"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "Channel",
"arguments": {"channel": 0x000007, "servo_device": "suservo0"}
}
device_db["suservo0"] = {
"type": "local",
"module": "artiq.coredevice.suservo",
"class": "SUServo",
"arguments": {
"channel": 0x000008,
"pgia_device": "spi_sampler0_pgia",
"cpld_devices": ['urukul0_cpld', 'urukul1_cpld'],
"dds_devices": ['urukul0_dds', 'urukul1_dds']
}
}
device_db["spi_sampler0_pgia"] = {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 0x000009}
}
device_db["spi_urukul0"] = {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 0x00000a}
}
device_db["urukul0_cpld"] = {
"type": "local",
"module": "artiq.coredevice.urukul",
"class": "CPLD",
"arguments": {
"spi_device": "spi_urukul0",
"refclk": 100000000.0,
"clk_sel": 1
}
}
device_db["urukul0_dds"] = {
"type": "local",
"module": "artiq.coredevice.ad9910",
"class": "AD9910",
"arguments": {
"pll_n": 40,
"chip_select": 3,
"cpld_device": "urukul0_cpld",
"pll_vco": 5
}
}
device_db["spi_urukul1"] = {
"type": "local",
"module": "artiq.coredevice.spi2",
"class": "SPIMaster",
"arguments": {"channel": 0x00000b}
}
device_db["urukul1_cpld"] = {
"type": "local",
"module": "artiq.coredevice.urukul",
"class": "CPLD",
"arguments": {
"spi_device": "spi_urukul1",
"refclk": 100000000.0,
"clk_sel": 1
}
}
device_db["urukul1_dds"] = {
"type": "local",
"module": "artiq.coredevice.ad9910",
"class": "AD9910",
"arguments": {
"pll_n": 40,
"chip_select": 3,
"cpld_device": "urukul1_cpld",
"pll_vco": 5
}
}
device_db["led0"] = {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 0x00000c}
}
device_db["led1"] = {
"type": "local",
"module": "artiq.coredevice.ttl",
"class": "TTLOut",
"arguments": {"channel": 0x00000d}
}