Hi all, I'm having some trouble at Sheffield setting up HV power supply interfacing with ITSDAQ. I'll start with some summary details about our system: - Linux CentOS 7 latest - ITSDAQ latest - HV Keithley 2410 - RS232 to USB connector So I've been following the instructions I've found here, which seem to be reasonable?: https://twiki.cern.ch/twiki/bin/view/Atlas/ITSDAQHvLvInterlock I've successfully gotten as far as installing the latest NI Linux Drivers for 2020 without any issue, installing the packages listed on the TWiki. But I must admit I have no idea how to use the actual NI software itself. I then go onto to do python waf configure with the additional --enable-visa $OTHER_FLAGS without any issues. It confirms that the khvdll library is installed. And the following changes to the tty device permissions. Then this is where things start to become more confusing. The instructions to get the HV running in ITSDAQ don't seem to match the current state of ITSDAQ. The files and lines on code it mentions aren't where they say they are anymore. This is an issue I've encountered somewhat recently where starting up ITSDAQ without any power supplies configured won't work. From what I can tell, I was able to stop ITSDAQ from trying to automatically grab power supplies by editing macros/Stavelet.cpp, by changing lv and hvtype from -1 to 0. This allows me to stick to manual control (for LV work anyway). But, as the original intention of this setting goes, it sounds like ITSDAQ is now best configured using this power_supplies.JSON in the config folder? I set hvtype back to -1 then to let it do this automatically, and by default, it is trying to read the device from /dev/ttyS0. But this doesn't seem to be correct, saying it was unable to read the device, and I've tried all of the available devices ttyS0-3 and ttyUSB0-2. Could anyone please give us some tips and advice how I can set this up properly, work with NI, find the right device locations and settings, etc.? I'm currently not able to get back into the lab until this Thursday though. Cheers, Theo. =============================================================================================================== Hi Theo This reminds me i should update that twiki. Yes, the power supplies now work via the json file After the compilation with the —visa flag enabled i run: sudo chmod 666 /dev/tty* To see my device, i load up NIvisaic and switch the ps supply off and on to see what ASRL appears/disappears (note depending on setup you may need to run this in sudo mode) And then in my json file i had the code below (was using the ps with 3 inputs) Also you shouldn’t need any changes to the macros. My guess is enabling the —visa flag reads the power supply json, and with the incorrect addresses set up in it fails to find then and doesn't’ start itsdaq. Hope this helps Andy { "comment": "All fields called comment* are ignored by ITSDAQ.", "lv_supplies": [ { "comment1": "This is a persistent path for a serial device", "comment2": "It should not change between reboots.", "comment3": "It is available for devices connected over USB or with a serial-to-USB adaptor.", "comment4": "For devices connected with plain old serial cables, /dev/ttyS* must be used.", "psName": "ASRL7::INSTR", "modName": "Hybrid", "channel": 2 }, { "comment": "This is a VISA device address.", "psName": "ASRL7::INSTR", "modName": "SVLS", "channel": 3 } ], "hv_supplies": [ { } ] } =============================================================================================================== Hi, Some additional notes on the lvtype/hvtype numbers. If they’re set to -1 (which is the default and the idea is this doesn’t need changing) this loads configuration from the json file if it exists. If it doesn’t exist, there are no power supplies configured. Also, 0 means no configuration and other values have specific hard-coded meanings. In either case the supplies are contacted using the configuration. If they’re not there (including not powered on, or the serial port doesn’t have the right permissions etc), the software will fail to start up. If the there is no configuration (either lvtype is 0, no json file or an empty json file) the software should continue to load, let me know if this doesn’t seem to be happening. Another recentish change is that if the software is not configured with the visa flag, the libraries will still be built, but communication will be using standard Linux serial ports/network sockets. There are at least a couple of potential benefits remaining for the NI software: it takes over some of the serial port settings and it will also allow more complex connections like remote access to a device using a serial port on another host. Cheers, Bruce =============================================================================================================== Hi Andy, Bruce, Many thanks for the help! Andy, that sounds greatly promising, and thanks for the example, I'll be sure to give these a try as soon as I'm in and let you know how that goes. Bruce, fantastic, so if instead I did as Andy gave in the example below, by creating my own JSON file where the entries for the power supply {} is empty, ITSDAQ will also happily ignore trying to find power supplies and startup, instead of me changing types in the source code back to 0. That would especially be good if I was running only LV for hybrids, at least until I can get LV configured (for another day's work!). Cheers, Theo. =============================================================================================================== Hi again all, I've now successfully managed to get the HV running with ITSDAQ, thanks to Andy and Bruce! I explored a little further with making much of the setup more static and automated on login also. For example, if there's multiple USB devices plugged in, then the HV could end up in any number, ttyUSB0-X. Furthermore, NI-VISA could then give it some random number ASRL1-X. To solve these problems, I took some extra setup steps that pay off very well. 1. Keep the ttyUSB static, by adding a udev rule which sniffs out the HV's serial number, and symlinks to the USB number it is on at startup a) Find the HV's unique serial number (eg. FTB3LMLE), but you must first know which ttyUSB it is on (eg. here assumes ttyUSB0) (although, if you check them all, the long serial name can also make it obvious which is the HV, ie, via a USB-RS232): sudo udevadm info --query=property --name=/dev/ttyUSB0 | grep SERIAL Gives output: ID_SERIAL=FTDI_US232R_FTB3LMLE ID_SERIAL_SHORT=FTB3LMLE b) Create a udev file (using nano editor or whichever) which will read on every startup [2]: sudo nano /etc/udev/rules.d/99-usbserial.rules Add line for HV serial to this udev file: ACTION=="add",ENV{ID_BUS}=="usb",ENV{ID_SERIAL_SHORT}=="FTB3LMLE",SYMLINK+="ttyUSB-HV_Keithley2410",MODE="0666" Where you insert the serial number (FTB3LMLE), give the tty your preferred name (ttyUSB-HV_Keithley2410), and ensure it will chmod it to allow normal users to read (666), as the TWiki [1] already mentions. c) Restart to confirm this is working nicely when you check /dev, eg: crw-rw----. 1 root dialout 188, 0 Nov 18 15:26 ttyUSB0 crw-rw----. 1 root dialout 188, 1 Nov 18 15:26 ttyUSB1 crw-rw-rw-. 1 root dialout 188, 2 Nov 18 15:31 ttyUSB2 lrwxrwxrwx. 1 root root 7 Nov 18 15:26 ttyUSB-HV_Keithley2410 -> ttyUSB2 2. Configure NI-VISA to keep a static alias to your new symlink tty which will take on whatever ASRL number, as it can be referred to in ITSDAQ by your own name a) Launch the NI-VISA configuration interface using command: sudo visaconf b) Add a new static serial device, giving it whatever ASRL number comes next in your list (eg. ASRL6::INSTR), with an alias you can decide (ASRL-HV_Keithley2410), and the tty of the symlink added (/dev/ttyUSB-HV_Keithley2410), eg: Resource = ASRL6::INSTR Alias = ASRL-HV_Keithley2410 Binding = /dev/ttyUSB-HV_Keithley2410 c) Be sure to close visaconf while saving your new alias. Restart and repeat opening visaconf to ensure the alias remains. 3. Now you can refer to this device in ITSDAQ with the alias name (ASRL-HV_Keithley2410) in your power_supplies.json, where this is now a saveable static name: { "hv_supplies": [ { "psName": "ASRL-HV_Keithley2410", "modName": "HV Keithley 2410" } ] } Et voila! References: [1] https://twiki.cern.ch/twiki/bin/viewauth/Atlas/ITSDAQHvLvInterlock [2] https://www.raspberrypi.org/forums/viewtopic.php?t=90265 Cheers, Theo. =============================================================================================================== Hi Sven, My own musings from this old email also might be beneficial, on top of that TWiki. To be fair, a grand rewrite might be needed... Cheers, Theo. =============================================================================================================== =============================================================================================================== ===============================================================================================================