Skip to content
forked from CMS-HGCAL/rpi-daq

Software for single-module control using a Raspberry Pi

Notifications You must be signed in to change notification settings

adavidzh/rpi-daq

 
 

Repository files navigation

rpi-daq

Software for taking data from one hexaboard module with four SKIROC2_CMS chips, using the test stand board.

Two main acquisition programs:

  • run_local.py for local debugging.
  • daq-zmq_client.py, that spawns a server over the network in the device and processes data off-device. This package then needs to be installed in both machines, though only the python part in the client.

Two main sources of configuration:

  • yaml file
  • command line options

More details on the SKIROC2_CMS readout chip configuration can be found here and here.

Installation

See here to install Raspbian on a Pi 3.

Then:

cd $HOME
git clone https://github.com/CMS-HGCAL/rpi-daq
cd rpi-daq
make packages

The following step is only needed in the server or for local running (it is not needed for the client):

make

Finally, a local test run with charge injection:

make testrun

Another example of a local acquisition:

python run_local.py --showRawData --dataNotSaved

An example of client and server running in the same machine

python daq-zmq-client.py -e

Development

Code structure

  • rpi_daq.py: configures the chips and reads events.

  • src/gpiohb.c: utilities for low-level communication with the hexaboard; uses the bcm2835 library.

  • unpacker.py: parses (and compresses) raw data.

  • skiroc2cms_bit_string.py: utilities for configuration of the readout chips.

  • run_local.py: simple local running application.

  • daq-zmq-{client,server}.py: full-fledged system with data processing offloaded to client side.

Ideas for contributions

  • 🚀 Optimize timing of gpiohb.c I/O routines.
  • 💡 Develop an ASUS Tinker Board version.
  • ➕ Add functionality to skiroc2cms_bit_string.py.
  • 🔒 Improve the client-server usage, e.g., streamlining ssh sessions (no password, public key).

Contributing

  • Fork this project,
  • Clone your repository when installing,
  • Your magic happens here,
  • Push to your repository, and
  • Submit pull requests.

Installing OS on device

Raspberry Pi 3 from scratch

  • Download Raspbian with desktop.
  • Use Etcher to write the image to the SD card.
  • Boot the device and connect a screen, keyboard, and mouse.
  • Connect device to network using desktop tools.
    When using wired and wireless network, editing /etc/wpa_supplicant/wpa_supplicant.conf may be needed to sort out priorities. See also this.
  • Register device to network, including both wired and wireless MAC addresses that can be obtained using ifconfig.
  • Update the system:
    sudo apt-get update
    sudo apt-get --yes dist-upgrade
    sudo apt-get clean
    sudo apt --yes autoremove
    sudo rpi-update
  • sudo reboot
  • Change pi user password using passwd.
  • Enable VNC in pi customization GUI from Desktop menu → Preferences → Raspberry Pi Configuration → Interfaces → VNC: Enabled.
  • Install some goodies:
    sudo apt-get --yes install emacs25 htop iotop nmap liquidprompt ipython elpa-markdown-mode yaml-mode
    liquidprompt_activate
  • Free up some space:
     sudo apt-get --yes purge wolfram-engine libreoffice*
     sudo apt-get clean
     sudo apt-get --yes autoremove

🚧 ASUS Tinker Board from scratch

  • Download TinkerOS-Debian image from the downloads section in the Tinker Board page.
  • Use Etcher to write the image to the SD card.
  • Default user and password are linaro:linaro. Change it.
  • Register device to network, including both wired and wireless MAC addresses that can be obtained using ifconfig.
  • Update the system:
    sudo apt-get update
    sudo apt-get --yes dist-upgrade
    sudo apt-get clean
    sudo apt --yes autoremove
  • Install some goodies:
    sudo apt-get --yes install emacs25 htop iotop nmap liquidprompt ipython elpa-markdown-mode yaml-mode git tree
    liquidprompt_activate
    echo heartbeat | sudo tee /sys/class/leds/led1-led/trigger
  • Setup the C GPIO API (see also the Tinker Board page). Basically:
    cd $HOME
    git clone http://github.com/TinkerBoard/gpio_lib_c.git
    cd gpio_lib_c/
    sudo ./build
    gpio -v
    gpio readall
  • Set up VNC (sudo tinker-config allows to start VNC, but not to set it up as a deamon):
    # From https://tinkerboarding.co.uk/wiki/index.php?title=Software#Remote_access
    sudo apt-get --yes install x11vnc
    echo "@x11vnc -forever -noxrecord" >> ~/.config/lxsession/LXDE/autostart
    sudo service lightdm restart

About

Software for single-module control using a Raspberry Pi

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Python 59.5%
  • C 30.7%
  • C++ 5.3%
  • Makefile 4.5%