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

Setting a DDS in ARTIQ version 3.6 fails with an IndexError #1012

Closed
philipkent opened this issue May 23, 2018 · 8 comments
Closed

Setting a DDS in ARTIQ version 3.6 fails with an IndexError #1012

philipkent opened this issue May 23, 2018 · 8 comments

Comments

@philipkent
Copy link

On Windows 7, using ARTIQ version 3.6, trying to set a dds frequency using:

from artiq.experiment import *
class TestDDS(EnvExperiment):

    def build(self):
        self.setattr_device('core')
        self.setattr_device('dds0')

    @kernel
    def run(self):
        self.core.reset()
        delay(5*ms)
        self.dds0.init()
        delay(5*ms)
        self.dds0.set(1*MHz)

Fails with the following error:

root:Terminating with exception (IndexError: index 72 out of bounds 0:6)
Core Device Traceback (most recent call last):
File "C:\users\pdk1\work\artiq\repository\experiments\testing/test_dds.py", line 15, in artiq_worker_C:\users\pdk1\work\artiq\repository\experiments\testing\test_dds.TestDDS.run(..., ...)
(RA=+0xe90)
self.dds0.set(1*MHz)
File "\coredevice/dds.py", line 249, in ... artiq.coredevice.dds.DDSChannel.set<artiq.coredevice.dds.DDSChannelAD9914>(...)
(inlined)
self.set_mu(self.core_dds.frequency_to_ftw(frequency),
File "\coredevice/dds.py", line 243, in ... artiq.coredevice.dds.DDSChannel.set_mu<artiq.coredevice.dds.DDSChannelAD9914>(...)
(inlined)
self.core_dds.set(self.bus_channel, self.channel, frequency, phase, phase_mode, amplitude)
File "\coredevice/dds.py", line 124, in ... artiq.coredevice.dds.DDSGroup.set<artiq.coredevice.dds.DDSGroupAD9914>(...)
(inlined)
self.program(ref_time,
File "\coredevice/dds.py", line 365, in ... artiq.coredevice.dds.DDSGroupAD9914.program<artiq.coredevice.dds.DDSGroupAD9914>(...)
(inlined)
pow += self.continuous_phase_comp[phase_comp_index]
File "\coredevice\dds.py", line 365, column 46, in ... artiq.coredevice.dds.DDSGroupAD9914.program<artiq.coredevice.dds.DDSGroupAD9914>(...)
pow += self.continuous_phase_comp[phase_comp_index]
^
IndexError(0): index 72 out of bounds 0:6
Traceback (most recent call last):
File "C:\Users\pdk1\AppData\Local\Continuum\anaconda3\envs\artiq-3.6\lib\site-packages\artiq\master\worker_impl.py", line 273, in main
exp_inst.run()
File "C:\Users\pdk1\AppData\Local\Continuum\anaconda3\envs\artiq-3.6\lib\site-packages\artiq\language\core.py", line 53, in run_on_core
return getattr(self, arg).run(run_on_core, ((self,) + k_args), k_kwargs)
File "C:\Users\pdk1\AppData\Local\Continuum\anaconda3\envs\artiq-3.6\lib\site-packages\artiq\coredevice\core.py", line 133, in run
self.comm.serve(embedding_map, symbolizer, demangler)
File "C:\Users\pdk1\AppData\Local\Continuum\anaconda3\envs\artiq-3.6\lib\site-packages\artiq\coredevice\comm_kernel.py", line 603, in serve
self._serve_exception(embedding_map, symbolizer, demangler)
File "C:\Users\pdk1\AppData\Local\Continuum\anaconda3\envs\artiq-3.6\lib\site-packages\artiq\coredevice\comm_kernel.py", line 595, in _serve_exception
raise python_exn
IndexError: index 72 out of bounds 0:6

@sbourdeauducq
Copy link
Member

Parameters in your device_db incorrectly set?

@philipkent
Copy link
Author

The core_dds::dds_channel_count argument was set to 3 in device_db (copy/pasted from the examples). I've increased it to 12, since we are using 12 dds cards but it still throws an IndexError. Is there documentation available for the new DDSGroupAD9914 class that gives a description of it's arguments such as first_dds_bus_channel?

@jordens
Copy link
Member

jordens commented May 24, 2018

c.f. #823
ok to close?

@KaifengC
Copy link
Contributor

@philipkent so what's the meaning for core_dds::dds_channel_count and first_dds_bus_channel ? Since I've got the same error, could I ask how did you solve your problem?

@sbourdeauducq
Copy link
Member

@KaifengC I thought you were using ARTIQ 4? it doesn't have this parameter anymore.

@KaifengC
Copy link
Contributor

No, In fact we have a system running aritq 3.6 these days. It worked after I changed the dds_channel_count. But I'm still curious about the meaning of these two parameters.

BTW, I also see a dds_bus_count and don't know what did this mean?

@sbourdeauducq
Copy link
Member

It's for systems that have a lot of DDS channels, and are using more than one bus for the AD9914s.

@philipkent
Copy link
Author

@KaifengC I am not 100% sure on the meaning of each argument, but looking at artiq/coredevice/dds.py it looks like setting a dds is ultimately performed by the core_dds device's program method (line 351). There is an array named self.continuous_phase_comp in that method that needs to be accessed by a relative bus index instead of it's absolute channel number.

dds_bus_index = bus_channel - self.first_dds_bus_channel
phase_comp_index = dds_bus_index * self.dds_channel_count + channel

So I think first_dds_bus_channel is the absolute channel number of the first dds bus, bus_channel is the absolute bus channel number used by the dds card, dds_channel_count is the number of dds channels per bus, and channel is the relative channel number on any given bus with numbers starting at zero. That seems to imply that dds bus channels must be sequential as well.

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

4 participants