Difference between revisions of "Experimental PC"

From Applied Optics Wiki
Jump to: navigation, search
(Nanoscope lab / Andor iXon camera)
 
(39 intermediate revisions by 7 users not shown)
Line 1: Line 1:
Back to [[Linux How-tos]]
+
Extra stuff for all the experimental hardware that might need setting up. The information contained here will also be useful if you want to install any of these bits of hardware on any other Linux PC.
 +
 
 +
==2023 Update==
 +
[[Experimental PC Kubuntu 22.04]] supersedes most of this page.
  
<big>Extra stuff for all the hardware in '''blanket''' & '''pouffe''', the ARRO-SAM PC & OSAM </big>
+
==2022 Update==
 +
Much of the information in the [[Experimental PC old]] page is now out-dated and/or refers to hardware that is no longer in use. This new page attempts to build a modern version, please contribute by adding instructions for software they use regularly.
  
In December 2007 I upgraded blanket, the PC used to control the ARRO-SAM experiment, to the current version of openSuSE (10.3 when this page was first written, now 11.0). This PC had been running Redhat 9 for a number of years and due to heavy use as an experimental PC and reasonable stability, it had not been updated. Redhat 9 runs a 2.4 kernel, so there were some extra things to do with the drivers and compiling ''c-scan''.
+
Back to [[Linux How-tos]]
  
Addition (April 2008): Rob upgraded pouffe in the O-SAM lab, pretty much the same as blanket accept for ISA PI stages
 
  
The information contained here will also be useful if you want to install any of these bits of hardware on any other Linux PC.
+
__TOC__
  
 
== Pre-install ==
 
== Pre-install ==
Line 21: Line 24:
 
#* Most of these will be in /etc/
 
#* Most of these will be in /etc/
  
Example: updating blanket from RdeHat 9 to SuSE 10.3:
 
 
I tarballed /etc/ and /usr/local/bin/ and stuck the files in my home directory where they would be recoverable after new install. The aim was to retain the old root partition of the old (Redhat 9) system, to enable it to be mounted by the new (SuSE 10.3) system under /old_redhat_9_root/ but since installation involved resizing the old partition (always potentially problematic) it's a good idea to backup anything you think you might need. /etc/ for configuration files (including our own, for the stages, the SLM etc) and /usr/local/bin/ just as a reminder of the extra stuff (mainly our own) that we installed.
 
 
In the event, the old root partition wasn't wiped, and I was able to grab the files from there (/old_redhat_9_root). After the install, I copied the files I'd ''actually'' needed to /home/share/backup_system_files/blanket/
 
  
 
=== Scenario 2: Adding new hardware to an already up-to-date PC ===
 
=== Scenario 2: Adding new hardware to an already up-to-date PC ===
Line 33: Line 31:
  
  
== Install ==
+
== ThorLabs APT control components ==
 
 
I had to resize the old partition as it was taking up all the disk (except for the swap partition). I resized the old partition to 20GB (it had 15GB of stuff in it) and made a new 30GB root partition. I also extended the swap to 4GB.
 
 
 
Other than that I just did a standard install, then performed the standard local configuration stuff as with any other PC.
 
  
The resizing of the old partition was successful and I was able to copy the files I needed directly from /old_redhat_9_root/etc/
+
See [[ThorLabs apt stages]].
  
 
== Scope (and AFG) utilities ==
 
== Scope (and AFG) utilities ==
  
These are the standard command line utilities to grab traces, save setups etc
+
These are the standard command-line utilities to grab traces, save setups etc
  
 
=== vxi11 ===
 
=== vxi11 ===
Line 52: Line 46:
 
*Installs:
 
*Installs:
 
**vxi11_cmd
 
**vxi11_cmd
 +
**vxi11 user library
  
 
=== Agilent scope ===
 
=== Agilent scope ===
Line 71: Line 66:
 
**tek_save_setup
 
**tek_save_setup
 
**tek_afg_upload_arb
 
**tek_afg_upload_arb
 +
**tek user library
  
 
=== LeCroy scope ===
 
=== LeCroy scope ===
*cd /home/scan/source/hardware/ethernet_scope/
+
 
*make clean; make; sudo make install
+
*cd /home/scan/source/hardware/lecroy/
*Installs:
 
**eth_cmd
 
**/etc/lecroy_tcp/ (empty directory)
 
*cd /home/scan/source/egetwf/
 
 
*make clean; make; sudo make install
 
*make clean; make; sudo make install
 
*Installs:
 
*Installs:
**egetwf
+
*lgetwf
  
== PI PCI stage driver ==
+
== PI pci stages* ==
*cd /home/scan/source/dev/pi_pci/driver_2.6/library/
+
Experimental PC Old instructions on this cover up to driver_2.6. Below are updated instructions for driver_3.xx_v1.0, but are sios specific! sios install may need to be ported from L4, or sios may need to painfully upgrade to latest os/kernel.
*make clean; make; sudo make install
 
*Installs:
 
**pi_save_pos
 
**pi_recall_pos
 
**(pi_user library)
 
**/etc/pi_stage/stage_database/
 
  
 +
*cd /home/scan/source/dev/pi_pci/driver_3.xx_v1.0/library/
 +
*make clean; make; sudo make install;
 +
*// for new PC may need to double check that g++ is installed, and possibly libncurses5-dev
 
*cd /home/scan/source/hardware/pi_pci_stage/
 
*cd /home/scan/source/hardware/pi_pci_stage/
*make clean; make; sudo make install
+
*// for kernel versions 5.4 and older certain headers don't have consistent filepaths wrt /usr/src/*headers* and /usr/include/linux/. so below is mainly specific to outdated kernels in sios at the moment.
*Installs:
+
*// cp /usr/local/include/pi_stage.h from ejectorseat to your local experimental pc (last stable version for sios on ejectorseat)
**set_stages_safe
+
*make clean; make; sudo make install;
**manual_pci_stage (manual_stage)
+
*cd /home/scan/source/dev/pi_pci/driver_3.xx_v1.0/driver/
**/etc/pi_stage/position_um '''if''' it doesn't already exist (default stage position file, all axes at 0)
+
*// permissions for this directory are wild, root and scan users don't seem to be able to write/access certain files during "make" so temporary work around right now is to cp -r the entire /driver directory onto the local disk (e.g. in /tmp/something) where the local user for sure has full permissions on every file and sub-directory
**/etc/pi_stage/installed_stages - this is the default list of installed stages, '''which you may need to edit if yours are different:'''
+
*make  
axis 0  m-531.dd
+
*// if there are errors about /etc/pi_stage/position not existing cp or mv position_um to it. if there are errors complaining about things at the kernel level, then you might need to install source files: sudo apt-get install linux-source
axis 1  m-531.dd
+
*sudo ./install_pi_stage
axis 2  m-605.2dd
 
axis 3  m-605.2dd
 
 
 
*cd /home/scan/source/dev/pi_pci/driver_2.6/driver/
 
*make
 
*sudo ./install_pi_stage_recall
 
*Installs:
 
**PI PCI stage device driver
 
 
 
== PI ISA stage ==
 
*cd /home/scan/source/hardware/stages
 
*make -f Makefile.osam clean; make -f Makefile.osam;
 
*sudo make -f Makefile.osam install
 
*Installs:
 
**manual_stage
 
**/etc/stages/PI_stage_origin '''if''' it doesn't already exist (default stage position file, all axes at 0)
 
 
 
== Inchworm and IDAC stages ==
 
*cd /home/scan/source/hardware/IW_driver
 
*sudo make install
 
*Installs:
 
**/etc/stages/IW_stage_origin '''if''' it doesn't already exist (default stage position file, both axes at 0)
 
*cd /home/scan/source/hardware/IDAC_driver
 
*sudo make install
 
*Installs:
 
**/etc/stages/IDAC_stage_origin '''if''' it doesn't already exist (default stage position file, both axes at 0)
 
  
== BNS SLM ==
 
*cp -av /old_redhat_9_root/etc/slm /etc/
 
  
*cd /home/scan/source/dev/BNS/driver_2.6/
+
== PI USB stage driver ==
*make
+
I think the format of udev rules has changed since the scripts were first written and the SYSFS should be replaced with ATTRS. This should fix the problem of the device not being recognised automatically when plugged in.  
To install use
 
*sudo ./install_slm_mtrr
 
OR
 
*sudo ./install_for_boot
 
The latter install the kernel driver in the system and will load it automatically at boot time for you. If you
 
want it load right now without rebooting use the previous version as well - matt
 
  
*Installs:
+
*cd /home/scan/source/hardware/pi_usb_stage/utils/cmd_line_utils/
**BNS SLM device driver
+
*make clean; make all; sudo make install;
 +
*sudo ./actually_install_pi_usb
 +
*check if /etc/udev/rules.d/98-pi-usb.rules exists and change SYSFS to ATTRS (the remove rules should still be okay).
 +
*cd /home/scan/source/hardware/pi_usb_stage/utils/manual_usb_stage/
 +
*make clean; make all; sudo make install;
 +
*look at /etc/pi_stage/usb_installed_stages, change stage_model_here to whatever model file you need to use... (axis 0  m-062.pd)
  
*cd /home/scan/source/dev/BNS/utils/
+
== Newport mirrors ==
*make clean; make; sudo make install
+
Control of the capacitive feedback newport CONEX mirror. Separate scripts for Newport Agilis exisit.
*Installs:
 
**bns_change_frame (change_frame_bns)
 
**bns_laser_ab
 
**bns_power
 
**bns_power_off
 
**bns_power_on
 
**bns_upload_frame (upload1_bns)
 
  
*cd /home/scan/source/hardware/bns_slm/manual_bns/
+
*cd /home/scan/source/hardware/newport_CONEX
*make clean; make; sudo make install
+
*sudo make; sudo make install;
 
*Installs:
 
*Installs:
**manual_bns
+
**newport_control
  
*cd /home/scan/source/hardware/bns_slm/set_bns/
+
and copies the appropriate udev rule to the local machine.
*make clean; make; sudo make install
 
*Installs:
 
**set_bns
 
  
== FFTW libraries ==
 
 
These are needed by the higher order correction algorithm when using the SLM in c-scan. I use the ''float'' version of the libraries (rather than the standard ''double'' version) for speed, and so an extra option must be set before compiling.
 
 
*cd /home/scan/source/fftw-3.0.1_blanket/
 
*make distclean; ./configure --enable-float; make; sudo make install
 
*Installs:
 
**(FFTW float libraries)
 
 
== Comedi, specifically the Amplicon PCI230 DAQ ==
 
 
The current version of the comedi is 0.7.75. The current version of comedilib is 0.8.1.
 
 
=== comedi ===
 
*cd /home/scan/source/hardware/comedi/comedi-0.7.75/
 
*make distclean; ./configure; make;
 
*sudo make install; sudo /sbin/depmod -a; sudo make dev
 
*Installs:
 
**(comedi libraries)
 
**(device libraries)
 
**(comedi devices in /dev/)
 
 
*sudo echo 'KERNEL=="comedi*",                      MODE="0666"' > /etc/udev/rules.d/53-comedi.rules
 
**Sets the permissions of the DAQ to world-readable-and-writable during boot
 
 
*sudo echo 'install amplc_pci230 PATH=/sbin:/usr/sbin:/usr/local/sbin:$PATH; comedi_config /dev/comedi0 amplc_pci230' >> /etc/modprobe.conf.local
 
**Means that when you use ''modprobe'' to load the amplc_pci230 module, it automatically runs ''comedi_config'' too.
 
**Unfortunately, ''udev'' ignores this, so we have to...
 
*sudo echo '/sbin/modprobe amplc_pci230' >> /etc/init.d/boot.local
 
*sudo echo '/usr/local/sbin/comedi_config /dev/comedi0 amplc_pci230' >> /etc/init.d/boot.local
 
**Makes the PCI230 modules get loaded automatically at boot time
 
 
==== Dealing with kernel updates ====
 
 
Updates to the kernel mean that the comedi drivers need to be reinstalled. As the kernel updates are usually fairly minor, the comedi drivers usually don't need recompiling. It's annoying having to deal with this, so this solution helps to remove some of that annoyance. When you've installed comedi run the following as root:
 
 
cp -r /lib/modules/$(uname -r)/comedi /lib/modules/
 
 
This will copy your current comedi installation to /lib/modules/comedi.
 
 
Now add the following to /etc/init.d/boot.local (*before* any of the commands to load the comedi modules):
 
 
KERNEL=$(uname -r)
 
 
if [ ! -d /lib/modules/${KERNEL}/comedi/ ]; then
 
        cp -r /lib/modules/comedi /lib/modules/${KERNEL}/
 
        depmod -a
 
fi
 
 
This will check for the presence of the comedi directory in the modules directory for the current kernel and copy it over if it doesn't exist. ''depmod -a'' updates the module dependencies.
 
 
It is important that if you install a newer version of comedi that you remove /lib/modules/comedi and replace it with your updated version. Also note that some kernel updates may be incompatible with your compiled comedi drivers and so you'll have to recompile and reinstall using the instructions above.
 
 
=== comedilib ===
 
 
*cd /home/scan/source/hardware/comedi/comedilib-0.8.1/
 
*make distclean; ./configure; make; sudo make install
 
*Installs:
 
**libcomedi
 
**comedi_test
 
**/usr/local/sbin/comedi_config
 
 
== Comedi Settings for the NI PCI-6251 ==
 
 
If you want to use the PFI port as a digital output, you must do some extra configuration. This is possible using the demo tools in comedilib (which could also be copied across to your own code of course). So, to change channel 14 of subdevice 7 (ie. pin 1 on the connector) to be a digital output do the following in the comedilib/demo directory:
 
 
* ./choose_routing -s7 -c14 16  # NI_PFI_OUTPUT_DO == 16
 
* ./dio -s7 -c14 1        # now its an output
 
* ./outp -s7 -c14 1  # test the output (or 0)
 
  
 
== c-scan ==
 
== c-scan ==
I had to make a once-only change to blanket's c_scan Makefile, due to going from a 2.4 kernel to a 2.6 kernel (and subsequent change of BNS device driver).
 
  
 
*cd /home/scan/source/hardware/scanner/
 
*cd /home/scan/source/hardware/scanner/
 +
*edit or create the Makefile for your machine - i.e. Makefile.swing you need to comment in the modules you want to install here
 
*make clean; make; sudo make install  
 
*make clean; make; sudo make install  
*cp ~sds/bin/cscan /usr/local/bin/
+
*sudo cp ~sds/bin/cscan /usr/local/bin/
 
*Installs:
 
*Installs:
 
**c_scan
 
**c_scan
Line 244: Line 125:
 
**cscan: this performs a "''touch''" on the con-file that you're running with c_scan, so you can see the time at which you started the scan, and - by the time stamp on the data file - the time at which you finished the scan.
 
**cscan: this performs a "''touch''" on the con-file that you're running with c_scan, so you can see the time at which you started the scan, and - by the time stamp on the data file - the time at which you finished the scan.
  
== Jai CCD camera ==
 
*cp ~sds/bin/ccd* /usr/local/bin/
 
*Installs:
 
**ccd_set_serial
 
**ccd0
 
**ccd1
 
**..
 
**ccd7 (different shutter speeds)
 
== Andor iXon camera ==
 
You can find the latest driver here: /home/scan/source/hardware/andor_camera/andor you need to copy
 
this directory to a local disk to build and install the driver and libraries because the andor
 
supplied script borks if it isn't run as root and the permissions on the nfs disks prevent root
 
running the script directly.
 
  
The current driver is v2.82 install in December 2008 by Matt.  This is broken for kernel versions
 
2.6.23-2.6.27 and will cause hard kernel lock ups is you install it on these kernels. Under newer
 
kernels it may not compile because of an error in src/driver/fault.c - just just #define NOPFN_SIGBUS -1
 
in the preamble of fault.c to fix this.  We are waiting for a revised driver.
 
  
== Nanoscope lab / Andor iXon camera ==
+
== d-scan ==
The Andor camera setup we use uses a client / server model to overcome some of the shortcomings of
+
Modern version of c-scan with greater flexibility etc.
the Andor driver / libraries.  All the code can be found in  /home/scan/source/hardware/andor_camera/camera.
+
*cd /home/scan/source/d_scan/d_scan
You need to make the camera_driver and the camera_utils all application code should use and compile
+
*edit or create the Makefile for your machine - i.e. Makefile.swing you need to comment in the modules you want to install here
in the camera_client code. Before you use anything the server needs to be running (camera_server).
+
*make clean; make; sudo make install
Placing the following line in boot.local AFTER the Andor code will ensure it runs at boot time:
+
*Find errors and debug
<pre>
 
echo Installing the camera_server
 
su matt -c /usr/local/bin/camera_server &
 
</pre>
 
 
 
Rememer the meminfo thing! reserve at least 4Mb of RAM for the driver by adding this to the boot options in the grub boot
 
script (menu.1st) mem=1000M where 1000 is the size of the RAM in Mb - 4 (maybe 5?) as in:
 
 
 
<pre>
 
    kernel /boot/vmlinuz-2.6.25.18-0.2-default root=/dev/disk/by-id/scsi-SATA_ST340014A_3JX7N160-part2 resume=/dev/sda1 splash=silent showopts mem=1000M vga=0x31a
 
</pre>
 
 
 
The current driver 2.82-30003 on kernel 2.6.27.xx appears to be working, however, Andor seem to be ironing out a few bugs still so this could be volatile - if you have a working system I suggest leaving it alone.
 
  
2.78 works on pre 2.6.25 (or thereabouts) but not after because it causes hard kernel locks, it also requires a little hacking
+
*Fair chance you'll run into problems with the OpenCV version, you'll need to get an older version from the git repository ~good luck~.
to compile on these newer kernels but since it crashes this is a little pointless. 2.82-30002 compiles and doesn't crash
 
but returns scrambled image data.  2.82-30003 compiles on 2.6.27 kernels but not older ones, it doesn't crash and the image
 
data seems ok.
 

Latest revision as of 15:31, 28 February 2023

Extra stuff for all the experimental hardware that might need setting up. The information contained here will also be useful if you want to install any of these bits of hardware on any other Linux PC.

2023 Update

Experimental PC Kubuntu 22.04 supersedes most of this page.

2022 Update

Much of the information in the Experimental PC old page is now out-dated and/or refers to hardware that is no longer in use. This new page attempts to build a modern version, please contribute by adding instructions for software they use regularly.

Back to Linux How-tos


Pre-install

Scenario 1: inherited PC with working hardware, updating Linux

  1. Make a list of all the hardware you have (or likely to have) attached to the PC
  2. From this list, work out which programs/utilities you use
    • Most of these will already be installed in /usr/local/bin/
  3. Work out how to recompile (and re-install) all these programs
    • Most will have their source code in /home/scan/source/hardware/
  4. Save all the configuration files you think you might need
    • Most of these will be in /etc/


Scenario 2: Adding new hardware to an already up-to-date PC

  1. Use this wiki, find the instructions for the relevant hardware
  2. Any extra configuration files you need (e.g. /etc/stages/IW_stage_origin) - copy off a PC that already has this hardware installed (or you may find a copy in /home/share/backup_system_files/<name of PC> )


ThorLabs APT control components

See ThorLabs apt stages.

Scope (and AFG) utilities

These are the standard command-line utilities to grab traces, save setups etc

vxi11

(Used by Agilent and Tek utilities, and a low-level diagnostic tool in its own right)

  • cd /home/scan/source/hardware/vxi11/
  • make clean; make; sudo make install
  • Installs:
    • vxi11_cmd
    • vxi11 user library

Agilent scope

  • cd /home/scan/source/hardware/agilent_scope/
  • make clean; make; sudo make install
  • Installs:
    • agetwf
    • agilent_load_setup
    • agilent_save_setup

Tek scope/AFG

  • cd /home/scan/source/hardware/tek/
  • make clean; make; sudo make install
  • Installs:
    • tgetwf
    • tek_load_setup
    • tek_save_setup
    • tek_afg_upload_arb
    • tek user library

LeCroy scope

  • cd /home/scan/source/hardware/lecroy/
  • make clean; make; sudo make install
  • Installs:
  • lgetwf

PI pci stages*

Experimental PC Old instructions on this cover up to driver_2.6. Below are updated instructions for driver_3.xx_v1.0, but are sios specific! sios install may need to be ported from L4, or sios may need to painfully upgrade to latest os/kernel.

  • cd /home/scan/source/dev/pi_pci/driver_3.xx_v1.0/library/
  • make clean; make; sudo make install;
  • // for new PC may need to double check that g++ is installed, and possibly libncurses5-dev
  • cd /home/scan/source/hardware/pi_pci_stage/
  • // for kernel versions 5.4 and older certain headers don't have consistent filepaths wrt /usr/src/*headers* and /usr/include/linux/. so below is mainly specific to outdated kernels in sios at the moment.
  • // cp /usr/local/include/pi_stage.h from ejectorseat to your local experimental pc (last stable version for sios on ejectorseat)
  • make clean; make; sudo make install;
  • cd /home/scan/source/dev/pi_pci/driver_3.xx_v1.0/driver/
  • // permissions for this directory are wild, root and scan users don't seem to be able to write/access certain files during "make" so temporary work around right now is to cp -r the entire /driver directory onto the local disk (e.g. in /tmp/something) where the local user for sure has full permissions on every file and sub-directory
  • make
  • // if there are errors about /etc/pi_stage/position not existing cp or mv position_um to it. if there are errors complaining about things at the kernel level, then you might need to install source files: sudo apt-get install linux-source
  • sudo ./install_pi_stage


PI USB stage driver

I think the format of udev rules has changed since the scripts were first written and the SYSFS should be replaced with ATTRS. This should fix the problem of the device not being recognised automatically when plugged in.

  • cd /home/scan/source/hardware/pi_usb_stage/utils/cmd_line_utils/
  • make clean; make all; sudo make install;
  • sudo ./actually_install_pi_usb
  • check if /etc/udev/rules.d/98-pi-usb.rules exists and change SYSFS to ATTRS (the remove rules should still be okay).
  • cd /home/scan/source/hardware/pi_usb_stage/utils/manual_usb_stage/
  • make clean; make all; sudo make install;
  • look at /etc/pi_stage/usb_installed_stages, change stage_model_here to whatever model file you need to use... (axis 0 m-062.pd)

Newport mirrors

Control of the capacitive feedback newport CONEX mirror. Separate scripts for Newport Agilis exisit.

  • cd /home/scan/source/hardware/newport_CONEX
  • sudo make; sudo make install;
  • Installs:
    • newport_control

and copies the appropriate udev rule to the local machine.


c-scan

  • cd /home/scan/source/hardware/scanner/
  • edit or create the Makefile for your machine - i.e. Makefile.swing you need to comment in the modules you want to install here
  • make clean; make; sudo make install
  • sudo cp ~sds/bin/cscan /usr/local/bin/
  • Installs:
    • c_scan
    • c_scan man pages
    • cscan: this performs a "touch" on the con-file that you're running with c_scan, so you can see the time at which you started the scan, and - by the time stamp on the data file - the time at which you finished the scan.


d-scan

Modern version of c-scan with greater flexibility etc.

  • cd /home/scan/source/d_scan/d_scan
  • edit or create the Makefile for your machine - i.e. Makefile.swing you need to comment in the modules you want to install here
  • make clean; make; sudo make install
  • Find errors and debug
  • Fair chance you'll run into problems with the OpenCV version, you'll need to get an older version from the git repository ~good luck~.