====== LNLS 100 MHz ADC RT DAQ ======
This description including the installation scripts can also be found here:
[[https://git.gsi.de/BEA_HDL/lnls_halcs_installation|Git repository]]
===== Gateware (FPGA) =====
The source code can be found in the following Git repository:
[[https://github.com/lnls-dig/fmc-adc-100m14b4cha-gw/tree/afcv3-port|fmc-adc-100m14b4cha-gw]]
A ready to load bitstream can be found here:
[[https://github.com/lnls-dig/fmc-adc-100m14b4cha-gw/releases/tag/afc-fmc-adc-v5.0|bitstream]]
===== Software =====
The source code can be found in the following Git repository:
[[https://github.com/lnls-dig/halcs|HALCS]]
The documentation can be found here:
[[https://lnls-dig.github.io/halcs|HALCS documentation]]
===== MMC =====
The MMC code is among other things responsible for routing the correct clocks to the FPGA. The documentation can be found here:
[[https://lnls-dig.github.io/openMMC|open MMC]]
===== Installation at GSI =====
The installation was successfully tested on a Schroff MTCA-6P-PH8GSI-007 crate equipped with:
* a Concurrent Technologies CPU-Unit running CentOS 7
* an AFCv3.1 board running open MMC code, equipped with two 100 MHz ADC FMC boards.
==== Steps to perform ====
=== load the bitstream file ===
load the bitstream file (link above) to the AFC's FPGA using Vivado Hardware Manager
=== install additional packages ===
on Centos 7, some additional packages might have to be installed:
1_install_packages.sh\\
#!/bin/sh
sudo yum install -y https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm
sudo yum install -y git kernel-devel uuid
sudo yum groupinstall -y "Development Tools"
=== install required libraries ===
2_install_dependencies.sh\\
#!/bin/sh
export LD_LIBRARY_PATH="$LD_LIBRARY_PATH:/usr/local/lib"
git clone --branch=1.0.8 https://github.com/jedisct1/libsodium.git
git clone --branch=v4.2.5 https://github.com/zeromq/libzmq.git
#git clone --branch=v4.0.2 https://github.com/zeromq/czmq.git # fails with malloc error
git clone https://github.com/zeromq/czmq.git
for project in libsodium libzmq czmq; do
CONFIG_OPTS=()
CONFIG_OPTS+=("CFLAGS=-Wno-format-truncation")
CONFIG_OPTS+=("CPPFLAGS=-Wno-format-truncation")
#if [ $project == "libzmq" ]; then
# CONFIG_OPTS+=("--with-libsodium") # makes libzmq installation fail
#fi
cd $project && \
./autogen.sh && \
./configure "${CONFIG_OPTS[@]}" && \
make check && \
make && \
sudo make install && \
sudo ldconfig && \
cd ..
# Check last command return status
if [ $? -ne 0 ]; then
echo "Could not compile/install project $project." >&2
exit 1
fi
done
git clone --branch=v1.6.1 https://github.com/lnls-dig/malamute.git && \
for project in malamute; do
CONFIG_OPTS=()
CONFIG_OPTS+=("--with-systemd-units")
CONFIG_OPTS+=("--sysconfdir=/usr/etc")
CONFIG_OPTS+=("--prefix=/usr")
CONFIG_OPTS+=("CFLAGS=-Wno-format-truncation")
CONFIG_OPTS+=("CPPFLAGS=-Wno-format-truncation")
cd $project && \
./autogen.sh && \
./configure "${CONFIG_OPTS[@]}" && \
make check && \
make && \
sudo make install && \
sudo ldconfig && \
cd ..
MALAMUTE_VERBOSE=0
MALAMUTE_PLAIN_AUTH=
MALAMUTE_AUTH_MECHANISM=null
MALAMUTE_ENDPOINT='ipc:///tmp/malamute'
MALAMUTE_CFG_FILE=/usr/etc/malamute/malamute.cfg
# Install our custom Malamute config file
sudo sed -i \
-e "s|verbose\( *\)=.*|verbose\1= ${MALAMUTE_VERBOSE}|g" \
-e "s|plain\( *\)=.*|plain\1= ${MALAMUTE_PLAIN_AUTH}|g" \
-e "s|mechanism\( *\)=.*|mechanism\1= ${MALAMUTE_AUTH_MECHANISM}|g" \
-e "s|tcp://\*:9999|${MALAMUTE_ENDPOINT}|g" \
${MALAMUTE_CFG_FILE}
# Enable service
sudo systemctl enable malamute || /bin/true
# Check last command return status
if [ $? -ne 0 ]; then
echo "Could not compile/install project $project." >&2
exit 1
fi
done
=== install HALCS ===
3_install_HALCS.sh\\
#!/bin/sh
git clone --recursive https://github.com/lnls-dig/halcs && \
cd halcs && \
make && \
sudo make install
=== install the PCIe driver ===
* change directory to 'foreign/pcie-driver/drivers/pcie/src' in the clone of the HALCS repository
* 'make && sudo make install'
* load kernel module: 'sudo insmod pciDriver.ko'
* check the connection to the AFC board: 'll /dev/fpga*' should not be empty
=== test the installation ===
* follow the instructions: [[https://lnls-dig.github.io/halcs/halcs-tools.html|test tools]]
* There are test programs in the folder 'examples'
* './examples/build/exe/acq/production/afcv3_1/acq -b ipc:///tmp/malamute --halcsnumber 0 --boardslot 2 --channumber 0 --numsamples 100' will display 100 ADC samples (noise samples if nothing is connected to the ADC inputs)
* 'halcsnumber' is the index of the FMC board {0, 1}
* 'boardslot' is the AMC slot number
==== Functional Testing ====
No functional tests have taken place yet.