Hi
I have just started up the kasli device for the first time and am looking to run a simple script given in the manual LED.py. I have copied and pasted the device_db.py file in the same folder and have used anaconda prompt to run the following command artiq_run led.py and am getting the following error. Could you please advise me?

File "C:\Users\admin.conda\envs\artiq\lib\site-packages\artiq\master\worker_db.py", line 81, in get
.format(name)) from e
artiq.master.worker_db.DeviceError: Failed to get description of device 'led'

Try led0 - open the device db file with a text editor for the list of device names.

Hi Seb

I have changed the code to the following:
`
from artiq.experiment import *

class LED(EnvExperiment):
def build(self):
self.setattr_device("core")
self.setattr_device("led0")

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

`

and now I'm getting the error:
File "C:\Users\admin.conda\envs\artiq\lib\site-packages\artiq\master\worker_db.py", line 81, in get
.format(name)) from e
artiq.master.worker_db.DeviceError: Failed to get description of device 'led0'

FYI I'm using an Ethernet to USB adapter and using ipconfig in anaconda prompt, I see the below, I have then entered the IP address 169.254.48.33 in the device_db.py

`Ethernet adapter Ethernet 3:

Connection-specific DNS Suffix . :
Autoconfiguration IPv4 Address. . : 169.254.48.33
Subnet Mask . . . . . . . . . . . : 255.255.0.0
Default Gateway . . . . . . . . . :`

perhaps related to this problem when I try to run rebooting of the system using artiq_flash I get the following problem:

File "C:\Users\SinghRV-admin.conda\envs\artiq\lib\subprocess.py", line 957, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified

For further reference an external reference of 10Mhz has been applied.
I have a further development, I have tried to change the IP address through using artiq_coremgmt and it says that connection is refused. I think perhaps the IP address is the real issue, do you have any recommendations.

There should be more context to the first error you posted (printed before the lines you copied). Most likely, no device named led0 is declared in your device_db. This has nothing to do with network connectivity. Can you post the device_db.py file you're using?

The core_address variable in device_db.py must be set to the IP (or hostname) of the Kasli device, not the host PC. Note that Kasli doesn't support DHCP so the IP is static and your host PC must have an interface connected to the same subnet. If you're sure that you're on the right subnet but don't know what the exact IP address of the Kasli is, you can for example do an ARP scan on that local subnet.

    5 days later

    airwoodix airwoodix Hi, many thanks for the help. Please find the device_db.py file below as this forum is not letting me post txt files.. I am making use of usb to ethernet adapter so I have set the Ip to static with 10.34.16.100 as it as already been flashed to this before delivery , and on the same subnet 255.255.255.0. When I try to run artiq_run led.py I am now getting the following errror.

    ConnectionRefusedError: [WinError 10061] No connection could be made because the target machine actively refused it

    core_addr = "10.34.16.100"

    device_db = {

    Core device

    "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_switch": {
        "type": "local",
        "module": "artiq.coredevice.i2c",
        "class": "PCA9548"
    },
    
    # Generic TTL
    "ttl0": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLOut",
        "arguments": {"channel": 0},
        "comment": "This is a fairly long comment, shown as tooltip."
    },
    "ttl1": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLOut",
        "arguments": {"channel": 1},
        "comment": "Hello World"
    },
    "ttl2": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLOut",
        "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": "TTLInOut",
        "arguments": {"channel": 7}
    },
    "ttl_sma": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLInOut",
        "arguments": {"channel": 18}
    },
    "led0": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLOut",
        "arguments": {"channel": 19}
    },
    "ttl_clock_la32_p": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLClockGen",
        "arguments": {"channel": 21}
    },
    
    # Generic SPI
    "spi0": {
        "type": "local",
        "module": "artiq.coredevice.spi2",
        "class": "SPIMaster",
        "arguments": {"channel": 23}
    },
    "spi_mmc": {
        "type": "local",
        "module": "artiq.coredevice.spi2",
        "class": "SPIMaster",
        "arguments": {"channel": 26}
    },
    
    # DAC
    "spi_ams101": {
        "type": "local",
        "module": "artiq.coredevice.spi2",
        "class": "SPIMaster",
        "arguments": {"channel": 22}
    },
    "ttl_ams101_ldac": {
        "type": "local",
        "module": "artiq.coredevice.ttl",
        "class": "TTLOut",
        "arguments": {"channel": 20}
    },
    
    # AD9914 DDS
    "ad9914dds0": {
        "type": "local",
        "module": "artiq.coredevice.ad9914",
        "class": "AD9914",
        "arguments": {"sysclk": 3e9, "bus_channel": 27, "channel": 0},
        "comment": "Comments work in DDS panel as well"
    },
    "ad9914dds1": {
        "type": "local",
        "module": "artiq.coredevice.ad9914",
        "class": "AD9914",
        "arguments": {"sysclk": 3e9, "bus_channel": 27, "channel": 1}
    },
    "ad9914dds2": {
        "type": "local",
        "module": "artiq.coredevice.ad9914",
        "class": "AD9914",
        "arguments": {"sysclk": 3e9, "bus_channel": 27, "channel": 2}
    },
    
    # Aliases
    "ttl_out": "ttl0",
    "ttl_out_serdes": "ttl0",
    
    "loop_out": "ttl0",
    "loop_in": "ttl3",
    "loop_clock_out": "ttl_clock_la32_p",
    "loop_clock_in": "ttl7",
    
    "pmt": "ttl3",
    "bd_dds": "ad9914dds0",
    "bd_sw": "ttl0",
    "bdd_dds": "ad9914dds1",
    "bdd_sw": "ttl1"

    }

    That's the wrong device database.
    Where did you get your Kasli system and what research group are you from?

    a month later

    Hi Seb
    I'm sorry for the very late reply, there have been issues with gaining access to my labs due to the COVID situation. I think I have understood the problem, that I was using the wrong device_db.py file. The issue was I didn't have all the documentation at hand that was sent with the delivered kasli system. I am working for ubirmingham2 and Dr Robert Jordans has confirmed that the system has been flashed with the firmware and gateware. Could you please confirm that the next steps I have outlined below are correct. I have download the ubimringham2 device database from https://nixbld.m-labs.hk/jobset/artiq/full-beta/latest-eval and as the binaries have already been flashed I guess I don't need to use the JSON configuration files. The kasli board requires a clock reference of 10 Mhz within the range of -3 to 6 dbm ( I am providing 500mVpp = -2 dbm) which I will provide from a signal generator. Robert said signals outside the dbm range may destroy the system. I will then change the computer's interface address to 10.34.16.1 netmask 255.255.255.0. In the device databse there is no mention of led0 or led1, does that mean that the core device in our system does not have a LED, or am I to add this functionality to the device database. Could I kindly ask for your advise as I do not want to damage the system.

    Adding wrong devices to the device database should normally not cause damage (but sending excessive RF power will).
    Looks like you have a Kasli 2.0 with no RTIO LEDs. Use the TTL channels instead.

      sb10q I have now solved this issue by using a simple RJ45 ethernet cable instead of an usb to gigabit ethernet cable I was using before. Although the Kasli Ip address is 10.34.16.100 I have had to set the computer IP address to 10.34.16.101 for it to connect. I tried running a python script in the same folder as device_db.py to turn ttl6 on and off which can be seen below however ttl6 seems to be on at all times. It is on when I switch on the Kasli and the script is not switching it off. Furthermore I got the following warning.

      WARNING:artiq.coredevice.comm_kernel:Mismatch between gateware (6.7477.d672d2fc.beta) and software (6.7538.261870bd.beta) versions

      I have seen from your other posts related to this issue that small version differences should not be protocol breaking and therefore it should be fine ignore this warning. As the system has come pre flashed I didnt want to flash it again and lose any functionalities. This error came about because I installed the latest version of conda in a new enviroment, but this was because my previous software version was still different to the gateware. Could you please advise me, as I should be able to move ahead once I know I can properly communicate with the Kasli

      This is the file that I want to run

        `
        from artiq.experiment import *                  #imports everything from artiq experiment library
      
         #minimum working code for using TTL6
         #turns output on, off, and then pulses it
      
        #to view the trace from this on a scope, use a single trigger with at least 16ms measured on scope
      
      class TTL_Output_On_Off_Pulse(EnvExperiment):
      """TTL Output On, Off, Pulse"""
      def build(self): #This code rus on host device     
      
          self.setattr_device("core")             #sets core device drivers as attributes
          self.setattr_device("ttl6")             #sets ttl6 device drivers as attributes
          
      @kernel #this code runs on the FPGA
      def run(self):
      
          self.core.reset()                       #resets core device
          self.ttl6.output()                      #sets TTL6 as an output
          delay(1*us)                             #moves timestamp forward to prevent collision between ttl6.output and ttl6.on although appears not to be neccessary in this case.
          #self.ttl6.on()                          #sets TTL6 output to high
          #delay(500*ms)                          #5000ms delay
          
          self.ttl6.on()                         #sets TTL6 output to low
          #delay(500*ms)                          #5000ms delay
          
          #self.ttl6.pulse(5*ms)                   #sets TTL6 output high for 5ms then sets it to low
          #delay(1*ms)                             #1ms delay

        Hanros94 Although the Kasli Ip address is 10.34.16.100 I have had to set the computer IP address to 10.34.16.101 for it to connect.

        This is perfectly normal.

        Hanros94 As the system has come pre flashed I didnt want to flash it again and lose any functionalities.

        Reflashing won't make you lose functionalities.

        Hanros94 Could you please advise me, as I should be able to move ahead once I know I can properly communicate with the Kasli

        Sure.

          sb10q Thanks for the response, I assumed you wanted me to go ahead with reflashing the system. I downloaded the conda artiq-board package in to the same working directory and then ran:
          conda install artiq-board-XX
          which worked, and subsequently installed Zadig and saw that the QuadRS232-HS(interface 0) has the right WinUSB (v6.17...) version whereas I could not install the driver for the other interfaces(1,2,3) as I got the following error ("Driver installation cancelled by user") even though I didn't do so. I think this is an issue with the Windows environment, which will not allow .cat files to be signed. Given that interface 0 out of interfaces 0-3 has the right WinUSB driver, could you please tell me how I can identify the usb port which corresponds to interface 0?

          I then tried to run artiq_flash -V urbirmingham2 but got the following error.
          TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType

          Could you please advise me further?

            Hanros94 TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType

            Please post the complete error message.

              sb10q
              Please see the command and the error message below:

              (artiq-6) C:\Users\SinghRV-admin\Documents\artiq>artiq_flash -V ubirmingham2
              Design: top;UserID=FFFFFFFF;COMPRESS=TRUE;Version=2020.1
              Part name: 7a100tfgg484
              Date: 2021/01/20
              Time: 18:31:32
              Bitstream payload length: 0x29db18
              Traceback (most recent call last):
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\Scripts\artiq_flash-script.py", line 9, in <module>
              sys.exit(main())
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\site-packages\artiq\frontend\artiq_flash.py", line 431, in main
              programmer.write_binary(*config["gateware"], gateware_bin)
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\site-packages\artiq\frontend\artiq_flash.py", line 168, in write_binary
              self.load_proxy()
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\site-packages\artiq\frontend\artiq_flash.py", line 229, in load_proxy
              self.load(find_proxy_bitfile(self._proxy), pld=0)
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\site-packages\artiq\frontend\artiq_flash.py", line 102, in find_proxy_bitfile
              for p in [proxy_path(), os.path.expanduser("~/.migen"),
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\site-packages\artiq\frontend\artiq_flash.py", line 96, in proxy_path
              os.path.dirname(os.path.realpath(shutil.which("openocd"))),
              File "C:\Users\SinghRV-admin\.conda\envs\artiq-6\lib\ntpath.py", line 526, in abspath
              return normpath(_getfullpathname(path))
              TypeError: _getfullpathname: path should be string, bytes or os.PathLike, not NoneType

              rjo I am using Windows 10 so I am using ZADIG as instructed in the manual. As seen in the image attached for QuadRS232-HS (interface 0) has the right windows driver, but as I mentioned above, I can't change the other interfaces (1-3) for this QuadRS232-HS as seen in the second image.

              Do you have advise for this issue with ZADIG? online searches for this problem state it is an issue with the windows environment?

              I have now tried the same set of commands on a different windows machine and have been able to change the USB drivers using ZADIG. When I try to run the command artiq_flash -V ubirmingham2, I get the following error, could you please advise me.

              In this situation even after running condo install artiq-board-XX the software is not being updated from 5.7xx to 6.75xx in this condo env as it happened on the other windows machine. I have tried creating a new condo env using:
              conda create -n artiq-6.X artiq
              conda activate artiq-6.X
              conda install artiq-board-ubirmingham2-XX

              Your screenshot indicates you are in a artiq-6 environment while you say you installed the board package in artiq-6.X. That doesn't match.

                rjo I found out what the problem was, it seems that openocd was not installed when installing artiq using conda. I checked this by running 'conda install openocd' which stated that openocd could not be found in the channels ( I was using artiq-beta). I then ran 'conda install -c m-labs openocd' found on the anaconda.org website and I was then able to run artiq_flash correctly. I'm not sure why this manual installation of openocd was necessary given that I had followed the provided installation instructions but thanks for the help.

                • rjo likes this.