Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Impossibility of using spare Urukul alongside with SUServo #2309

Open
thomasfire opened this issue Jan 19, 2024 · 2 comments
Open

Impossibility of using spare Urukul alongside with SUServo #2309

thomasfire opened this issue Jan 19, 2024 · 2 comments
Assignees

Comments

@thomasfire
Copy link
Contributor

Bug Report

One-Line Summary

Combining Urukul with and without SUServo in the same configuration result in compiler error when trying to use both.

Issue Details

Steps to Reproduce



class DDSTest(EnvExperiment):
    def build(self):
        self.setattr_device("core")
        self.setattr_device("urukul2_ch2")
        self.setattr_device("urukul2_cpld")

        self.setattr_device("suservo0")
        self.setattr_device("urukul0_cpld")
        self.setattr_device("suservo0_ch0")

    @kernel
    def run(self):
        self.core.reset()

        ################### Standalone Urukul ###################
        self.urukul2_cpld.init()
        self.urukul2_ch2.init()
        self.urukul2_ch2.sw.on()
        self.urukul2_ch2.set_att(0.0)
        self.urukul2_ch2.set(frequency=100*MHz, phase=0.0, amplitude=1.0)
        #####################################################

        ################### SUServo Urukul ###################
        self.suservo0.init()
        self.suservo0.set_config(enable=1)

        self.suservo0.set_pgia_mu(0, 1)
        self.urukul0_cpld.set_att(0, 0.0)

        self.suservo0_ch0.set_iir(profile=0, adc=0, kp=0.05, ki=-10000.0, g=0.0)
        self.suservo0_ch0.set_dds(profile=0, frequency=70 * MHz, offset=-0.15)
        self.suservo0_ch0.set(en_out=1, en_iir=1, profile=0)
        #####################################################

Expected Behavior

Every part of the code works fine without errors.

Actual (undesired) Behavior

image

Your System (omit irrelevant parts)

  • ARTIQ version: 7
  • JSON:
{
    "target": "kasli_soc",
    "min_artiq_version": "7.0",
    "variant": "test",
    "hw_rev": "v1.0",
    "base": "standalone",
    "core_addr": "192.168.1.75",
    "peripherals": [
...
        {
            "type": "suservo",
            "sampler_ports": [8, 9],
            "urukul0_ports": [5, 6],
            "urukul1_ports": [7, 10],
            "clk_sel": 2
        },
        {
            "type": "urukul",
            "dds": "ad9910",
            "ports": [3, 4],
            "clk_sel": 2,
            "synchronization": true
        }
...
    ]
}
@dnadlinger
Copy link
Collaborator

To work around this, you can make a subclass of CPLD (empty body) that is used in the device db for the suservo Urukuls. This is what we do in Oxford internally.

Of course, we should implement a workaround like that upstream as well (including integration with the JSON machinery which we are not using yet).

@thomasfire
Copy link
Contributor Author

Just posting more detailed workaround.

  1. Add following to the device_db.py file:
from artiq.coredevice.urukul import CPLD

class CPLD2(CPLD):
    pass
  1. Change affected urukulX_cpld entries in the device_db.py:
device_db["urukulX_cpld"] = {
    "type": "local",
    "module": "device_db", # switch module to look for to this device_db file
    "class": "CPLD2", # use child class
    "arguments": {
        .... # remain as it was
    }
}

For example, if urukul0 is standalone, and urukul1 and urukul2 are in SUServo, then either only urukul0 or both urukul1 and urukul2 need this change from p.2.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants