Commit eef93632 authored by Maciej Lipinski's avatar Maciej Lipinski

Merge branch 'proposed_master' into 'master'

Tests: docker & compilation

See merge request !1
parents e6fbc7b4 dfee04e2
# .gitignore file # .gitignore file
xcompiler/*
# OS generated files # # OS generated files #
###################### ######################
*.bak *.bak
......
[submodule "spec-sw"] [submodule "spec-sw"]
path = spec-sw path = spec-sw
url = git://ohwr.org/fmc-projects/spec/spec-sw.git url = https://ohwr.org/project/spec-sw.git
[submodule "etherbone"] [submodule "wr-nic"]
path = etherbone path = wr-nic
url = git://ohwr.org/hdl-core-lib/etherbone-core.git url = https://ohwr.org/project/wr-nic.git
[submodule "fmc-dio"]
path = fmc-dio
url = https://ohwr.org/project/fmc-dio-5chttla.git
[submodule "wrpc-sw"]
path = wrpc-sw
url = https://ohwr.org/project/wrpc-sw.git
[submodule "coht-vic"]
path = coht-vic
url = https://gitlab.cern.ch/cohtdrivers/coht-vic.git
...@@ -14,30 +14,40 @@ ...@@ -14,30 +14,40 @@
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. ## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
######################################################################## ########################################################################
SUBMOD_DIRS=spec-sw etherbone SUBMOD_DIRS=spec-sw wr-nic fmc-dio coht-vic
MAKE_DIRS = spec-sw etherbone/api #tools MAKE_DIRS = spec-sw wr-nic fmc-dio coht-vic #tools
#RUNME := $(shell test -d $(FMC_DRV) || git submodule update --init) LM32_XCOMPILER_URL="https://www.ohwr.org/project/wrpc-sw/uploads/2776ce0ba43503d1486ae205b48fb450"
LM32_XCOMPILER_NAME="lm32_host_64bit.tar.xz"
XCOMPILER_DIR="xcompiler"
LM32_XCOMPILER_NAME_DIR="lm32-gcc-4.5.3"
#RUNME := $(shell test -d $(FMC_DRV) || git submodule update --init)
## Call the sub folder Makefiles ## Call the sub folder Makefiles
all clean install: init all clean install: init
@for d in $(MAKE_DIRS); do $(MAKE) -C $$d $@ || exit 1; done @for d in $(MAKE_DIRS); do $(MAKE) -C $$d $@ || exit 1; done
@if [ "x$@" = "xinstall" ]; then ./scripts/wr-ssk-get -i; fi @if [ "x$@" = "xinstall" ]; then ./scripts/wr-ssk-get -i; cp wrpc-sw/tools/wrpc-vuart /usr/local/sbin; fi
## Init repo and create the .INIT file to not do it again ## Init repo and create the .INIT file to not do it again
init: .INIT init: .INIT
.INIT: .INIT:
git submodule init git submodule init
@ $(MAKE) update @ $(MAKE) update
@ $(MAKE) patch
@touch .INIT; \ @touch .INIT; \
patch:
./scripts/wr-git-patch
## Force updating the submodules and fetch new gateware ## Force updating the submodules and fetch new gateware
update: update:
./scripts/wr-ssk-get -f ./scripts/wr-ssk-get -f
git submodule update git submodule update
cd spec-sw @rm -rf $(XCOMPILER_DIR)
git submodule update mkdir -p $(XCOMPILER_DIR)
cd $(XCOMPILER_DIR) && wget $(LM32_XCOMPILER_URL)/$(LM32_XCOMPILER_NAME) \
&& tar xvf $(LM32_XCOMPILER_NAME)
cd wrpc-sw && make spec_defconfig && \
CROSS_COMPILE="$(shell pwd)/$(XCOMPILER_DIR)/$(LM32_XCOMPILER_NAME_DIR)/bin/lm32-elf-" make
coht-vic @ b4431e73
Subproject commit b4431e739bbc5a4ed1701ab7f4a372fbb4f33cf8
...@@ -23,8 +23,8 @@ PDF=$(addprefix pdf/, $(SRC:.md=.pdf)) ...@@ -23,8 +23,8 @@ PDF=$(addprefix pdf/, $(SRC:.md=.pdf))
TEX=$(SRC:.md=.tex) TEX=$(SRC:.md=.tex)
## Pandoc arguments ## Pandoc arguments
OPTIONS=-f markdown --toc --number-sections --smart OPTIONS?=-s --from markdown+yaml_metadata_block --toc --number-sections --smart
TEMPLATE=pandoc.latex TEMPLATE=pandoc.latex
ifneq "$(TEMPLATE)" "" ifneq "$(TEMPLATE)" ""
...@@ -42,11 +42,19 @@ DATE = $(shell date +"%d %b. %Y") ...@@ -42,11 +42,19 @@ DATE = $(shell date +"%d %b. %Y")
all: $(PDF) all: $(PDF)
tex: $(TEX) tex: $(TEX)
pdf: $(PDF) pdf: $(PDF)
verbose:
make OPTIONS="-s --from markdown+yaml_metadata_block --toc --number-sections --smart --verbose" -C . pdf
## Special targets to create directory ## Special targets to create directory
DIR_%: DIR_%:
mkdir -p $(subst DIR_,,$@) mkdir -p $(subst DIR_,,$@)
pdf/wr-starting-kit.pdf: wr-starting-kit.md Makefile $(TEMPLATE) DIR_pdf
pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \
-V title="WR Starting Kit" -V subtitle="User Guide" -V author="Seven Solutions" \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $<
pdf/%.pdf: %.md Makefile $(TEMPLATE) DIR_pdf pdf/%.pdf: %.md Makefile $(TEMPLATE) DIR_pdf
pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \ pandoc $(OPTIONS) --latex-engine=xelatex --listings --highlight-style=haddock $(TEMPLATEARG) \
-V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $< -V lang=english -V fontsize=11pt -V documentclass=article -V bg-color=238,245,240 -V date="$(DATE) - $(VERSION)" -o $@ $<
......
---
title: 'Generate WR Starting Kit Documentation'
subtitle: "How to generate starting kit pdf from markdown using pandoc"
author: Seven Solutions
...
Intro
==========
The document has been written in markdown format and can be directly
read from github, gitlab or bitbucket
PDF Generation
===============
You might need to install `pandoc` software to generate `.pdf` from `.md`.
sudo apt-get install pandoc
To generate a specific document you should enter its own directory and execute
make
If you have some Latex compilation error please install the following packages
sudo apt-get install texlive texlive-latex-extra
### pandoc.latex
The file pandoc.latex is a latex template in order to add all special latex customization
to the markdown file. In case some of latex package are not working properly, the user
should try to modify this file.
Syntax
===========
> ***NOTES:*** The syntax used in this document is Markdown. We recommand to follow the strict
markdown syntax explained on [bitbucket](https://bitbucket.org/tutorials/markdowndemo).
Misc
======
Dirty tags
--------------
During compilation of `fmc-bus` kernel, the Make generated files that should be .gitignore.
If you want to clean the tags of the repos you can use the following command to manually clean
everything:
~~~~~{.bash}
### Find dirty files:
git submodule foreach --recursive git status
### Remove them
find ./ -wholename "*fmc-bus/kernel/.cache.mk" -delete
find ./ -wholename "*fmc-bus/kernel/fmc-chardev.o.ur-safe" -delete
~~~~~~~~
doc/img/ssk_ txpps.png

61.2 KB | W: | H:

doc/img/ssk_ txpps.png

90.5 KB | W: | H:

doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
doc/img/ssk_ txpps.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_100Hz.png

191 KB | W: | H:

doc/img/ssk_100Hz.png

140 KB | W: | H:

doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
doc/img/ssk_100Hz.png
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
doc/img/ssk_configs.png

72.8 KB | W: | H:

doc/img/ssk_configs.png

40.4 KB | W: | H:

doc/img/ssk_configs.png
doc/img/ssk_configs.png
doc/img/ssk_configs.png
doc/img/ssk_configs.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_inside.jpg

460 KB | W: | H:

doc/img/ssk_inside.jpg

384 KB | W: | H:

doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
doc/img/ssk_inside.jpg
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
doc/img/ssk_playdio.png

15.9 KB | W: | H:

doc/img/ssk_playdio.png

41.4 KB | W: | H:

doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
doc/img/ssk_playdio.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_pps-setup.png

34.8 KB | W: | H:

doc/img/ssk_pps-setup.png

67 KB | W: | H:

doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
doc/img/ssk_pps-setup.png
  • 2-up
  • Swipe
  • Onion skin
doc/img/ssk_sfp.jpg

351 KB | W: | H:

doc/img/ssk_sfp.jpg

285 KB | W: | H:

doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
doc/img/ssk_sfp.jpg
  • 2-up
  • Swipe
  • Onion skin
File mode changed from 100755 to 100644
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Pandoc Template used by Seven Solution to generate pdf from markdown %% Pandoc Template used by Seven Solution to generate pdf from markdown
%% files. %% files.
%% %%
%% Authors: %% Authors:
%% - Benoit Rat (Seven Solutions, www.sevensols.com) %% - Benoit Rat (Seven Solutions, www.sevensols.com)
%% %%
%% GNU Lesser General Public License Usage %% GNU Lesser General Public License Usage
%% This file may be used under the terms of the GNU Lesser %% This file may be used under the terms of the GNU Lesser
%% General Public License version 2.1 as published by the Free Software %% General Public License version 2.1 as published by the Free Software
%% Foundation and appearing in the file LICENSE.LGPL included in the %% Foundation and appearing in the file LICENSE.LGPL included in the
%% packaging of this file. Please review the following information to %% packaging of this file. Please review the following information to
%% ensure the GNU Lesser General Public License version 2.1 requirements %% ensure the GNU Lesser General Public License version 2.1 requirements
%% will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html. %% will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\documentclass[a4paper,oneside,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
\usepackage{amssymb,amsmath} \documentclass[a4paper,oneside,table,$if(fontsize)$$fontsize$,$endif$$if(lang)$$lang$,$endif$]{$documentclass$}
\usepackage[left=2.2cm,right=2.2cm,top=3cm,bottom=3cm]{geometry} \usepackage{amssymb,amsmath}
\usepackage[left=2.2cm,right=2.2cm,top=2cm,bottom=2cm]{geometry}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Xetex. \providecommand{\tightlist}{%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \setlength{\itemsep}{0pt}\setlength{\parskip}{0pt}}
\usepackage{ifxetex,ifluatex} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\ifxetex %%% Xetex.
\usepackage{fontspec,xltxtra,xunicode} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else \usepackage{ifxetex,ifluatex}
\ifluatex \ifxetex
\usepackage{fontspec} \usepackage{fontspec,xltxtra,xunicode}
\defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase} \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else \else
\usepackage[utf8]{inputenc} \ifluatex
\fi \usepackage{fontspec}
\fi \defaultfontfeatures{Mapping=tex-text,Scale=MatchLowercase}
\else
\usepackage[utf8]{inputenc}
\ifxetex \fi
\usepackage[setpagesize=false, % page size defined by xetex \fi
unicode=false, % unicode breaks when used with xetex
xetex,
colorlinks=true, \ifxetex
urlcolor=blue, \usepackage[setpagesize=false, % page size defined by xetex
anchorcolor=blue, unicode=false, % unicode breaks when used with xetex
linkcolor=blue]{hyperref} xetex,
\else colorlinks=true,
\usepackage[unicode=true, urlcolor=darksevenblue,
colorlinks=true, anchorcolor=darksevenblue,
linkcolor=blue]{hyperref} linkcolor=darksevenblue]{hyperref}
\fi \else
\usepackage[unicode=true,
colorlinks=true,
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% linkcolor=darksevenblue]{hyperref}
%% Generic \fi
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$if(url)$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{url} %% Generic
$endif$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{calc} $if(url)$
\hypersetup{breaklinks=true, pdfborder={0 0 0}} \usepackage{url}
\usepackage{pbox} $endif$
\usepackage{calc}
\hypersetup{breaklinks=true, pdfborder={0 0 0}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{pbox}
%% Environment for code formatting
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \usepackage{wallpaper}
%% Define the background (shade) color %% Define common color
\usepackage{color} \usepackage{color}
\definecolor{shadecolor}{RGB}{$bg-color$} \definecolor{darksevenblue}{RGB}{10,100,130}
\definecolor{darkgreen}{RGB}{0,125,0} \definecolor{sevensolsblue}{RGB}{15,130,175}
\definecolor{darkred}{RGB}{170,0,0}
\definecolor{turquoise}{RGB}{20,100,100} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% Environment for code formatting
$if(listings)$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\usepackage{fancyvrb, listings, color}
\lstset{% %% Define the background (shade) color
basicstyle=\small\ttfamily, \usepackage{color}
breaklines=true, \definecolor{darkblue}{RGB}{8,40,80}
fancyvrb=true, \definecolor{shadecolor}{RGB}{$bg-color$}
tabsize=2, \definecolor{darkgreen}{RGB}{0,125,0}
columns=fullflexible, \definecolor{darkred}{RGB}{170,0,0}
keywordstyle=\color{blue}\textbf, \definecolor{turquoise}{RGB}{20,100,100}
identifierstyle=,
commentstyle=\color{darkgreen}\textit, $if(listings)$
stringstyle=\color{red}, \usepackage{fancyvrb, listings, color}
backgroundcolor=\color{shadecolor}, \lstset{%
} basicstyle=\small\ttfamily,
breaklines=true,
\lstdefinelanguage{sh} keepspaces=true,
{ showstringspaces=false,
sensitive=true, fancyvrb=true,
keywords={sudo}, tabsize=2,
alsoletter={\#,:,>},% columns=fullflexible,
emph={>:\# ,>:$$}, keywordstyle=\color{blue}\textbf,
moreemph={wrc\# ,wrc1\# ,wrc2\# , >spusa:\# ,>tornado:\# }, identifierstyle=,
emphstyle=\color{darkred}, commentstyle=\color{darkgreen}\textit,
comment=[l]{\#\#},% stringstyle=\color{red},
morestring=[s]{\{}{\}}, backgroundcolor=\color{shadecolor},
keywordstyle=\color{blue}\textbf, }
commentstyle=\color{darkgreen}\textit,
stringstyle=\color{turquoise}, \lstdefinelanguage{sh}
backgroundcolor=\color{shadecolor}, {
} sensitive=true,
keywords={sudo},
$endif$ alsoletter={\#,:,>},%
$if(lhs)$ emph={>:\# ,>:$$},
\lstnewenvironment{code} moreemph={wrc\# ,wrc1\# ,wrc2\# , >spusa:\$$ ,>tornado:\$$,>spusa:\# ,>tornado:\# },
{} emphstyle=\color{darkred},
{} comment=[l]{\#\#},%
$endif$ morestring=[s]{\{}{\}},
keywordstyle=\color{blue}\textbf,
$if(bg-color)$ commentstyle=\color{darkgreen}\textit,
% redefine env verbatim to be used to hold the code of any language. stringstyle=\color{turquoise},
\usepackage{framed} backgroundcolor=\color{shadecolor},
\let\oldverbatim=\verbatim }
\renewenvironment{verbatim}
{ $endif$
\begin{snugshade} $if(lhs)$
\begin{oldverbatim} \lstnewenvironment{code}
} {}
{ {}
\end{oldverbatim} $endif$
\end{snugshade}
} $if(bg-color)$
% redefine env verbatim to be used to hold the code of any language.
% Redefined \textttt to add it background color \usepackage{framed}
\usepackage{soul, color, url} \let\oldverbatim=\verbatim
\sethlcolor{shadecolor} \renewenvironment{verbatim}
\let\OldTexttt\texttt {
\renewcommand{\texttt}[1]{\OldTexttt{\hl{#1}}} \begin{snugshade}
\begin{oldverbatim}
% Add highlighting environment (when background color) }
$if(highlighting-macros)$ {
$highlighting-macros$ \end{oldverbatim}
\renewenvironment{Shaded}{ \end{snugshade}
\begingroup }
\fontsize{10pt}{12pt}\selectfont
\begin{snugshade} % Redefined \textttt to add it background color
} \usepackage{soul, color, url}
{ \sethlcolor{shadecolor}
\end{snugshade} \let\OldTexttt\texttt
\endgroup \renewcommand{\texttt}[1]{\OldTexttt{\hl{#1}}}
}
$endif$ % Add highlighting environment (when background color)
$if(highlighting-macros)$
$highlighting-macros$
\renewenvironment{Shaded}{
$else$ \begingroup
$if(highlighting-macros)$ \fontsize{10pt}{12pt}\selectfont
% Add highlighting environment (without background color) \begin{snugshade}
$highlighting-macros$ }
$endif$ {
$endif$ \end{snugshade}
\endgroup
\usepackage{alltt} }
$endif$
\let\oldquote=\quote
\renewenvironment{quote}
{
\begingroup $else$
\sffamily %sans-serif font $if(highlighting-macros)$
\slshape %slated (almost italic) % Add highlighting environment (without background color)
\fontsize{10pt}{12pt}\selectfont $highlighting-macros$
} $endif$
{ $endif$
\endgroup
} \usepackage{alltt}
\let\oldquote=\quote
$if(verbatim-in-note)$ \renewenvironment{quote}
%\usepackage{fancyvrb} {
$endif$ \begingroup
\sffamily %sans-serif font
\slshape %slated (almost italic)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \fontsize{10pt}{12pt}\selectfont
%% Graphics & Tables }
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% {
\endgroup
\usepackage{float} % provides the H option for float placement }
%% Tables
$if(tables)$ $if(verbatim-in-note)$
\usepackage{ctable} %\usepackage{fancyvrb}
$endif$ $endif$
%% Images
\usepackage{graphicx} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% We will generate all images so they have a width \maxwidth. This means %% Graphics & Tables
% that they will get their normal width if they fit onto the page, but %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% are scaled down if they would overflow the margins.
\makeatletter \usepackage{float} % provides the H option for float placement
\def\maxwidth{\ifdim\Gin@nat@width>\linewidth\linewidth \floatplacement{figure}{H}
\else\Gin@nat@width\fi}
\makeatother %% Tables
\makeatletter $if(tables)$
\def\maxheight{\ifdim\Gin@nat@height>10cm10cm \usepackage{ctable}
\else\Gin@nat@height\fi} \usepackage{longtable}
\makeatother
\let\Oldincludegraphics\includegraphics % alternate rowcolors for all long-tables
\renewcommand{\includegraphics}[1]{\Oldincludegraphics[width=\maxwidth, height=\maxheight, keepaspectratio]{#1}} \let\oldlongtable\longtable
\let\endoldlongtable\endlongtable
$if(subscript)$ \renewenvironment{longtable}{\rowcolors{2}{white}{shadecolor}\small\oldlongtable}{\endoldlongtable\normalsize}
\newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
$endif$ % Change style for first row
\let\oldtoprule\toprule
\renewcommand{\toprule}{\oldtoprule\rowcolor{white}}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $endif$
%%% Lang (TODO: clean this, without breaking)
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %% Images
\usepackage{caption,subcaption}
$if(lang)$ % Redefine \includegraphics so that, unless explicit options are
\ifxetex % given, the image width will not exceed the width or the height of the page.
\usepackage{polyglossia} % Images get their normal width if they fit onto the page, but
\newcommand{\euro}{€} % are scaled down if they would overflow the margins.
\setmainlanguage{$lang$} \makeatletter
\else \def\ScaleWidthIfNeeded{%
\usepackage{babel} \ifdim\Gin@nat@width>\linewidth
\usepackage{eurosym} 0.8\linewidth
\fi \else
$endif$ \Gin@nat@width
\fi
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \def\ScaleHeightIfNeeded{%
%%% List \ifdim\Gin@nat@height>0.9\textheight
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% 0.7\textheight
%\usepackage{enumitem} \else
\Gin@nat@width
$if(fancy-enums)$ \fi
% Redefine labelwidth for lists; otherwise, the enumerate package will }
% cause markers to extend beyond the left margin. \makeatother
\makeatletter\AtBeginDocument{%
\renewcommand{\@listi} \setkeys{Gin}{width=\ScaleWidthIfNeeded,height=\ScaleHeightIfNeeded,keepaspectratio}
{
\setlength{\labelwidth}{4em}
\leftmargin=25pt $if(subscript)$
\rightmargin=0pt \newcommand{\textsubscr}[1]{\ensuremath{_{\scriptsize\textrm{#1}}}}
\labelsep=7pt $endif$
\labelwidth=20pt
\itemindent=0pt
\listparindent=0pt
\topsep=2pt plus 2pt minus 2pt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\partopsep=0pt plus 1pt minus 10pt %%% Lang (TODO: clean this, without breaking)
\parsep=2pt plus 1pt %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\itemsep=\parsep
} $if(lang)$
}\makeatother \ifxetex
\usepackage{enumerate} \usepackage{polyglossia}
$endif$ \newcommand{\euro}{€}
\setmainlanguage{$lang$}
\setlength{\parindent}{0pt} \else
\setlength{\parskip}{6pt plus 2pt minus 1pt} \usepackage{babel}
\setlength{\emergencystretch}{3em} % prevent overfull lines \usepackage{eurosym}
\fi
$endif$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Chapters & Section %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% %%% List
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
% chapters %\usepackage{enumitem}
\usepackage{titlesec}
\titleformat{\chapter}[block] $if(fancy-enums)$
{\normalfont\HUGE\bfseries}{\LARGE\thechapter.}{1ex}{} % Redefine labelwidth for lists; otherwise, the enumerate package will
\titlespacing*{\chapter}{0pt}{-19pt}{0pt} % cause markers to extend beyond the left margin.
\makeatletter\AtBeginDocument{%
\renewcommand{\@listi}
% Sections {
$if(numbersections)$ \setlength{\labelwidth}{4em}
\setcounter{secnumdepth}{2} \leftmargin=25pt
$else$ \rightmargin=0pt
\setcounter{secnumdepth}{0} \labelsep=7pt
$endif$ \labelwidth=20pt
\itemindent=0pt
\listparindent=0pt
\let\oldsection\section \topsep=2pt plus 2pt minus 2pt
\renewcommand{\section}{\clearpage\oldsection} \partopsep=0pt plus 1pt minus 10pt
\parsep=1pt plus 1pt
\itemsep=\parsep
}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% }\makeatother
%%% Footer & Header \usepackage{enumerate}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $endif$
$if(verbatim-in-note)$ \setlength{\parindent}{0pt}
% allows verbatim text in footnotes \setlength{\parskip}{6pt plus 2pt minus 1pt}
$endif$ \setlength{\emergencystretch}{3em} % prevent overfull lines
\usepackage{fancyhdr}
\fancyhf{} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fancyhead[R]{\nouppercase{\leftmark}} %%% Chapters & Section
\fancyfoot[L]{ www.sevensols.com/whiterabbitsolution}% empty left %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\fancyfoot[L]{\raisebox{-25pt}{\includegraphics{logo.png}}}
\fancyfoot[C]{\raisebox{-15pt}{\small \url{www.sevensols.com/whiterabbitsolution}}} %Use by with \autoref
\fancyfoot[R]{\raisebox{-15pt}{\thepage}} \AtBeginDocument{%
\pagestyle{fancy} % Sets fancy header and footer \renewcommand{\chapterautorefname}{Chapter\negthinspace}
\renewcommand{\sectionautorefname}{\S\negthinspace}
\renewcommand{\subsectionautorefname}{\S\negthinspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand{\subsubsectionautorefname}{\S\negthinspace}
%% Bibliography \renewcommand{\figureautorefname}{Fig.\negthinspace}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \renewcommand{\subfigureautorefname}{Fig.\negthinspace}
\renewcommand{\tableautorefname}{Tab.\negthinspace}
$if(natbib)$ }
\usepackage{natbib}
\bibliographystyle{plainnat} % chapters
$endif$ \usepackage{titlesec}
$if(biblatex)$ \titleformat{\chapter}[block]
\usepackage{biblatex} {\normalfont\HUGE\bfseries}{\LARGE\thechapter.}{1ex}{}
$if(biblio-files)$ \titlespacing*{\chapter}{0pt}{-19pt}{0pt}
\bibliography{$biblio-files$}
$endif$
$endif$ % Sections
$if(numbersections)$
$else$
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% \newpage
%%% Title page (like texinfo) \setcounter{secnumdepth}{0}
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%% $endif$
$if(title)$ \usepackage{titlesec}
\title{$title$} \newcommand{\sectionbreak}{\clearpage}
$endif$ \let\oldthesection=\thesection
$if(author)$
\author{$for(author)$$author$$sep$ \and $endfor$} %% Paragraph (adding new line)
$endif$ \titleformat{\paragraph}[hang]{\normalfont\normalsize\bfseries}{\theparagraph}{1em}{}
$if(date)$ \titlespacing*{\paragraph}{0pt}{3.25ex plus 1ex minus .2ex}{0.5em}
\date{$date$}
$endif$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%%% Footer & Header
\makeatletter %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
\def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@}
\renewcommand{\maketitle}{\begin{titlepage}% $if(verbatim-in-note)$
\let\footnotesize\small % allows verbatim text in footnotes
\let\footnoterule\relax $endif$
\parindent \z@
\reset@font $if(weburl)$
\null\vfil \newcommand{\weburl}{\url{$weburl$}}
\begin{flushleft} $else$
\Huge \textbf{\@title} \newcommand{\weburl}{\url{www.sevensols.com}}
\end{flushleft} $endif$
\par
\hrule height 4pt \usepackage{fancyhdr}
\par \fancyhf{}
\begin{flushright}
\large \@date \par %% Header
\end{flushright} \fancyhead[L]{\raisebox{0pt}{\includegraphics[height=7mm]{logo.png}}}
\vskip 500\p@ \fancyhead[R]{\small \nouppercase{\leftmark}}
\vfil\null \renewcommand{\headrulewidth}{1pt}
\begin{flushleft}
\Large \textbf{\@author} %% Footer
\end{flushleft} \renewcommand{\footrulewidth}{1pt}
\hrule height 2pt \fancyfoot[L]{{\scriptsize \bfseries $title$ - $subtitle$} \\ \raisebox{5pt}{\tiny $date$}}
\end{titlepage}% \fancyfoot[C]{\raisebox{0pt}{\small \weburl }}
\setcounter{footnote}{0}% \fancyfoot[R]{\raisebox{0pt}{\scriptsize \thepage}}
}
\makeatother
\usepackage{etoolbox}
%======================================================================% \makeatletter
%======================================================================% %\patchcmd{\@fancyhead}{\rlap}{\color{sevensolsblue}\rlap}{}{} %%text
%\patchcmd{\@fancyfoot}{\rlap}{\color{sevensolsblue}\rlap}{}{} %%text
\begin{document} \patchcmd{\headrule}{\hrule}{\color{sevensolsblue}\hrule}{}{} %%line
\patchcmd{\footrule}{\hrule}{\color{sevensolsblue}\hrule}{}{} %%line
$if(title)$ \makeatother
\maketitle
$endif$ \pagestyle{fancy} % Sets fancy header and footer
$for(include-before)$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$include-before$ %% Bibliography
$endfor$ %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$if(toc)$ $if(natbib)$
\setcounter{tocdepth}{2} \usepackage{natbib}
\tableofcontents \bibliographystyle{plainnat}
\clearpage $endif$
$endif$ $if(biblatex)$
\usepackage{biblatex}
$body$ $if(biblio-files)$
\bibliography{$biblio-files$}
$if(natbib)$ $endif$
$if(biblio-files)$ $endif$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$else$ %%% Title page (like texinfo)
\renewcommand\refname{$biblio-title$} %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
$endif$
$endif$ \DeclareFixedFont{\bigsf}{T1}{phv}{b}{n}{1.5cm}
\bibliography{$biblio-files$}
$endif$ $if(title)$
$endif$ \title{$if(title-prefix)$\huge{$title-prefix$}\\\vspace{5mm}$endif${\bigsf $title$}}
$if(biblatex)$ $endif$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$ $if(author)$
$endif$ \author{$for(author)$$author$$sep$, $endfor$}
$endif$
$for(include-after)$ $if(date)$
$include-after$ $if(version)$
$endfor$ \date{v$version$: $date$}
$else$
\end{document} \date{$date$}
$endif$
$endif$
\makeatletter
\def\thickhrulefill{\leavevmode \leaders \hrule height 1pt\hfill \kern \z@}
\renewcommand{\maketitle}{\begin{titlepage}%
\let\footnotesize\small
\let\footnoterule\relax
\parindent \z@
\reset@font
\null\vfil
\begin{flushleft}
\Huge \textbf{\@title}
\end{flushleft}
\par
\hrule height 4pt
\par
\begin{flushright}
\large \@date \par
\end{flushright}
\vskip 500\p@
\vfil\null
\begin{flushleft}
\Large \textbf{\@author}
\end{flushleft}
\hrule height 2pt
\end{titlepage}%
\setcounter{footnote}{0}%
}
\makeatother
%======================================================================%
%======================================================================%
\begin{document}
\renewcommand{\familydefault}{\sfdefault}
$if(title)$
\maketitle
$endif$
$for(include-before)$
$include-before$
$endfor$
$if(toc)$
\setcounter{tocdepth}{2}
\tableofcontents
\clearpage
$endif$
$body$
$if(natbib)$
$if(biblio-files)$
$if(biblio-title)$
$if(book-class)$
\renewcommand\bibname{$biblio-title$}
$else$
\renewcommand\refname{$biblio-title$}
$endif$
$endif$
\bibliography{$biblio-files$}
$endif$
$endif$
$if(biblatex)$
\printbibliography$if(biblio-title)$[title=$biblio-title$]$endif$
$endif$
$for(include-after)$
$include-after$
$endfor$
\end{document}
\ No newline at end of file
% WR SPEC Starting Kit \renewcommand{\thesection}{}
% Benoit RAT, Javier Diaz (Seven Solutions) & Miguel Jimenez (UGR)
Copyright
### Copyright ==============
This document is copyrighted (under the Berne Convention) by Seven This document is copyrighted (under the Berne Convention) by Seven
Solutions company and is formally licensed to the public under **GPL v2.0** license. Solutions company and is formally licensed to the public under **GPL v2.0** license.
...@@ -11,11 +10,12 @@ Report content can be copied, modified, and redistributed. ...@@ -11,11 +10,12 @@ Report content can be copied, modified, and redistributed.
The Seven Solutions Logo can not be modified in any form, or by any means without prior The Seven Solutions Logo can not be modified in any form, or by any means without prior
written permission by Seven Solutions. written permission by Seven Solutions.
### Licenses Licenses
===============
~~~~~~~ ~~~~~~~
The "WR SPEC Starting Kit" (as defined above) is provided under the terms of GPL v2.0 The "WR SPEC Starting Kit" (as defined above) is provided under the terms of GPL v2.0
Copyright (C) 2013 - Seven Solutions Copyright (C) 2019 - Seven Solutions
This program is free software; you can redistribute it and/or This program is free software; you can redistribute it and/or
modify it under the terms of the GNU General Public License modify it under the terms of the GNU General Public License
...@@ -52,7 +52,8 @@ conditions ...@@ -52,7 +52,8 @@ conditions
### Revision table Revision table
===============
------------------------------------------------------------------------ ------------------------------------------------------------------------
...@@ -65,13 +66,75 @@ conditions ...@@ -65,13 +66,75 @@ conditions
[Seven Solutions] [Seven Solutions]
2.0 15/05/2014 Benoit Rat\ Updating for v2.0 release 2.0 15/05/2014 Benoit Rat\ Updating for v2.0 release
[Seven Solutions]
3.0 06/11/2019 Manuel Castilla\ Updating for v3.0 release
Benoit Rat\
Francesco Colella\
[Seven Solutions] [Seven Solutions]
------------------------------------------------------------------------ ------------------------------------------------------------------------
You can also check the [Changelog section](#changelog) for more information. You can also check the [Changelog section](#changelog) for more information.
Glossary
===========
NIC
: Network Interface Card
DIO
: Digital Input/Output
PTP
: Precise Time Protocol, a time synchronization protocol
EEPROM
: Electrically Erasable Programmable Read-Only Memory, a non-volatile memory
FMC
: FPGA Mezzanine Card, an ANSI standard for mezzanine card form factor.
LEMO
: LEMO is the name of a push-pull connectors made by the LEMO company.
SFP
: Small form-factor pluggable transceiver, a hot-pluggable transceiver for optical fiber
PCIe
: Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard
LM32
: LatticeMico32 is a 32-bit microprocessor soft core optimized for field-programmable gate arrays (FPGAs).
HDL
: Hardware description language
SPEC
: Simple PCIe FMC carrier
UART
: Universal Asynchronous Receiver/Transmitter
WB
: Whishbone Bus, an open system bus interconnect architecture designed for reuse
WRC / WRPC
: White Rabbit (PTP) Core, the main funcionality shared by all WR elements.
WR
: White Rabbit
WRS
: White Rabbit Switch
\clearpage \clearpage
\renewcommand{\thesection}{\oldthesection}
\setcounter{section}{0}
Introduction Introduction
============= =============
...@@ -85,48 +148,49 @@ conceived to fulfill the following goals:\ ...@@ -85,48 +148,49 @@ conceived to fulfill the following goals:\
Time Precision Time Precision
: The [WR] technology provides a common clock for physical layer in the entire network, allowing synchronization at sub-nanosecond accuracy with picoseconds precision. : The [WR] technology provides a common clock for physical layer in the entire network, allowing synchronization at sub-nanosecond accuracy with picoseconds precision.
Scalability Scalability
: The [WR] network is designed to be highly scalable up to thousands of nodes. It also intends to be as modular as possible and compatible with non-[WR] devices. Finally, all products related to this technology available at the Open Hardware Repository ([OHWR]) represent “open developments”, i.e. all the hardware designs, firmware and software and documentation are fully available. This shall facilitate the new incremental developments and customization of the available designs and products. : The [WR] network is designed to be highly scalable up to thousands of nodes. It also intends to be as modular as possible and compatible with non-[WR] standard Ethernet devices. Finally, all products related to this technology available at the Open Hardware Repository ([OHWR]) represent “open developments”, i.e. all the hardware designs, firmware and software and documentation are fully available. This shall facilitate the new incremental developments and customization of the available designs and products.
Distance Range Distance Range
: Taking into account the size and ranges of the majority of industrial and scientific facilities, the [WR] network specifications have been chosen to support distance ranges of 10 km between nodes using fiber cables.\ : Taking into account the size and ranges of the majority of industrial and scientific facilities, the [WR] network specifications have been chosen to support distance ranges of 10 km between [WR] network elements(nodes or switches) using fiber cables.
The **Starting Kit** has been designed to test and check if the White The **WR Starting Kit** has been designed to test and check if the White
Rabbit technology meets your requirements. It shall also facilitate the Rabbit technology meets your requirements. It shall also facilitate the
understanding on the technology capabilities and possibilities. understanding on the technology capabilities and possibilities.
WR starting kit can also be used to evaluate what can be done with it WR Starting kit can also be used to evaluate what can be done with it
and how to integrate it on your own project. and how to integrate it on your own project.
You can find more information on other components and use cases on: You can find more information on other components and use cases on:
* Our webpage <http://www.sevensols.com/whiterabbitsolution/> * Our webpage <http://www.sevensols.com/>
* The official wiki page <http://www.ohwr.org/projects/white-rabbit/wiki> * The official wiki page <http://www.ohwr.org/projects/white-rabbit/wiki>
About the Starting Kit About the WR Starting Kit
---------------------------------- ----------------------------------
This starting kit uses two nodes, each one composed of a [SPEC] and one This WR Starting Kit uses two nodes, each one composed of a [SPEC] and one
[FMC-DIO] card. [FMC-DIO] card.
A node makes basic operations such as input timestamping or programmable output pulse generation. A node makes basic operations such as input time-stamping or programmable output pulse generation.
Additionally, specific software and gateware layers allow to use it as a standard network Additionally, specific software and gateware layers allow to use it as a standard network
interface card implementing the White Rabbit technology functionalities. interface card implementing the White Rabbit technology functionalities.
Network packages with accurate time-stamping information are generated/timestamped at Network packages with accurate time-stamping information are generated/timestamped at
the hardware level to achieve the highest accuracy. the hardware level to achieve the highest accuracy.
It is based on different projects: This WR Starting Kit is based on different projects:
* [spec-sw]: driver to communicate to the [SPEC] card through PCIe. It * [spec-sw], driver to communicate to the [SPEC] card through PCIe. It
also includes a set of tools to experiments. also includes a set of tools to experiments.
* [wr-nic]: gateware that includes the NIC & DIO capabilities. * [wr-nic], gateware/software that includes the Network Interface Card(NIC) capabilities.
* [wrpc-sw]: white rabbit PTP firmware for the synchronization. * [fmc-dio-5chttla], gateware/software that includes the support for FMC-DIO 5ch TTL
* [wrpc-sw], White Rabbit PTP firmware for the synchronization.
About this document: About this document
-------------------- --------------------
This document is intended to be a step by step user friendly tutorial This document is intended to be a step by step user friendly tutorial
...@@ -134,11 +198,7 @@ to start with the White Rabbit technology. It includes the description ...@@ -134,11 +198,7 @@ to start with the White Rabbit technology. It includes the description
of some simple experiments to illustrate [WR] capabilities. Some of some simple experiments to illustrate [WR] capabilities. Some
concepts are deliberately avoided to ease the comprehension of this document. concepts are deliberately avoided to ease the comprehension of this document.
If you want to know more about these concepts, please access to the If you want to know more about these concepts, please access to the
related documents in the [Reference section](#references) related documents in the [Reference section](#references).
and especially to the following ones:
* [spec-sw.pdf]
* [wrpc.pdf]
The rest of the document provides an explanation about the system setup, software driver, FPGA configuration and The rest of the document provides an explanation about the system setup, software driver, FPGA configuration and
some application examples. some application examples.
...@@ -153,19 +213,41 @@ the different source projects and how to compile them. ...@@ -153,19 +213,41 @@ the different source projects and how to compile them.
Changelog Changelog
----------------- -----------
In this section, we resume the main changes that happens at each release of the starting-kit In this section, we resume the main changes that happens at each release of the starting-kit
### wr-starting-kit-v3.0
This release has been focused to update all different modules constituting WR Starting Kit to use their newer release versions. This release does not provide specific updates to the features or functionalities of the WR Starting Kit.
* Update spec-sw with new VIC core to support kernels (v4.15-v4.18)
* Use new wr-core v4.2 with their update tools (see changelog of wrc-v4.2)
* Separate NIC, FMC-DIO, SPEC-SW into different modules
* Update submodules to work with new ohwr gitlab URL
* Remove etherbone support to avoid conflict in epfilters
A detailed changelog can be found on the wiki page of each submodules:
* [wr-nic-v2.0.1-1](https://www.ohwr.org/project/wr-nic/tags)
* [fmc-bus-v2017-06](https://www.ohwr.org/project/fmc-bus/tags)
* [spec-sw-v2017-10-19](http://www.ohwr.org/projects/spec-sw/tags)
* [coht-vic-v1.2.2-3](https://www.ohwr.org/project/coht-vic/tags)
* [fmc-dio-5chttla-v3.0](https://www.ohwr.org/project/fmc-dio-5chttla/tags)
* [wrpc-v4.2](https://www.ohwr.org/project/wr-cores/wikis/Documents/WR-PTP-Core-v4.2-Files)
* [ppsi-v2016.12-91](https://www.ohwr.org/project/ppsi/tags)
### wr-starting-kit-v2.0 ### wr-starting-kit-v2.0
* The driver now support kernel from 2.8.x to 3.5.x * The driver now support kernel from 2.8.x to 3.5.x
* A valid EEPROM data is now **mandatory** in order to start the kernel * A valid EEPROM data is now **mandatory** in order to start the kernel
* The gateware is now accesible remotely/standalone through ethernet using etherbone core. * The gateware is now accessible remotely/standalone through ethernet using etherbone core.
* First DIO channel output is now reserved for outputing PPS * First DIO channel output is now reserved for outputting PPS
* PPSi has been introduced to improve compatibility with other PTP devices. * PPSi has been introduced to improve compatibility with other PTP devices.
* GrandMaster locking has been improved * GrandMaster locking has been improved
* FMC bus has been updated to the stable version which is officialy included in linux kernel (>3.5) * FMC bus has been updated to the stable version which is officially included in linux kernel (>3.5)
* Calibration has been improved using t42p procedure * Calibration has been improved using t42p procedure
...@@ -183,53 +265,48 @@ System Setup ...@@ -183,53 +265,48 @@ System Setup
=========== ===========
This section describes the main elements required to start with the White-Rabbit based This section describes the main elements required to start with the White-Rabbit based
on the *"White Rabbit (SPEC-based) starting kit"*. The different on the *"White Rabbit (SPEC-based) Starting Kit"*. The different
hardware elements and theirs connections are described in this section. hardware elements and theirs connections are described in this section.
What do you need? What do you need?
---------------- ----------------
In order to use the white rabbit starting kit and setup the different In order to use the WR Starting Kit and setup the different
experiments you will need: experiments you will need:
* An oscillocope with at least 150Mhz bandwitdh (500Mhz is recommanded). * An oscilloscope with at least 150Mhz bandwidth (500Mhz is recommended).
* A PC with at least two `PCIe x4` ports (`x8` & `x16` are also compatible) * Two PCs with at least one `PCIe x4` port (`x8` & `x16` are also compatible). The use of two PCs is recommended because in some cases there are problems using a PC with 2xPCIe in several kernels.
* The Operative System **Ubuntu LTS 32bit (Long Term Support)** installed. * The Operative System **Ubuntu LTS 64bit (Long Term Support)** installed.
* Two mini-USB (B) cables (not provided with the kit). * Two mini-USB (B) cables (not provided with the kit).
This tutorial has been tested and verified with Ubuntu LTS 12.04 and Ubuntu LTS 14.04, This tutorial has been tested and verified with Ubuntu LTS 16.04.6 (kernel v.4.15.9) and Ubuntu LTS 18.04.2 (kernel v.4.18.0-17), this mean that **standard support will only be given for these releases**.
this mean that standard support will only be given for these releases. However, the `spec-sw` driver should work with other releases, distributions and architectures.
However, the `spec-sw` driver should work with other releases, distributions and architectures
that run kernel `2.8.x` to `3.13.x`.
Finally, [Seven Solutions] also provides a fully setup PC or USB-live images to skip > ***Notes:*** Ubuntu 18.04 LTS is supported but some versions like 18.04.1 or 18.04.3 (with kernel version 5.0) does not work correctly unless you [set a previous kernel version](#Set-Previous-Kernel-Version).
the instalation process and ease the introduction to the *"White Rabbit World"*.
> ***Note:*** This tutorial follow a configuration with two [SPEC+FMCDIO] boards connected in the two **PCIe x16** interfaces of the same computer. However, you can also use two different computers (if you do not have two **PCIe x4**) and follow this tutorial; you just need to replace all the commands with `wr1` or `0x0300` by the `wr0` and its corresponding bus_id on the second PC. The configuration with two separated PCs is more *"natural"* to understand how to communicate two different nodes using the starting kit, > ***Warning:*** Ubuntu LTS 14.04 is not supported.
but it requires more physical space to implement it.
![Configuration with one or two PCs](img/ssk_configs.png) ![Configuration with one two PCs](img/ssk_configs.png)
Starting kit components WR Starting Kit components
----------------- -----------------
The starting kit is composed of various elements that you should find The WR Starting Kit is composed of various elements that you should find
in the package[^standardssk] : in the package[^standardssk] :
* 2x [SPEC]s boards * 2x [SPEC]s boards
* 2x [FMC-DIO]s 5CH TTL A * 2x [FMC-DIO]s 5CH TTL A
* 2x SFPs LC * 2x SFPs LC
* AXGE-1254-0531 (blue) * AXGE-1254-0531 (blue)
* AXGE-3454-0531 (violet) * AXGE-3454-0531 (violet)
* 1x LC-LC cable (2m) * 1x LC-LC cable (2m)
* 3x LEMO cable (2m) * 3x LEMO cable (2m)
* 3x LEMO-BNC Adaptor * 3x LEMO-BNC Adaptor
* 1x Pre-installed live-USB (Ubuntu 14.04)
![The components of the starting kit](img/ssk_components.jpg) ![The components of the WR Starting Kit](img/ssk_components.jpg)
[^standardssk]: Only with the standard version of starting kit. [^standardssk]: Only with the standard version of WR Starting Kit.
Physical setup Physical setup
...@@ -241,51 +318,28 @@ Physical setup ...@@ -241,51 +318,28 @@ Physical setup
(A Virtual UART is also available, but it is safer to use the physical (A Virtual UART is also available, but it is safer to use the physical
one). one).
* Connect the two [SPEC+FMCDIO] boards using the SFPs and the optical fiber cable (LC-LC) * Connect the two [SPEC+FMCDIO] boards using the SFPs and the optical fiber cable (LC-LC)
* In the demo we have put the violet SFP on the top SPEC board (wr0) * In the demo we have put the violet SFP on the PC01 SPEC board (wri1)
* ... and the blue SFP below (wr1) * ... and the blue SFP on the PC02 (wri1)
* Start Ubuntu LTS. * Start Ubuntu LTS.
* Prepare an oscilloscope with at least two input channels to access * Prepare an oscilloscope with at least two input channels to access
the [FMCDIO] outputs. the [FMCDIO] outputs.
![Mounting two SPECs in the same PC](img/ssk_inside.jpg) ![Mounting two SPECs in two PC](img/ssk_inside.jpg)
![Connecting SFPs and fiber](img/ssk_sfp.jpg) ![Connecting SFPs and fiber](img/ssk_sfp.jpg)
![The UART use a mini-USB cable to communicate](img/ssk_usb.jpg) ![The UART use a mini-USB cable to communicate](img/ssk_usb.jpg)
Pre-Installed Live-USB
========================
In our latest WR package we also provide a Live-USB (Ubuntu 14.04) pendrive with
the drivers & tools pre-installed.
In order to run the Live-USB from the pendrive you need to modify the
BIOS of your PC to enable booting from USB.
In the most recent BIOS you will find a `Boot options menu` by pressing
tipically `F10`, `F11` or `F12` during the startup of the PC.
Otherwise you might need to modify the Boot priority in the BIOS Configuration. To do so restart your computer, and watch for a message telling you which key to press to enter the BIOS setup. It will usually be one of F1, F2, DEL, ESC or F10. Press this key while your computer is booting to edit your BIOS settings. Once you are in the BIOS configuration, look for something similar as `Boot` > `Boot Order`. You should see an entry for `removable drive` or `USB media`. Move this to the top of the list to make the computer attempt to boot from the USB device before booting from the hard disk. If you still having trouble do perform this step please search on the web how to `Boot from USB` using your BIOS manufacturer as keyword in the research.
Once Ubuntu has started you should select your own language, and click
the `Try Ubuntu Live` options, then you can go directly to the
[Setting Master & Slave using White Rabbit Core Section](#setting-master-slave-using-white-rabbit-core)
If you prefer to use the WR Starting Kit with your own PC you need to
follow the installation steps in the [next section](#installation).
Installation Installation
======================= =======================
> Notes: If you are running the Live-USB pendrive you should skip this
section.
Once you have your system running with the boards plugged, you need to: Once you have your system running with the boards plugged, you need to:
* Check that the boards has been detected * Check that the boards has been detected
* Install the tools to build drivers, etc... * Install the tools to build drivers, etc...
* The drivers : `spec-sw` * The drivers : `spec-sw`, `fmc-dio-5chttla`, `wr-nic`
* The HDL bitstream of [SPEC+FMCDIO]: `wr-nic`
SPEC detection SPEC detection
...@@ -300,13 +354,13 @@ First you should check that the boards has been correctly detected on your PCIe ...@@ -300,13 +354,13 @@ First you should check that the boards has been correctly detected on your PCIe
You should obtain something similar as: You should obtain something similar as:
~~~~~{.sh} ~~~~~{.sh}
05:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03) 01:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03)
0b:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03)
~~~~~~~~~~ ~~~~~~~~~~
Where `05` and `0b` represent the ID of the PCIe slot given by your motherboard. Where `01` represent the ID of the PCIe slot given by your motherboard.
> **Note**: The PCIe slot numbering are normally ordered from top to bottom on the motherboard, > **Note**: The PCIe slot numbering are normally ordered from top to bottom on the motherboard,
this mean that the board with ID `05` will be above the one with index `0b`. this mean that the board with ID `01` will be above.
Tools Tools
...@@ -319,25 +373,26 @@ Then you need to install all the tools that you will need: ...@@ -319,25 +373,26 @@ Then you need to install all the tools that you will need:
* **linux-source**: Might be useful to compile drivers & kernel modules * **linux-source**: Might be useful to compile drivers & kernel modules
* **minicom**: Hyperterminal for linux * **minicom**: Hyperterminal for linux
* **texinfo, texlive, emacs**: Tools to build documentation * **texinfo, texlive, emacs**: Tools to build documentation
* **lib**: libreadline-dev
You can also run this command[^debian] for minimal setup: You can also run this command[^debian] for minimal setup:
~~~~{.sh} ~~~~{.sh}
sudo apt-get install git build-essential linux-headers-$(uname -r) minicom sudo apt-get install git build-essential python-minimal wget libreadline-dev linux-headers-$(uname -r) minicom
~~~~~~~~~ ~~~~~~~~~
and this one if you also want to generate documentation (not mandatory): and this one if you also want to generate documentation (not mandatory):
~~~~{.sh} ~~~~{.sh}
sudo apt-get install texinfo emacs texlive pandoc sudo apt-get install texinfo emacs texlive-xetex pandoc
~~~~~~~~~ ~~~~~~~~~
[^debian]: This sample command is for debian's like distributions. [^debian]: This sample command is for debian's like distributions.
However similar packages exist for other distributions. However similar packages exist for other distributions.
Install the project Compile & Install the project
------------------- -------------------
The first step is to install the driver to communicate with the card using The first step is to install the driver to communicate with the card using
...@@ -350,28 +405,14 @@ includes the [spec-sw] project. ...@@ -350,28 +405,14 @@ includes the [spec-sw] project.
>:$ cd ~/wr/ >:$ cd ~/wr/
## Clone the repository ## Clone the repository
>:$ git clone git://ohwr.org/white-rabbit/wr-starting-kit.git >:$ git clone https://ohwr.org/project/wr-starting-kit.git
>:$ cd wr-starting-kit >:$ cd wr-starting-kit
## Checkout the stable release ## Checkout the stable release
>:$ git checkout -b wr-starting-kit-v2.0 wr-starting-kit-v2.0 >:$ git checkout -b wr-starting-kit-v3.0 wr-starting-kit-v3.0
~~~~~~~~~~~~
Then you can get the project submodule by running
~~~~{.sh}
## Obtain the spec-sw project using submodules
>:$ git submodule init
>:$ git submodule update
## Update submodule of spec-sw
>:$ cd spec-sw
>:$ git submodule init
>:$ git submodule update
>:$ cd -
~~~~~~~~~~~~ ~~~~~~~~~~~~
Or you can try our new Makefile that should perform everything! Now you should execute the Makefile that should perform everything!
~~~~{.sh} ~~~~{.sh}
>:$ make >:$ make
...@@ -382,132 +423,6 @@ Or you can try our new Makefile that should perform everything! ...@@ -382,132 +423,6 @@ Or you can try our new Makefile that should perform everything!
The **master** branch might have the latest source but support is only offered for tagged release. The other branches are normally used for development and are not stable. The **master** branch might have the latest source but support is only offered for tagged release. The other branches are normally used for development and are not stable.
Structure of the spec-sw project
---------------------------------
Most of the information on how the project is structured can be found in the [spec-sw.pdf] in the `/doc` folder,
however in the following paragraphs we briefly summarize it:
### Folders layout
Each of the following folders contain:
* **doc**: documentation of the project
* **gateware**: downloaded HDL binaries also called gateware.\
(This folder is created while downloading gateware)
* **kernel**: Kernel modules (drivers) to connect the [SPEC] to the PC through PCIe.
* **tools**: Set of tools used for the experiments in the Starting Kit
### Structure of the driver and HDL
The Starting Kit contains 3 different drivers:
* **fmc.ko**: Define a generic FMC-bus[^fmc-bus] used to identify and connect to FMC boards independently
of the carrier being used (e.g. [SPEC], SVEC, ...)
* **spec.ko**: It is the device driver that connects to the [SPEC] through PCI. It also loads the spec-init.bin “golden” gateware file.
* **wr-nic.ko**: The wr-nic driver is basically an Ethernet driver with
support for hardware time stamping. It also loads the following:
* `fmc/wr_nic_dio.bin` gateware for the NIC and DIO properties.
* `fmc/wr_nic_dio-wrc.bin` software for the LM32[^lm32inc].
[^fmc-bus]: More information about the [FMC]-bus can be found within [fmc-bus.pdf] in the `doc/` folder.
[^lm32inc]: In future version, the program file for the LM32 will be included into the gateware.
Compile & install
------------------------
A Makefile in the [spec-sw] project has been written to compile and install easily the drivers and the tools used below.
~~~~{.sh}
## Go to spec-sw project
>:$ cd spec-sw
## In the root folder (spec-sw), run
>:$ make
## then, install the driver in your system so that they load automatically
>:$ sudo make install
~~~~~~~~~~~
If everything works well you should see the driver in
~~~~{.sh}
>:$ ls -l /lib/modules/$(uname -r)/extra
~~~~~~~~~~~
> ***Notes:*** The procedure below is specific to ubuntu distribution so you
might want to find a similar way to perform it if you use another
distribution.
You should add the `extra` folder to the search of module so that at
next reboot the kenel modules are easily founded.
~~~~{.sh}
## Open the configuration file
>:$ sudo nano /etc/depmod.d/ubuntu.conf
~~~~~~~~~~~
Check if you already have the extra folder or otherwise add the `extra` keyword
before built-in.
The first line of this file should now be similar as:
search updates ubuntu extra built-in
Finally, you must regenerate the map of dependencies with this new path
by calling:
~~~~{.sh}
>:$ sudo depmod -a
~~~~~~~~~~~
Download, install & load the gateware
--------------------------------------
You need to install the gateware[^version] to `/lib/firmware/fmc`
### Automatic procedure
You can also use the script `wr-ssk-get` in `wr-starting-kit/scripts` folder
to ease the installation. `sudo` is required
~~~~{.sh}
## Fetch and install the firmware
>:$ sudo scripts/wr-ssk-get --all
~~~~~~~~~~~~~~
### Manual procedure
First you need to download the gateware/firmware files from our website:
<http://www.sevensols.com/dl/wr-starting-kit/bin/latest_stable.tar.gz>
~~~~{.sh}
## Create the gateware folder
>:$ mkdir firmware
## Extract to the gateware folder
>:$ tar -xzf wr-starting-kit-v2.0_gw.tar.gz -C ./firmware
~~~~~~~~~~~
Once you have the file you need to install them to your system in order to make them load automatically
~~~~{.sh}
## Install the HDL binaries in /lib/firmware/fmc (require sudo)
>:$ sudo cp -v firmware/*.bin /lib/firmware/fmc
~~~~~~~~~~~~~
[^version]: The HDL binaries (gateware) came from other project, you can find in
the [Developers Section](#quick-start-guide-for-developers) where to obtain them and
how to compile them.
Loading the driver Loading the driver
------------------------ ------------------------
...@@ -515,7 +430,9 @@ To enable the wr-nic you should execute the modprobe[^errmodprobe] command to lo ...@@ -515,7 +430,9 @@ To enable the wr-nic you should execute the modprobe[^errmodprobe] command to lo
~~~~{.sh} ~~~~{.sh}
>:$ sudo modprobe spec >:$ sudo modprobe spec
>:$ sudo modprobe htvic
>:$ sudo modprobe wr-nic >:$ sudo modprobe wr-nic
>:$ sudo modprobe wr-dio
~~~~~~~~ ~~~~~~~~
[^errmodprobe]: We have found a problem in some distribution with `modprobe` command. [^errmodprobe]: We have found a problem in some distribution with `modprobe` command.
...@@ -526,7 +443,7 @@ You should expect to obtain two (or one) new interface(s): ...@@ -526,7 +443,7 @@ You should expect to obtain two (or one) new interface(s):
~~~~{.sh} ~~~~{.sh}
>:$ ifconfig -a | grep wr >:$ ifconfig -a | grep wr
wr0 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX wri1 Link encap:Ethernet HWaddr XX:XX:XX:XX:XX:XX
~~~~~~~~~~~~ ~~~~~~~~~~~~
If it is not the case you might have an empty EEPROM that need to be If it is not the case you might have an empty EEPROM that need to be
...@@ -536,7 +453,7 @@ written with proper value as explained in the next section. ...@@ -536,7 +453,7 @@ written with proper value as explained in the next section.
Creating Valid EEPROM Creating Valid EEPROM
---------------------- ----------------------
> ***Notes***: If you already have the new interfaces wrX while doing > ***Notes:*** If you already have the new interfaces wrX while doing
`ifconfig`, this mean that you can **skip** this section. `ifconfig`, this mean that you can **skip** this section.
On older manufactured [FMC-DIO] (before 2014), the EEPROM was not On older manufactured [FMC-DIO] (before 2014), the EEPROM was not
...@@ -555,92 +472,57 @@ you might obtain the following warning on `dmesg`: ...@@ -555,92 +472,57 @@ you might obtain the following warning on `dmesg`:
~~~~~{.sh} ~~~~~{.sh}
>:$ dmesg >:$ dmesg
... ...
spec 0000:05:00.0: FPGA programming successful [ 7.824668] spec 0000:01:00.0: mezzanine 0
spec 0000:05:00.0: mezzanine 0 [ 7.824669] EEPROM has no FRU information
EEPROM has no FRU information ...
~~~~~~~~~~ ~~~~~~~~~~
This information, called the FRU, contains the type of FMC board, its serial number, etc. This information, called the FRU, contains the type of FMC board, its serial number, etc.
You can generate in two different way: In order to write it in case you have an old FMC board without any EEPROM written,
you should execute the following commands
### Automatic
A small script has been created for this procedure and thus you just need to call it as below:
scripts/wr-ssk-get -w
Then the script will detect if you have one or more [FMC-DIO] with empty
eeprom. If it is the case it will ask to enter a S/N.
> ***Tip***: The S/N is labeled on the back side of the
[FMC-DIO] board and the index of PCIe slots on the bus "normally" respect
the physical plug order from top to bottom on the motherboard.
If for instance you have one with the label `7S-FMCDIO5ch-v1.0-S3-058` and
you can't read the label on the second one, we suggest you to fill the input as below:
Found 2 FMC board(s) with empty EEPROM
Enter S/N for board fmc-0500 in the format xx-XXX (or 0) : 03-058
...
Enter S/N for board fmc-0b00 in the format xx-XXX (or 0) : 0
### Manual Don't forget to modify the bus id: `FmcDio5cha-XXXX` and the S/N
`7S-DIO-v2-Sxx-XXX` with your specific devices setup.
If you prefer to perform these steps manually you can try the
following procedure:
~~~~~{.sh} ~~~~~{.sh}
##First you need to go in the fru-generator folder ##First you need to go in the fru-generator folder
>:$ cd spec-sw/fmc-bus/tools/ >:$ cd wr-starting-kit/spec-sw/fmc-bus/tools/
## And compile the library ## And compile the library
>:$ make >:$ make
## Then, find out on which bus id you have the boards ## Then, find out on which bus id you have the boards
>:$ ls /sys/bus/fmc/devices/ >:$ ls /sys/bus/fmc/devices/
fmc-0500 fmc-0b00 fmc-0100
### Enter root mode in the terminal ### Enter root mode in the terminal
>:$ sudo bash >:$ sudo bash
## Write the eeprom for fmc-0500: the first/the top one fmc board. ## Write the eeprom for fmc-0100: the first/the top one fmc board.
>:# FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-DIO-v2-S03-058 > /sys/bus/fmc/devices/fmc-0500/eeprom
## Write the eeprom for fmc-0b00: the 2nd/the bottom one fmc board.
>:# FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \ >:# FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-DIO-v2-S00-000 > /sys/bus/fmc/devices/fmc-0b00/eeprom ./fru-generator -s 7S-DIO-v2-S03-058 > /sys/bus/fmc/devices/fmc-0100/eeprom
## Finally, Go back to user and starting-kit root directory ## Finally, Go back to user and starting-kit root directory
>:# exit >:# exit
>:$ cd - >:$ cd -
~~~~~~~~~~ ~~~~~~~~~~
Don't forget to modify the bus id: `fmc-XXXX` and the S/N
`7S-DIO-v2-Sxx-XXX` with your specific devices setup.
### Reload the kernel driver ### Reload the kernel driver
Once you have correctly written (Auto or Manual) the EEPROM of the [FMC-DIO], you need Once you have correctly written the EEPROM of the [FMC-DIO], you need
to reload the kernel driver by doing this to reload the kernel driver by reboot the PC
~~~~{.sh} ~~~~{.sh}
>:$ sudo rmmod spec >:$ sudo reboot
>:$ sudo modprobe spec
~~~~~~~~~~ ~~~~~~~~~~
you should now obtain something like this on `dmesg`: you should now obtain something like this on `dmesg`:
~~~~~{.sh} ~~~~~{.sh}
... ...
[269290.520027] spec 0000:05:00.0: mezzanine 0 [ 10.901519] spec 0000:01:00.0: mezzanine 0
[269290.520035] Manufacturer: CERN [ 10.901521] Manufacturer: CERN
[269290.520038] Product name: FmcDio5cha [ 10.901521] Product name: FmcDio5cha
...
[269291.086221] spec 0000:0b:00.0: mezzanine 0
[269291.086228] Manufacturer: CERN
[269291.086230] Product name: FmcDio5cha
... ...
~~~~~~~~ ~~~~~~~~
...@@ -679,7 +561,7 @@ This depends on how you have plugged the USB cable to your USB of your machine. ...@@ -679,7 +561,7 @@ This depends on how you have plugged the USB cable to your USB of your machine.
### Virtual UART ### Virtual UART
An easier way to perform this operation is to access to the virtual An easier way to perform this operation is to access to the virtual
UART of the [SPEC] board by using the spec-vuart tool. UART of the [SPEC] board by using the wrpc-vuart tool.
You first need to know the `bus_id` of your board You first need to know the `bus_id` of your board
> ***Notes:*** The VUART can not work if the USB is already connected as the Physical UART > ***Notes:*** The VUART can not work if the USB is already connected as the Physical UART
...@@ -687,34 +569,32 @@ has the priority. ...@@ -687,34 +569,32 @@ has the priority.
~~~~~{.sh} ~~~~~{.sh}
>:$ lspci | grep CERN >:$ lspci | grep CERN
05:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03) 01:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03)
0b:00.0 Non-VGA unclassified device: CERN/ECP/EDU Device 018d (rev 03)
~~~~~~~~~~ ~~~~~~~~~~
This means that your first board (wr0) is at **05**:00.0 and the second one (wr1) is at **0b**:00.0 This means that your first board (wri1) is at **01**:00.0
Thus, for each board you can open a terminal and run the following command: Thus, for each board you can open a terminal and run the following command:
~~~~~{.sh} ~~~~~{.sh}
>:$ sudo ./tools/spec-vuart -b 0x05 #For the first SPEC board >:$ sudo wrpc-vuart -f /sys/bus/pci/devices/0000\:00\:01.0/0000\:01\:00.0/resource0 -o 0x20500
>:$ sudo ./tools/spec-vuart -b 0x0b #For the second SPEC board
~~~~~~~~~~ ~~~~~~~~~~
> ***Warning:*** Be aware that if you try to remove the spec kernel modules with the virtual UART > ***Warning:*** Be aware that if you try to remove the spec kernel modules with the virtual UART
activated, your PC will hang and thus you will need to reboot. You must close activated, your PC will hang and thus you will need to reboot. You must close
the virtual UART before doing this kind of operation. the virtual UART before doing this kind of operation.
[^sudomc]: On Ubuntu LTS, you need sudo permission to access to a [^sudomc]: On Ubuntu LTS, you need sudo permission to access to a
ttyUSB*X* device. It might be a good idea to add your user to the dialout group to ttyUSB*X* device. It might be a good idea to add your user to the dialout group to
obtain appropriate permisssion on the device: `sudo usermod -a -G dialout $USER` obtain appropriate permission on the device: `sudo usermod -a -G dialout $USER`
The White Rabbit Core Shell The White Rabbit Core Shell
---------------------------- ----------------------------
Once you are in the UART you should obtain the White Rabit Core console (`wrc#`). Once you are in the UART you should obtain the WR PTP Core console (`wrc#`).
A complete reference of the shell commands is included in the [wrpc.pdf] manual or A complete reference of the shell commands is included in the [wrpc.pdf] manual or
you can read them in the [Wiki](http://www.ohwr.org/projects/wr-cores/wiki/Wrpc_shell) you can read them in the [Wiki](https://www.ohwr.org/project/wr-cores/wikis/home)
The most useful commands are repeated here for your convenience The most useful commands are repeated here for your convenience
...@@ -726,28 +606,148 @@ The most useful commands are repeated here for your convenience ...@@ -726,28 +606,148 @@ The most useful commands are repeated here for your convenience
For the tutorial we will use the following names: For the tutorial we will use the following names:
* `wrc1#` for `wrc#` console of the main board (wr0/busID=0x0500) * `wrc1#` for `wrc#` console of the main board (wri1/busID=0x0100) on the PC01
* `wrc2#` for `wrc#` console of the second board (wr1/busID=0x0b00) * `wrc2#` for `wrc#` console of the main board (wri1/busID=0x0100) on the PC02
Initial Configuration using SDBFS partition
------------------------------------
Since version 3.0 of WR PTP Core ([wrpc-sw]), the on-board flash memory chip on the carrier
is used as a default place for storing calibration parameters and an init script.
The storage format of this information is organized in an SDBFS filesystem that **MUST BE** pre-formatted and
should be properly configured at least once (in case it has not been done during the manufacturing tests).
### Checking if SDBFS is properly formatted
The first thing to do is to verify that the SDBFS has been properly formatted and configured.
To do so you should check the trace messages while [connecting to the UART](#connect-to-the-uarts).
In case you see an error while WR Core is initializing such as:
~~~~~{.sh}
WR Core: starting up...
...
No SDB filesystem in i2c eeprom
~~~~~~~~~~
Or
~~~~~{.sh}
WR Core: starting up...
...
get_persistent_mac: SDB error
get_persistent_mac: SDB file is empty
get_persistent_mac: Using W1 serial number
~~~~~~~~~~
This means that SDBFS as not been founded or that SDBFS is not properly formatted (corrupted).
In this case you should format SDBFS as detailed in the [next section](#formatting-sdbfs).
In case SDBFS is found but an error message about an "empty SDB file" appears when retrieving
the MAC address of the device: you should jump to
[configuring the MAC address](#configuring-mac-address) section.
~~~~~{.sh}
WR Core: starting up...
sdbfs: found at 3014656 in Flash
...
get_persistent_mac: SDB file is empty
get_persistent_mac: Using W1 serial number
~~~~~~~~~~
If none of these warnings arise during initialization this mean that you can skip the next
steps and go directly to [configuring slave & master mode](#configure-in-slave-master-mode) section.
### Formatting SDBFS
> **Warning**: You should skip the following step if you have verified that
> the SDBFS is [properly formatted](#checking-if-sdbfs-is-properly-formatted).
Therefore, starting from v3.0 you have to write the empty
SDBFS filesystem image to the flash before running the WRPC. The simplest way of
doing this is by calling a WR PTP Core shell command:
~~~~~{.sh}
wrc# sdb fs 0
~~~~~
You should see the output similar to:
~~~~~{.sh}
filename: . ; first: 2e0000; last: 32007f
filename: wr-init ; first: 2f0000; last: 2f00ff
filename: calibration ; first: 300000; last: 30007f
filename: mac-address ; first: 310000; last: 310005
filename: sfp-database ; first: 320000; last: 32007f
Formatting SDBFS in Flash(0x2e0000)...
~~~~~
After formatting the SDBFS, you should reconfigure the
[MAC address](#configuring-mac-address) and the
[calibration](#calibration).
> **Note:** Other methods exists to format SDBFS with a pre-existing binary files:
> through the PCIe bus ([wrpc-sw].pdf > Appendix C), or using a Xilinx JTAG cable when
> [running in standalone](#run-in-standalone).
### Configuring MAC address
> **Note:** Configuring properly the MAC address is recommanded but not mandatory.
In case you get the messages at the initialization of WR PTP Core:
~~~~~{.sh}
WR Core: starting up...
...
get_persistent_mac: SDB file is empty
get_persistent_mac: Using W1 serial number
~~~~~
Your [SPEC] board will use a "auto-generated" MAC address using the
thermometer serial number (W1) as is unique among SPEC devices.
And if even if this MAC should be uniq on this network it has not been
officially assigned following the [IEEE OUI].
You should get the MAC for your board from its manufacturer. To configure the
address and store it into the Flash/EEPROM (so that it's automatically loaded
every time the WRPC starts) you should type two commands in the shell:
~~~~~{.sh}
wrc# mac set xx:xx:xx:xx:xx:xx
wrc# mac setp xx:xx:xx:xx:xx:xx
~~~~~
where `xx:xx:xx:xx:xx:xx` is the MAC address of your board.
To verify it back, you should run
~~~~~{.sh}
wrc# mac get
~~~~~
After rebooting the machine.
Configure in slave & master mode Configure in slave & master mode
-------------------------------- --------------------------------
Now we can perform the following operation: Now we can perform the following operation on both PCs:
* Check if you have the correct SFP and its corresponding value[^sfpdetectbug] * Check if you have the correct SFP and its corresponding value[^sfpdetectbug]
~~~~~{.sh} ~~~~~{.sh}
wrc1# sfp detect
AXGE-3454-0531 #purple
wrc1# sfp match wrc1# sfp match
AXGE-3454-0531 #purple
SFP matched, dTx=46407, dRx=167843, alpha=-73622176 SFP matched, dTx=46407, dRx=167843, alpha=-73622176
~~~~~~~ ~~~~~~~
~~~~~{.sh} ~~~~~{.sh}
wrc2# sfp detect wrc2# sfp match
AXGE-1254-0531 #blue AXGE-1254-0531 #blue
wrc1# sfp match
SFP matched, dTx=46407, dRx=167843, alpha=73622176 SFP matched, dTx=46407, dRx=167843, alpha=73622176
~~~~~~~ ~~~~~~~
...@@ -759,7 +759,7 @@ and check the [Calibration Section](#calibration) that explain how to add SFPs p ...@@ -759,7 +759,7 @@ and check the [Calibration Section](#calibration) that explain how to add SFPs p
~~~~~{.sh} ~~~~~{.sh}
wrc1# mode master wrc1# mode master
SPLL_Init: running as Free-running Master, 1 ref channels, 2 out channels PTP stop
Locking PLL... Locking PLL...
~~~~~~~ ~~~~~~~
...@@ -768,7 +768,8 @@ mode, this should not be necessary but you might have set it before in master mo ...@@ -768,7 +768,8 @@ mode, this should not be necessary but you might have set it before in master mo
~~~~~{.sh} ~~~~~{.sh}
wrc2# mode slave wrc2# mode slave
slave PTP stop
Locking PLL
~~~~~~~ ~~~~~~~
### Start the synchronization with PTP daemon ### Start the synchronization with PTP daemon
...@@ -781,17 +782,6 @@ wrc1# ptp start ...@@ -781,17 +782,6 @@ wrc1# ptp start
wrc2# ptp start wrc2# ptp start
~~~~~~~ ~~~~~~~
And you should obtain the following message on the slave board:
SPLL_Init: running as Slave, 1 ref channels, 2 out channels
Enabling ptracker channel: 0
Enabling ptracker channel: 0
servo:pre: -1885143040/2ps
servo:Deltas: Master: Tx=46407ps, Tx=175043ps, Slave: tx=46407ps, Rx=167843ps.
Adjust: counter = seconds [+0]
Adjust: counter = nanoseconds [+343914800]
servo:busy
Finally you can run the WRC shell in `gui` mode to obtain more information Finally you can run the WRC shell in `gui` mode to obtain more information
~~~~~{.sh} ~~~~~{.sh}
...@@ -799,70 +789,56 @@ wrc2# gui ...@@ -799,70 +789,56 @@ wrc2# gui
~~~~~~~~~~ ~~~~~~~~~~
~~~~~{.sh} ~~~~~{.sh}
WR PTP Core Sync Monitor v 1.0 WR PTP Core Sync Monitor wr-btrain-v1.1-17-g5a72198
Esc = exit Esc = exit
TAI Time: Thu, Jan 1, 1970, 0:30:15 TAI Time: Thu, Jan 1, 1970, 02:01:57
wru1: Link up (RX: 766, TX: 340), mode: WR Slave Locked Calibrated Link status:
wru1: Link up (RX: 12860, TX: 8181) IPv4: BOOTP running
Mode: WR Slave Locked Calibrated
Synchronization status: PTP status: slave
Synchronization status:
Servo state: TRACK_PHASE Servo state: TRACK_PHASE
Phase tracking: ON Phase tracking: ON
Synchronization source: wru1 Aux clock 0 status: enabled
Aux clock status:
Timing parameters: Timing parameters:
Round-trip time (mu): 684638 ps
Round-trip time (mu): 698557 ps Master-slave delay: 354511 ps
Master-slave delay: 345660 ps Master PHY delays: TX: 121751 ps, RX: 99027 ps
Master PHY delays: TX: 46407 ps, RX: 175043 ps Slave PHY delays: TX: 0 ps, RX: 1600 ps
Slave PHY delays: TX: 46407 ps, RX: 167843 ps Total link asymmetry: -24384 ps
Total link asymmetry: 7237 ps Cable rtt delay: 462260 ps
Cable rtt delay: 262857 ps Clock offset: 1 ps
Clock offset: 2 ps Phase setpoint: 561 ps
Phase setpoint: 7268 ps Skew: 0 ps
Skew: 2 ps Update counter: 7
Manual phase adjustment: 0 ps
Update counter: 117
-- --
~~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~~
You can see that the slave node is locked, calibrated and that the phase tracking is enabled. You can see that the slave node is locked, calibrated and that the phase tracking is enabled.
> ***Notes:*** We also recommand you to set up an init script if you do not want to repeat these operations at each > ***Notes:*** We also recommend you to set up an init script if you do not want to repeat these operations at each reboot. You can look at the [wrpc.pdf] for more information or use the `init show` command to check the one you have running.
reboot. You can look at the [wrpc.pdf] for more information or use the `init show` command to check the
one you have running.
Bring up the network interface Check the network interface
------------------------------- -------------------------------
Once the drivers are loaded and the PTP has started you might need to bring the new network interfaces up. Once the drivers are loaded and the PTP has started you might check if the new network interfaces is up.
In order to do this you should just execute: In order to do this you should just execute:
~~~~{.sh}
>:$ sudo ifconfig wr0
>:$ sudo ifconfig wr1
~~~~~~~~~~~~
And then check if they are mounted by doing
~~~~{.sh} ~~~~{.sh}
>:$ sudo ifconfig | grep wr >:$ sudo ifconfig | grep wr
wr0 Link encap:Ethernet HWaddr 08:00:30:0d:e8:6b wri1 Link encap:Ethernet HWaddr 22:33:07:00:f1:a7
wr1 Link encap:Ethernet HWaddr 08:00:30:0d:e4:cd
~~~~~~~~~~~~ ~~~~~~~~~~~~
> ***Notes:*** On the distributions that use gnome desktop (i.e, Ubuntu), the interfaces are automatically mounted by *gnome
network manager*, so you might not need to perform the last step.
Some Illustrative Experiments Some Illustrative Experiments
================== ==================
...@@ -873,25 +849,17 @@ It is also recommended to follow the order of the tutorial since the ...@@ -873,25 +849,17 @@ It is also recommended to follow the order of the tutorial since the
concepts that are intended to be described and tested are explained in concepts that are intended to be described and tested are explained in
the same order as the experiments. the same order as the experiments.
> **Notes:** Before each experiment you should make sure that you set > ***Notes:*** Before each experiment you should make sure that you set
up your boards in *master/slave* mode and that the PTP daemons are running on both. up your boards in *master/slave* mode and that the PTP daemons are running on both.
You cand find how to do it in subsection [4.3](#configure-in-slave-master-mode).
A basic explanation is included in [Frequently Added Questions](#frequently-added-questions) section (first one).
Playing with the DIO channels Playing with the DIO channels
---------------------------------------------------------------------------------------- ----------------------------------------------------------------------------------------
The first step to perform is to check if the [FMCDIO] channels are accessible using the installed driver. The first step to perform is to check if the [FMCDIO] channels are accessible using the installed driver.
In the `tools` subdirectory you will you find the `wr-dio-cmd` program, The `wr-dio-cmd` program, let you quickly test the I/O features of the [FMCDIO] boards.
that let you quickly test the I/O features of the [FMCDIO] boards
This is the general syntax of the command[^sudo]: `wr-dio-cmd <ifname> <cmd> [<arg> ...]`
The main commands correspond to: `mode, pulse & stamp`, and you can
find an extended description of
them in the [spec-sw.pdf:6.7][spec-sw.pdf] document.
This is the general syntax of the command[^sudo]: `wr-dio-cmd: use "wr-dio-cmd [-V] <dev> <cmd> [...]"`
[^sudo]: As the application use `ioctl` you should call with root privilege by using sudo. [^sudo]: As the application use `ioctl` you should call with root privilege by using sudo.
...@@ -922,7 +890,7 @@ For example you can set it up like this ...@@ -922,7 +890,7 @@ For example you can set it up like this
~~~~~{.sh} ~~~~~{.sh}
## Configure channel 0 as input with termination, 1 as input, 4 as fixed low ## Configure channel 0 as input with termination, 1 as input, 4 as fixed low
>:$ sudo ./tools/wr-dio-cmd wr0 mode Ii--0 >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode Ii--0
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
...@@ -931,17 +899,17 @@ For example you can set it up like this ...@@ -931,17 +899,17 @@ For example you can set it up like this
After reprogramming/rebooting the FGPA, the channels are set up by default as: After reprogramming/rebooting the FGPA, the channels are set up by default as:
#. Channel 0 (connector #1) output a PPS signal: `p` 1. Channel 0 (connector #1) output a PPS signal: `p`
#. Channel 1 (connector #2) low state: `0`. 2. Channel 1 (connector #2) low state: `0`.
#. Channel 2 (connector #3) same as ch1: low state: `0` 3. Channel 2 (connector #3) same as ch1: low state: `0`
#. Channel 3 (connector #4) is configured as input with termination impedance: `i`. 4. Channel 3 (connector #4) is configured as input with termination impedance: `i`.
#. Channel 4 (connector #5) is in Clock Mode with termination: `C`. 5. Channel 4 (connector #5) is in Clock Mode with termination: `C`.
To reset to the default mode you can reset/reprogram the FPGA or set it back with: To reset to the default mode you can reset/reprogram the FPGA or set it back with:
~~~~~{.sh} ~~~~~{.sh}
## Revert back to default mode ## Revert back to default mode
>:$ sudo ./tools/wr-dio-cmd wr0 mode p00ic. >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode p00ic.
~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~
...@@ -959,18 +927,18 @@ Finally you need to active a trigger pulse in your oscilloscope. Then you can tr ...@@ -959,18 +927,18 @@ Finally you need to active a trigger pulse in your oscilloscope. Then you can tr
~~~~~{.sh} ~~~~~{.sh}
## Set channel 4 as Input ## Set channel 4 as Input
>:$ sudo ./tools/wr-dio-cmd wr0 mode 4 D >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 4 D
## Pulse channel 4 for 0.1 seconds now ## Pulse channel 4 for 0.1 seconds now
>:$ sudo ./tools/wr-dio-cmd wr0 pulse 4 .1 now >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 pulse 4 .1 now
## Pulse for 10 microseconds in the middle of the next second ## Pulse for 10 microseconds in the middle of the next second
>:$ sudo ./tools/wr-dio-cmd wr0 pulse 4 .00001 +1.5 >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 pulse 4 .00001 +1.5
## Pulse for 1ms at 17:00 today ## Pulse for 1ms at 17:00 today
## Set the datetime of the next event (60 seconds from now) ## Set the datetime of the next event (60 seconds from now)
## NOTE: this only work if the date is correctly set in the master SPEC, ## NOTE: this only work if the date is correctly set in the master SPEC,
>:$ sudo ./tools/wr-dio-cmd wr0 pulse 4 .001 $(date +%s --date 17:00) >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 pulse 4 .001 $(date +%s --date 17:00)
~~~~~~~~ ~~~~~~~~
> ***Note:*** please note that the `pulse` command activates the [FMCDIO] mode (without changing the termination) > ***Note:*** please note that the `pulse` command activates the [FMCDIO] mode (without changing the termination)
...@@ -981,7 +949,7 @@ Finally you need to active a trigger pulse in your oscilloscope. Then you can tr ...@@ -981,7 +949,7 @@ Finally you need to active a trigger pulse in your oscilloscope. Then you can tr
Once you have generated the pulse you can retrieve its timestamp by executing: Once you have generated the pulse you can retrieve its timestamp by executing:
~~~~~{.sh} ~~~~~{.sh}
>:$ sudo ./tools/wr-dio-cmd wr0 stamp 4 >:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 4
ch 4, 378.788588536 ch 4, 378.788588536
ch 4, 381.268701864 ch 4, 381.268701864
ch 4, 387.284885816 ch 4, 387.284885816
...@@ -994,7 +962,7 @@ ch 4, 542.500000000 ...@@ -994,7 +962,7 @@ ch 4, 542.500000000
~~~~~~~~ ~~~~~~~~
> ***Notes:*** If you see other timestampings messages coming from channel 2 this mean you don't > ***Notes:*** If you see other timestampings messages coming from channel 2 this mean you don't
have disabled the PPS mode. Check [Disabling PPS](#disabling-pps-on-channel-2) section. have disabled the PPS mode.
### Time stamping input & output. ### Time stamping input & output.
...@@ -1008,27 +976,29 @@ The configuration is done as indicated in the figure below: ...@@ -1008,27 +976,29 @@ The configuration is done as indicated in the figure below:
![Time-stamping configuration](img/ssk_playdio.png) ![Time-stamping configuration](img/ssk_playdio.png)
~~~~~{.sh} ~~~~~{.sh}
## Configure #2 & #5 (ch1 & ch4) as ouput and #3 (ch2) as input with termination on wr0. ## Configure #2 & #5 (ch1 & ch4) as ouput and #3 (ch2) as input with termination on wri1 (spusa).
>:$ sudo ./tools/wr-dio-cmd wr0 mode -DI-D >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode -DI-D
## Configure #4 (ch3) as input on wr1
>:$ sudo ./tools/wr-dio-cmd wr1 mode 3 I ## Configure #4 (ch3) as input on wri1 (tornado)
>tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 3 I
## Then flush the previous timestamp ## Then flush the previous timestamp (spusa and tornado)
>:$ sudo ./tools/wr-dio-cmd wr0 stamp &> /dev/null >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp &> /dev/null
>:$ sudo ./tools/wr-dio-cmd wr1 stamp &> /dev/null >tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp &> /dev/null
## Schedule the pulse to the next common event on two outputs ## Schedule the pulse to the next common event on two outputs
>:$ sudo ./tools/wr-dio-cmd wr0 pulse 1 .00001 +2 >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 pulse 1 .00001 +2
>:$ sudo ./tools/wr-dio-cmd wr0 pulse 4 .00001 +2 >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 pulse 4 .00001 +2
## Then (after 60s), you should run stamp on the wr0 ## Then (after 60s), you should run stamp on the wri1
>:$ sudo ./tools/wr-dio-cmd wr0 stamp >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp
ch 1, 2267.500000000 ch 1, 186789.999999992
ch 2, 2267.500000008 ch 2, 186790.000000000
ch 4, 2270.500000000 ch 4, 186792.999999992
>:$ sudo ./tools/wr-dio-cmd wr1 stamp
ch 3, 2270.500000008 >tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp
ch 3, 186792.999999992
~~~~~~~~~~~~~~~~~ ~~~~~~~~~~~~~~~~~
...@@ -1068,11 +1038,11 @@ of both boards. ...@@ -1068,11 +1038,11 @@ of both boards.
If you don't see this pulse, you might want to force the pulse mode: If you don't see this pulse, you might want to force the pulse mode:
~~~~~~{.sh} ~~~~~~{.sh}
## run pps on channel 0 of the "first" card ## run pps on channel 0 of the "first" card (spusa)
>:$ sudo ./tools/wr-dio-cmd wr0 mode 0 p >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 0 p
## run pps on channel 0 of the "second" card ## run pps on channel 0 of the "second" card (tornado)
>:$ sudo ./tools/wr-dio-cmd wr1 mode 0 p >tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 0 p
~~~~~~~~~~ ~~~~~~~~~~
...@@ -1093,8 +1063,8 @@ The Network Interface Card (NIC) Synchronization ...@@ -1093,8 +1063,8 @@ The Network Interface Card (NIC) Synchronization
### Introduction ### Introduction
The *wr-nic* driver registers a Linux network interface card for The *wr-nic* driver registers a Linux network interface card for
each [SPEC] device that it drives. The cards are called `wr%d` (i.e., each [SPEC] device that it drives. The cards are called `wri%d` (i.e.,
*wr0*, *wr1*, ...). *wri1*, *wri2*, ...).
The [SPEC] can carry normal data traffic in The [SPEC] can carry normal data traffic in
addition to the PTP frames of *White Rabbit*, that remain addition to the PTP frames of *White Rabbit*, that remain
...@@ -1141,11 +1111,11 @@ sends the forward frame and reports data as soon as it gets a reply. ...@@ -1141,11 +1111,11 @@ sends the forward frame and reports data as soon as it gets a reply.
~~~~~{.sh} ~~~~~{.sh}
## On a terminal run ## On a terminal run
>:$ sudo ./tools/stamp-frame wr0 listen >spusa:$ sudo stamp-frame wri1 listen
tools/stamp-frame: Using interface wr0, with all timestamp options active tools/stamp-frame: Using interface wri1, with all timestamp options active
## On another terminal (maybe on another host) run ## On another terminal (maybe on another host) run
>:$ sudo ./tools/stamp-frame wr1 >tornado:$ sudo stamp-frame wri1
tools/stamp-frame: Using interface wr1, with all timestamp options active tools/stamp-frame: Using interface wr1, with all timestamp options active
timestamp T1: 1891.948736656 timestamp T1: 1891.948736656
timestamp T2: 1892.038390176 timestamp T2: 1892.038390176
...@@ -1159,8 +1129,8 @@ backward time: -0.089544832 ...@@ -1159,8 +1129,8 @@ backward time: -0.089544832
This is done four times: departure and arrival of the forward frame, followed This is done four times: departure and arrival of the forward frame, followed
by departure and arrival of the backward frame. Thus, by departure and arrival of the backward frame. Thus,
time stamps T1 and T4 are collected at the time stamps T1 and T4 are collected at the
original sender (here: *wr1*) while T2 and T3 are collected at the original sender (here: *wri1 "tornado"*) while T2 and T3 are collected at the
remote host (here: *wr0*). The times above are all consistent remote host (here: *wri1 "spusa"*). The times above are all consistent
because the two [SPEC] cards are synchronized with *White Rabbit*. The because the two [SPEC] cards are synchronized with *White Rabbit*. The
reported forward and backward times match the fact that we used reported forward and backward times match the fact that we used
a 10km fiber to connect the two cards; the difference between them a 10km fiber to connect the two cards; the difference between them
...@@ -1211,7 +1181,7 @@ distributed instrumentation facility); another typical application is ...@@ -1211,7 +1181,7 @@ distributed instrumentation facility); another typical application is
time stamping input events. time stamping input events.
Thus in these experiments we are going to transmit an external frequency in Thus in these experiments we are going to transmit an external frequency in
the 100Hz range using the starting kit: the 100Hz range using the WR Starting Kit:
* The user supplies a ~100Hz square wave on the channel 0 of the master card. * The user supplies a ~100Hz square wave on the channel 0 of the master card.
* The **dio-ruler** on master host reads the UTC time of the rising edge of the external pulse upon IRQ. * The **dio-ruler** on master host reads the UTC time of the rising edge of the external pulse upon IRQ.
...@@ -1267,7 +1237,7 @@ delay of 50 microseconds). ...@@ -1267,7 +1237,7 @@ delay of 50 microseconds).
Then we should run the "dumb" agent on the slave board in charge of forwarding *ioctl* packet to the *DIO* core: Then we should run the "dumb" agent on the slave board in charge of forwarding *ioctl* packet to the *DIO* core:
~~~~~~{.sh} ~~~~~~{.sh}
>:$ sudo ./tool/wr-dio-agent wr1 & >tornado:$ sudo wr-dio-agent wri1 /dev/fmc-dio-1:0 &
~~~~~~~~~~ ~~~~~~~~~~
Then you need to connect the output of the generator[^fake100hz] to channel 1 of the master [SPEC+FMCDIO] board. Then you need to connect the output of the generator[^fake100hz] to channel 1 of the master [SPEC+FMCDIO] board.
...@@ -1275,7 +1245,7 @@ The generated waveform should be a 0-5V pulse at ~100Hz (5ms at 5V then 5ms at 0 ...@@ -1275,7 +1245,7 @@ The generated waveform should be a 0-5V pulse at ~100Hz (5ms at 5V then 5ms at 0
[^fake100hz]: If you lack a wave form generator, you can make an output pulse with [^fake100hz]: If you lack a wave form generator, you can make an output pulse with
`wr-dio-cmd <if> mode <ch> P` or other means and use it as a trigger. Check the [Two PCs example](#two-pcs-example). `wr-dio-cmd <dev> mode <ch> P` or other means and use it as a trigger. Check the [Two PCs example](#two-pcs-example).
...@@ -1283,10 +1253,10 @@ You should setup the channel 0 as input and check if the 100Hz signal is correct ...@@ -1283,10 +1253,10 @@ You should setup the channel 0 as input and check if the 100Hz signal is correct
~~~~~~{.sh} ~~~~~~{.sh}
## Set channel 0 of master board as Input and disable PPS signal (if the FPGA is reflashed). ## Set channel 0 of master board as Input and disable PPS signal (if the FPGA is reflashed).
>:$ sudo ./tools/wr-dio-cmd wr0 mode I-0-- >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode I-0--
## Retrieved the time stamped value ## Retrieved the time stamped value
>:$ sudo ./tools/wr-dio-cmd wr0 stamp >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp
ch 0, 3573.281851462 ch 0, 3573.281851462
ch 0, 3573.291851460 ch 0, 3573.291851460
ch 0, 3573.301851460 ch 0, 3573.301851460
...@@ -1309,13 +1279,13 @@ on both the local (channel 3) and the remote card (channel 1) ...@@ -1309,13 +1279,13 @@ on both the local (channel 3) and the remote card (channel 1)
~~~~~~{.sh} ~~~~~~{.sh}
## Set local3 as Output ## Set local3 as Output
>:$ sudo ./tools/wr-dio-cmd wr0 mode 3 D >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 3 D
## Set remote1 as Output (and disable 2) ## Set remote1 as Output (and disable 2)
>:$ sudo ./tools/wr-dio-cmd wr1 mode -D0-- >tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 mode -D0--
## Creating the ruler to forward from input 0 to local3 and remote1 ## Creating the ruler to forward from input 0 to local3 and remote1
>:$ sudo ./tools/wr-dio-ruler wr0 IN0 L3+0.001 R1+0.001 >spusa:$ sudo wr-dio-ruler wri1 /dev/fmc-dio-1:0 IN0 L3+0.001 R1+0.001
wr-dio-ruler: configured for local channel 3, delay 0.001000000 wr-dio-ruler: configured for local channel 3, delay 0.001000000
wr-dio-ruler: configured for remote channel 1, delay 0.001000000 wr-dio-ruler: configured for remote channel 1, delay 0.001000000
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
...@@ -1325,16 +1295,16 @@ wr-dio-ruler: configured for remote channel 1, delay 0.001000000 ...@@ -1325,16 +1295,16 @@ wr-dio-ruler: configured for remote channel 1, delay 0.001000000
To check if the experiment works well you can compare the timestamp of the two outputs To check if the experiment works well you can compare the timestamp of the two outputs
~~~~~~~~{.sh} ~~~~~~~~{.sh}
## Checking the timestamp on local ouput ## Checking the timestamp on local output
>:$ sudo ./tools/wr-dio-cmd wr0 stamp 3 >spusa:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 3
ch 3, 5340.004864960 ch 3, 5340.004864960
ch 3, 5340.014864960 ch 3, 5340.014864960
ch 3, 5340.024864968 ch 3, 5340.024864968
ch 3, 5340.034864964 ch 3, 5340.034864964
... ...
## Checking the timestamp on remote ouput ## Checking the timestamp on remote output
>:$ sudo ./tools/wr-dio-cmd wr1 stamp 1 >tornado:$ sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 1
ch 1, 5340.004864962 ch 1, 5340.004864962
ch 1, 5340.014864960 ch 1, 5340.014864960
ch 1, 5340.024864968 ch 1, 5340.024864968
...@@ -1360,7 +1330,7 @@ we verified the tools and we think this is a good explanation of how to use them ...@@ -1360,7 +1330,7 @@ we verified the tools and we think this is a good explanation of how to use them
It shows how to use the *ruler* and *agent* on It shows how to use the *ruler* and *agent* on
two hosts, called `spusa` and `tornado`. It is pretty the same thing as the previous two hosts, called `spusa` and `tornado`. It is pretty the same thing as the previous
experiment only that the board are now both named `wr0`. experiment only that the board are now both named `wri1`.
![Transmit PPS between two PCs](img/ssk_txpps.png) ![Transmit PPS between two PCs](img/ssk_txpps.png)
...@@ -1370,28 +1340,28 @@ channel 0. ...@@ -1370,28 +1340,28 @@ channel 0.
~~~~~{.sh} ~~~~~{.sh}
>spusa:# sudo ./tools/wr-dio-cmd wr0 mode 0 P >spusa:# sudo wr-dio-cmd /dev/fmc-dio-1:0 mode 0 P
>tornado:# sudo ./tools/wr-dio-agent wr0 & >tornado:# sudo wr-dio-agent wri1 /dev/fmc-dio-1:0 &
>spusa:# ./tools/wr-dio-ruler wr0 IN4 L3+.001 R4+.001 R2+.001 >spusa:# sudo wr-dio-ruler wri1 /dev/fmc-dio-1:0 IN4 L3+.001 R4+.001 R2+.001
wr-dio-ruler: configured for local channel 3, delay 0.001000000 wr-dio-ruler: configured for local channel 3, delay 0.001000000
wr-dio-ruler: configured for remote channel 4, delay 0.001000000 wr-dio-ruler: configured for remote channel 4, delay 0.001000000
wr-dio-ruler: configured for remote channel 2, delay 0.001000000 wr-dio-ruler: configured for remote channel 2, delay 0.001000000
[... wait a few seconds ...] [... wait a few seconds ...]
>spusa:# ./tools/wr-dio-cmd wr0 stamp 3 >spusa:# sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 3
ch 3, 385.001000000 ch 3, 385.001000000
ch 3, 386.001000000 ch 3, 386.001000000
ch 3, 387.001000000 ch 3, 387.001000000
ch 3, 388.001000000 ch 3, 388.001000000
>tornado:# ./tools/wr-dio-cmd wr0 stamp 2 >tornado:# sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 2
ch 2, 385.001000000 ch 2, 385.001000000
ch 2, 386.001000000 ch 2, 386.001000000
ch 2, 387.001000000 ch 2, 387.001000000
ch 2, 388.001000000 ch 2, 388.001000000
>tornado:# ./tools/wr-dio-cmd wr0 stamp 4 >tornado:# sudo wr-dio-cmd /dev/fmc-dio-1:0 stamp 4
ch 4, 385.001000000 ch 4, 385.001000000
ch 4, 386.001000000 ch 4, 386.001000000
ch 4, 387.001000000 ch 4, 387.001000000
...@@ -1421,7 +1391,7 @@ wrc# ptp start ...@@ -1421,7 +1391,7 @@ wrc# ptp start
~~~~~~~ ~~~~~~~
Then you should run the [WRS] in master or grandmaster mode as explained Then you should run the [WRS] in master or grandmaster mode as explained
in [wr-switch-guide.pdf]. in (Resources) [wr-switch-guide.pdf].
Finally you need to connect the slave SFPs (blue) to the [SPEC]s and the Finally you need to connect the slave SFPs (blue) to the [SPEC]s and the
master SFP (violet) to the switch. master SFP (violet) to the switch.
...@@ -1430,7 +1400,7 @@ The result of this experiment is illustrated by the next figure where ...@@ -1430,7 +1400,7 @@ The result of this experiment is illustrated by the next figure where
you can see the 3 PPS signals: yellow for [WRS], blue and violet for you can see the 3 PPS signals: yellow for [WRS], blue and violet for
[SPEC+FMCDIO]. [SPEC+FMCDIO].
![WRS PPS (yellow) vs Starting Kit PPS (blue & violet)](img/ssk_wrspps.jpg) ![WRS PPS (yellow) vs WR Starting Kit PPS (blue & violet)](img/ssk_wrspps.jpg)
The distance between each PPS might be reduced by the improving the The distance between each PPS might be reduced by the improving the
calibration which is the subject of the next section. calibration which is the subject of the next section.
...@@ -1452,19 +1422,18 @@ If you use a custom gateware or SFPs that are not listed in the wiki page ...@@ -1452,19 +1422,18 @@ If you use a custom gateware or SFPs that are not listed in the wiki page
you should run yourself the calibration in order to obtain the correct values you should run yourself the calibration in order to obtain the correct values
for your setup. for your setup.
> **Warning**: Cable length/type can modify around ~5ns/meter the delay > ***Warning:*** Cable length/type can modify around ~5ns/meter the delay
between the moment when the PPS was out of the board and when it was between the moment when the PPS was out of the board and when it was
captured by the oscilloscope. captured by the oscilloscope.
> **Notes**: Please check that you are using the values that correspond > ***Notes:***: Please check that you are using the values that correspond
to your gateware release. When this document was generated we refer as to your gateware release. When this document was generated we refer as
wr-nic-v2.0 (starting kit). You can also check using the `ver` command wr-starting-kit-v3.0 (WR Starting Kit). You can also check using the `ver` command
if the corresponding embedded LM32 corresponds to your gateware version if the corresponding embedded LM32 corresponds to your gateware version.
(i.e, wrpc-v2.1-for-wrnic lm32 is embedded in wr-nic-v2.0).
~~~~~{.sh} ~~~~~{.sh}
wrc# ver wrc# ver
WR Core build: wrpc-v2.1-for-wrnic WR Core build: wr-starting-kit-v3.0
... ...
## List your actual sfp database ## List your actual sfp database
...@@ -1473,7 +1442,7 @@ wrc# sfp show ...@@ -1473,7 +1442,7 @@ wrc# sfp show
## Erase the actual database if it was corrupted ## Erase the actual database if it was corrupted
wrc# sfp erase wrc# sfp erase
## Add the parameters for the SFP provided in the starting kit ## Add the parameters for the SFP provided in the WR Starting Kit
wrc# sfp add AXGE-1254-0531 121751 95827 64481496 wrc# sfp add AXGE-1254-0531 121751 95827 64481496
wrc# sfp add AXGE-3454-0531 121751 95827 -66584558 wrc# sfp add AXGE-3454-0531 121751 95827 -66584558
~~~~~~~~~~~ ~~~~~~~~~~~
...@@ -1484,12 +1453,6 @@ WR equipments (i.e, [WRS]) as explained in the wiki page. ...@@ -1484,12 +1453,6 @@ WR equipments (i.e, [WRS]) as explained in the wiki page.
You might also check the [wrpc.pdf] for extended explanations on how to run You might also check the [wrpc.pdf] for extended explanations on how to run
yourself the calibration procedure. yourself the calibration procedure.
> **Notes**: Please check that the master board has a valid t42p written
in its EEPROM. This value must be obtained by first connecting this
board in slave mode to a working WR master. For more information read the
[wrpc-v2.1.pdf] page 7.
SPEC+DIO as grandmaster SPEC+DIO as grandmaster
------------------------ ------------------------
...@@ -1569,17 +1532,37 @@ Run in standalone ...@@ -1569,17 +1532,37 @@ Run in standalone
You can also run GM in a full standalone mode in order to transmit WR clock without the need of a PC. You can also run GM in a full standalone mode in order to transmit WR clock without the need of a PC.
First you need to flash the SPEC with the latest bitstream you can find the package: First you need to flash the SPEC with the latest `wr_nic_dio.bit` bitstream you can find in the package:
<http://www.sevensols.com/dl/wr-nic/bin/latest_stable.tar.gz> [wr-starting-kit-v3.0_bin.tar.gz]
To do so you need to generate a MSC file as follows: And you also need to download a pre-formatted sdbfs partition: [sdbfs-standalone-160812.bin]
In the case when you want to run on the the SPEC a reference bitstream provided with a stable
WRPC release, you can simply program your Flash with \textit{spec\_top.mcs}
provided with the release binaries using for example Xilinx ISE Impact tool.
Create PROM Files > SPI Flash > Single FPGA > 32M > MCS Then you need to create a `mcs` image that contains both the SDBFS partition and FPGA bitstream.
This can be done by following the layout below:
And then, when asking for SPI/BPI, just add the `.msc` file and select
the corresponding SPI flash memory: `M25P32`.
Then: | Address | Binary file |
|------------|---------------------------------|
| `0x000000` | `wr_nic_dio.bit` |
| `0x170000` | `sdbfs-standalone-160812.bin` |
use the following layout:
For example, to generate the `*.mcs` file for `M25P32` Flash on SPEC, the
following `promgen` (ISE Tool) parameters should be used:
~~~~~{.sh}
promgen -w -spi -p mcs -c FF -s 32768 -u 0 <your_bitstream>.bit -bd sdbfs-standalone-160812.bin start 0x170000 -o output.mcs
~~~~~~~~~~
To do so you need to generate a MSC file as follows:
Finally:
* The setup of the cable is exactly the same as above, and you do not need to set up the mode because it is * The setup of the cable is exactly the same as above, and you do not need to set up the mode because it is
correctly configured for GM by default at power up. correctly configured for GM by default at power up.
...@@ -1601,110 +1584,7 @@ wrc# init add ptp start ...@@ -1601,110 +1584,7 @@ wrc# init add ptp start
Please refer to *Writing EEPROM and calibration* Section of the [wrpc.pdf] document. Please refer to *Writing EEPROM and calibration* Section of the [wrpc.pdf] document.
\clearpage
Manage standalone node using etherbone
----------------------------------------
You can also use SPEC card in standalone mode as we have seen before
but... how can you configure spec card if you do not use drivers?
In wr-nic project, Etherbone core has been added to the design and it allows
a direct access to the memory map[^specmem] (wishbone registers) using
UDP/TCP packets.
In order to connect you to the [SPEC+FMCDIO] in standlone you must
first configure it with a valid IP. This can be done automatically (complex) using bootp protocol,
or manually (easy) through the WRC mini-USB UART.
[^specmem]: If you are still connected through the PCIe you can also use the tools
`spec-sw/tools/specmem` to directly read/write on the WB registers as you will
do with the etherbone tool.
### Set IP using BootP
This is the more complex way to do it because you need to create a BootP server
on your LAN, but then the IP of each standalone board can be automatically
asigned.
On Ubuntu the `dnsmasq` package can be used as BootP deamon. The configuration
file should be something similar as:
~~~~~~~{.sh}
## Specified interfaces (10.10.10.1 is your IP)
interface=eth1
## DHCP setup
dhcp-range=10.10.10.1,10.10.1.15,12h
## BootP setup
dhcp-boot=pxe.0,tfpservname,10.10.10.1
## Set a specific IP for a MAC address (optional)
dhcp-host=08:00:30:0d:f8:23,targetsysname,10.10.10.10
~~~~~~~~~~~~
### Set IP through WRC UART
An easier way to set the IP of your standalone board is through the WRC Shell by
connecting the mini-USB UART to your PC.
Then you should just write in the terminal:
~~~~~~~{.sh}
wrc# ip set 10.10.10.10
~~~~~~~~~~~~
If you want this IP to be kept after a power cycle you must add this command in the
init EEPROM script as explained [previously](#eeprom-boot-script).
### Access to the wishbone device
At this step, you need to connect the standalone device with your PC. If you
do not have any SFP interface on your PC you can use an SFP-RJ45 adapter
to connect to it.
You need to check that your interface is on the same LAN as the standalone
[SPEC+FMCDIO] board or you should set it manually if it is not the case:
~~~~~~~{.sh}
>:$ sudo ifconfig eth1 10.10.10.1
~~~~~~~~~~~~
Finally you can try the etherbone library to connect to your standalone
[SPEC+FMCDIO] board. Please check that you have compiled the library for
your platform by doing `make && sudo make install` in the main folder or by going to
`etherbone/api` and perform a `make clean && make && sudo make install`.
To ease the communication using etherbone, we have added the `eb-mem.sh` tool in the `scripts/`
folder that access through the etherbone library to the device and perform
read/write operations.
Below we display a quick example on how to use it.
~~~~~~{.sh}
## It shows you Device memory map
>:$ scripts/eb-mem.sh --scan --ip 10.10.10.10
## Read a memory address (DIO I/O mode register <=> 62000 + 300 + 3C)
>:$ scripts/eb-mem.sh --read --ip 10.10.10.10 --address 0x6233C
## Write a memory address (DIO I/O mode register <=> 62000 + 300 + 3C)
## Force only ch2 (#3) into P mode (forbidden operation while using wr-dio-cmd)
>:$ scripts/eb-mem.sh --write --ip 10.10.10.10 --address 0x6233C --value 0x00A00
## Show help
>:$ scripts/eb-mem.sh --help
~~~~~~~~~~~~~
<!--TODO: Caloe -->
A library called CALoE (Configuration Abstraction Layer over Etherbone)
can also be used to ease the task of accesing to various register through
etherbone.
You can find more information on the following page
<https://github.com/klyone/caloe/wiki>
Quick Start Guide For Developers Quick Start Guide For Developers
================================= =================================
...@@ -1721,16 +1601,23 @@ If you need a more complete guide on how to create your own HDL for the [SPEC], ...@@ -1721,16 +1601,23 @@ If you need a more complete guide on how to create your own HDL for the [SPEC],
or you want to improve the structure of a project using the [OHWR] platform we recommend you or you want to improve the structure of a project using the [OHWR] platform we recommend you
to look at the [spec-getting-started.pdf] guide. to look at the [spec-getting-started.pdf] guide.
The starting kit is based on various project: The WR Starting Kit is based on various project:
* [spec-sw], The project that contains the PCIe driver and tools to access to the SPEC FPGA
* [spec-golden], A simple gateware in order to access to the EEPROM of the [FMC] (WB-I2C)
* [wr-nic], gateware (FPGA HDL) that includes the NIC capabilities and its corresponding kernel drivers
* [fmc-dio-5chttla], gateware (FPGA HDL) that includes the DIO capabilities (with NIC) and its corresponding kernel drivers
* [wrpc-sw], LM32 software in the White Rabbit PTP core for the synchronization
* [coht-vic], Kernel driver to handles interruption from FPGA such as the one from SPEC
In the following figure you can understand better how the different subproject are connected and contains
![Structure of repositoryie](img/repos_structure.png)
If you want to get more information you can take a look at `doc/starting-kit_repos-v1.3.pdf` to get a
detailed view on how the subproject are structured.
[spec-sw]
: The project that contains the software (application + driver) which you have already compiled above.
[spec-golden]
: A simple gateware in order to access to the EEPROM of the [FMC] (WB-I2C)
[wr-nic]
: gateware (FPGA HDL) that includes the NIC & DIO capabilities.
[wrpc-sw]
: LM32 software in the white rabbit PTP core for the synchronization.
Tools Tools
...@@ -1748,35 +1635,6 @@ You must have installed the following tools: ...@@ -1748,35 +1635,6 @@ You must have installed the following tools:
* Texinfo * Texinfo
Golden SPEC gateware
---------------------
> *Dep*: hdlmake, Xilinx ISE 14
This is a really simple gateware that allows the PC to read the FMC-EEPROM in
order to know what type of gateware it should load.
The gateware is a wishbone PCIe bridge connected to a WB I2C module.
To synthetize it, the user needs to follow the next steps:
~~~~~~{.sh}
## Checkout the code
svn checkout http://svn.ohwr.org/spec/trunk/hdl/golden@53 spec-golden
## Go to the main directory
cd spec-golden/syn/
## Synthetize using hdlmake
hdlmake --fetch
hdlmake
make
~~~~~~~~~~~
You will therefore obtain your golden firmware called as `spec-init.bin`
WRPC-SW (LM32 firmware) WRPC-SW (LM32 firmware)
----------------------- -----------------------
...@@ -1787,7 +1645,6 @@ However we provide here a simple resume of the steps required to compile the fir ...@@ -1787,7 +1645,6 @@ However we provide here a simple resume of the steps required to compile the fir
You should also look at the [wrpc.pdf] to understand how to use it and You should also look at the [wrpc.pdf] to understand how to use it and
how to compile new firmware for other configurations. how to compile new firmware for other configurations.
You can download it from [wr-nic-v2.0.tar.gz](http://www.ohwr.org/projects/wr-nic/files) file or you can try to compile it following the instructions below:
You first need to install the **lm32** compiler as suggested in You first need to install the **lm32** compiler as suggested in
[wrpc.pdf], and then you need to compile it using the specific configuration as bellow: [wrpc.pdf], and then you need to compile it using the specific configuration as bellow:
...@@ -1796,19 +1653,10 @@ You first need to install the **lm32** compiler as suggested in ...@@ -1796,19 +1653,10 @@ You first need to install the **lm32** compiler as suggested in
## Set up CROSS_COMPILE variable for this terminal ## Set up CROSS_COMPILE variable for this terminal
export CROSS_COMPILE="<your_path_to_lm32>/lm32/bin/lm32-elf-"; export CROSS_COMPILE="<your_path_to_lm32>/lm32/bin/lm32-elf-";
## Clone the repository ## Move to wrpc-sw inside wr-starting-kit
git clone git://ohwr.org/hdl-core-lib/wr-cores/wrpc-sw.git
cd wrpc-sw cd wrpc-sw
## Checkout the stable release ## Configuring the project for SPEC as NIC card
git checkout -b wrpc-v2.1-for-wrnic wrpc-v2.1-for-wrnic
~~~~~~~~~~
And finally configure and compile it
~~~~~~{.sh}
## Configuring the project for SPEC
make wrnic_defconfig make wrnic_defconfig
## Compile ## Compile
...@@ -1817,34 +1665,17 @@ make ...@@ -1817,34 +1665,17 @@ make
You should obtain various files named wrc.bin, wrc.elf, wrc.vhd, wrc.ram You should obtain various files named wrc.bin, wrc.elf, wrc.vhd, wrc.ram
You can therefore use them to override the one in [wr-nic](#wr-nic-hdl-gateware) project. WR-SPEC-DIO-NIC (HDL-gateware)
~~~~~{.sh}
## Override the default embeded wrpc-sw
cp wrc.ram <wr_root_folder>/wr-nic/syn/spec
~~~~~~~~~~~
WR-NIC (HDL-gateware)
---------------------- ----------------------
> *Dep*: hdlmake, Xilinx ISE 14 > *Dep*: hdlmake, Xilinx ISE 14
This step shows us how to prepare the WR-NIC bitstream ([SPEC+FMCDIO]) with This step shows us how to prepare the WR-SPEC-DIO-NIC bitstream ([SPEC+FMCDIO]) with
the wrpc-sw (`wrc.ram` file) embedded inside. the wrpc-sw (`wrc.ram` file) embedded inside.
~~~~~~{.bash} ~~~~~~{.bash}
## Checkout the code ## From the wr-starting-kit repo
git clone git://ohwr.org/white-rabbit/wr-nic.git cd fmc-dio/hdl/syn/dio-nic
cd wr-nic
git checkout -b wr-nic-v2.0 wr-nic-v2.0
## Create and update the submodules
git submodule init
git submodule update
## Go to the main directory
cd syn/specdio/
## Synthetize using hdlmake ## Synthetize using hdlmake
hdlmake --make-ise --ise-proj hdlmake --make-ise --ise-proj
...@@ -1853,10 +1684,79 @@ make ...@@ -1853,10 +1684,79 @@ make
You should finally obtain the bitstream to import in your [FMC] driver folder. You should finally obtain the bitstream to import in your [FMC] driver folder.
> **Notes**: You must have the proper version of hdlmake installed, please Set Specific Kernel Version
check the manual [wr-nic.pdf] for more information on how to synthesize the ===========================
gateware.
This chapter describes how to set a force loading a specific (previous) kernel version if you have problems while compiling/loading the wr-starting-kit
drivers with newest/latest kernel[^ubuntultskernel].
> ***Note:*** We recommand to fix your kernel to `4.18.xxx`, as it has been the one that have reported less error during development.
[^ubuntultskernel]: We usually support the current Ubuntu LTS at the moment of writing this document, however during the LTS cycle there are
minor release that might contains a newer kernel incompatible with our drivers: <https://wiki.ubuntu.com/Kernel/Support>.
Find the ID of the submenu
-------------------------------------------------
We first need to obtain the `$menuentry_id_option` for the current submenu:
~~~~~~
>:$ grep submenu /boot/grub/grub.cfg
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
~~~~~~~~~~~
List available kernel entries
-----------------------
~~~~~~
>:$ grep -A100 submenu /boot/grub/grub.cfg | grep menuentry
submenu 'Advanced options for Ubuntu' $menuentry_id_option 'gnulinux-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 5.0.0-32-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.0.0-32-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 5.0.0-32-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-5.0.0-32-generic-recovery-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 4.18.0-17-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-17-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 4.18.0-17-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.18.0-17-generic-recovery-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 4.15.0-46-generic' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-46-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
menuentry 'Ubuntu, with Linux 4.15.0-46-generic (recovery mode)' --class ubuntu --class gnu-linux --class gnu --class os $menuentry_id_option 'gnulinux-4.15.0-46-generic-recovery-541c21ee-e687-4a1e-9f8c-c1b6285694da' {
~~~~~~~~~~
Create the default menu entry
-----------------------------
The parent entry id for Advanced options in this case is `gnulinux-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da`
Choose the entry for the kernel you want to use. For example, `gnulinux-4.18.0-17-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da`
Concatenate both entries with `>` The result should be like:
`"gnulinux-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da > gnulinux-4.18.0-17-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da"`
Edit Grub
----------
Edit the file `/etc/default/grub` and replace `GRUB_DEFAULT` with the previously created entry. The file would look like
~~~~~~{.sh}
GRUB_DEFAULT="gnulinux-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da > gnulinux-4.18.0-17-generic-advanced-541c21ee-e687-4a1e-9f8c-c1b6285694da"
#GRUB_TIMEOUT_STYLE=hidden
GRUB_TIMEOUT=10
GRUB_DISTRIBUTOR=`lsb_release -i -s 2> /dev/null || echo Debian`
GRUB_CMDLINE_LINUX_DEFAULT="quiet splash"
GRUB_CMDLINE_LINUX=""
~~~~~~~~~~~
Update Grub and Reboot
----------------------
~~~~~~{.sh}
>:$ sudo update-grub
>:$ sudo reboot
~~~~~~~~~~~
Frequently Added Questions Frequently Added Questions
=========================== ===========================
...@@ -1872,7 +1772,7 @@ we strongly recommand you to visit the webpage: ...@@ -1872,7 +1772,7 @@ we strongly recommand you to visit the webpage:
and you might also find information there: and you might also find information there:
* <http://www.ohwr.org/projects/spec/wiki/FAQ> * <http://www.ohwr.org/projects/spec/wiki/FAQ>
* <http://www.ohwr.org/projects/wr-cores/wiki/Wrpc_faq> * <https://www.ohwr.org/project/wr-cores/wikis/home>
Resume Resume
...@@ -1885,39 +1785,12 @@ However, you will find a resume of the most asked questions below: ...@@ -1885,39 +1785,12 @@ However, you will find a resume of the most asked questions below:
In all of those cases the PLL has to be locked. That means your card has to be either in Master Mode, Grand Master or Slave Mode. In all of those cases the PLL has to be locked. That means your card has to be either in Master Mode, Grand Master or Slave Mode.
When you have only one card (or some but unconnected) it should be working as Free Running Master. If you have two of them (or more), one of them has to work as master, the others as Slaves and all of them have to be synced via PTP as explained en section [4.3](#configure-in-slave-master-mode). To say that is running Grand Master Mode is to make sure the PLL has already been locked to the external reference (see [Appendix](#appendix)). When you have only one card (or some but unconnected) it should be working as Free Running Master. If you have two of them (or more), one of them has to work as master, the others as Slaves and all of them have to be synced via PTP as explained en section [4.3](#configure-in-slave-master-mode). To say that is running Grand Master Mode is to make sure the PLL has already been locked to the external reference.
### I don't see the interface using ifconfig ### I don't see the interface using ifconfig
Please check if you see them using `ifconfig -a`, if you see them by using the `-a` option you just need Please check if you see them using `ifconfig -a`, if you see them by using the `-a` option you just need
to bring them up. This is explained in the [Bring up the network interface](#bring-up-the-network-interface) section. to bring them up. This is explained in the [Check the network interface](#Check-the-network-interface) section.
### Compilation of spec-sw is impossible
To compile you must have at least the 2.6.36 kernel (errors occurs with
2.6.32, 2.6.34). We recommend you to use the latest version of your distribution.
If you think you have the correct setup you can also use our automatic build
script that also generate a report with your system information.
sudo scripts/wr-ssk-get --report
After a few minutes your project should have been installed correctly, if you
still have problems send us the generated `report.log` files in the main folder.
### The starting kit is based on Ubuntu. How can I use it with Scientific Linux?
The commands to execute in order to update the kernel using scientific linux (you need at least the 2.6.36 to compile the starting kit) are:
~~~~~{.bash}
rpm --import http://elrepo.org/RPM-GPG-KEY-elrepo.org
rpm -Uvh http://elrepo.org/elrepo-release-6-5.el6.elrepo.noarch.rpm
sudo yum --enablerepo=elrepo-kernel --skip-broken install kernel-lt kernel-lt-devel kernel-lt-headers
~~~~~~~~~~
You can have more information on how to do this by browsing the (http://elrepo.org/tiki/tiki-index.php "ELRepo Project")
After this you should reboot your PC with the new kernel source and start from [section compile & install](#compile-install)
### I can't detect any level on my inputs. ### I can't detect any level on my inputs.
...@@ -1972,8 +1845,10 @@ following commands: ...@@ -1972,8 +1845,10 @@ following commands:
~~~~~~~{.sh} ~~~~~~~{.sh}
>:$ sudo insmod kernel/fmc.ko >:$ sudo insmod kernel/fmc.ko
>:$ sudo insmod kernel/htvic.ko
>:$ sudo insmod kernel/spec.ko >:$ sudo insmod kernel/spec.ko
>:$ sudo insmod kernel/wr-nic.ko >:$ sudo insmod kernel/wr-nic.ko
>:$ sudo insmod kernel/wr-dio.ko
~~~~~~~~~~~~~ ~~~~~~~~~~~~~
### The system hangs-up ### The system hangs-up
...@@ -1990,84 +1865,56 @@ Please help us to solve this error by sending us a log with the following inform ...@@ -1990,84 +1865,56 @@ Please help us to solve this error by sending us a log with the following inform
* The serial log starting from the login (dmesg) * The serial log starting from the login (dmesg)
Glossary
===========
NIC
: Network Interface Card
DIO
: Digital Input/Output
PTP
: Precise Time Protocol, a time synchronization protocol
EEPROM
: Electrically Erasable Programmable Read-Only Memory, a non-volatile memory
FMC
: FPGA Mezzanine Card, an ANSI standard for mezzanine card form factor.
LEMO
: LEMO is the name of a push-pull connectors made by the LEMO company.
SFP
: Small form-factor pluggable transceiver, a hot-pluggable transceiver for optical fiber
PCIe
: Peripheral Component Interconnect Express, a high-speed serial computer expansion bus standard
LM32
: LatticeMico32 is a 32-bit microprocessor soft core optimized for field-programmable gate arrays (FPGAs).
HDL
: Hardware description language
SPEC
: Simple PCIe FMC carrier
UART
: Universal Asynchronous Receiver/Transmitter
WB
: Whishbone Bus, an open system bus interconnect architecture designed for reuse
WRC / WRPC
: White Rabbit (PTP) Core, the main funcionality shared by all WR elements.
[WR]
: White Rabbit
[WRS]
: White Rabbit Switch
[WR]:http://www.sevensols.com/whiterabbitsolution
[WRS]: http://www.sevensols.com/en/products/wr-switch.html
[WRSSK]: http://www.sevensols.com/en/products/wr-starting-kit.html
[SPEC+FMCDIO]: http://www.sevensols.com/en/products/wr-starting-kit.html
[SPEC]: www.sevensols.com/en/products/spec.html
[FMC]: http://www.ohwr.org/projects/fmc-projects
[FMC-DIO]: http://www.sevensols.com/en/products/fmc-dio.html
[FMCDIO]: http://www.sevensols.com/en/products/fmc-dio.html
[FMC fine-delay]: http://www.sevensols.com/en/products/fmc-del.html
[OHWR]: http://www.ohwr.org/projects/white-rabbit
References References
============ ============
* [spec-sw.pdf] main documentation of the spec-sw * [spec-sw.pdf] main documentation of the spec-sw
* [wrpc.pdf] White Rabbit Core documentation * [wrpc.pdf] White Rabbit Core documentation
* [fmc-bus.pdf] How the FMC bus driver works and how to write one for your own FMC board.
* SFPs information <http://www.ohwr.org/projects/white-rabbit/wiki/SFP> * SFPs information <http://www.ohwr.org/projects/white-rabbit/wiki/SFP>
* White Rabbit Calibration: <http://www.ohwr.org/documents/213> * White Rabbit Calibration: <http://www.ohwr.org/documents/213>
* [spec-2-spec]: SPEC-2-SPEC demo * [spec-2-spec] SPEC-2-SPEC demo
* [wr_external_reference.pdf]: How to use the grandmaster mode in the switch. * [wr_external_reference.pdf] How to use the grandmaster mode in the switch.
* [spec-getting-started.pdf]:A tutorial to get ready to work with the (SPEC), including hardware deployment instructions, full required toolchain setup and a collection of step-by-step demonstrative tutorials. * [spec-getting-started.pdf] A tutorial to get ready to work with the (SPEC), including hardware deployment instructions, full required toolchain setup and a collection of step-by-step demonstrative tutorials.
* [spec-sw] Sub-project with that contains the PCIe driver and tools to access to the SPEC FPGA
* [wr-nic] Sub-project with gateware (FPGA HDL) that includes the NIC capabilities and its corresponding kernel drivers
* [fmc-dio-5chttla] Sub-project with gateware (FPGA HDL) that includes the DIO capabilities (with NIC) and its corresponding kernel drivers
* [wrpc-sw] Sub-project with the LM32 software in the White Rabbit PTP core for the synchronization
<!-- List of links -->
<!-- List of links -->
[wr-switch-guide.pdf]: http://www.sevensols.com/dl/wr-switch-sw/startupguide/latest_stable.pdf [WR]:https://www.ohwr.org/project/white-rabbit/wikis/home
[WRS]: https://sevensols.com/index.php/products/white-rabbit-switch/
[WRSSK]: http://www.sevensols.com/en/products/wr-starting-kit.html
[SPEC+FMCDIO]: http://sevensols.com/index.php/kit-spec/
[SPEC]: http://sevensols.com/index.php/products/spec/
[FMC]: http://www.ohwr.org/projects/fmc-projects
[FMC-DIO]: http://sevensols.com/index.php/fmc-dio/
[FMCDIO]: http://sevensols.com/index.php/fmc-dio/
[FMC fine-delay]: https://sevensols.com/index.php/fmc-del/
[OHWR]: http://www.ohwr.org/projects/white-rabbit
[Seven Solutions]: http://www.sevensols.com
[IEEE OUI]: https://standards.ieee.org/products-services/regauth/index.html
[wr-switch-guide.pdf]: https://sevensols.com/index.php/products/white-rabbit-switch/
[wr-nic]: http://www.ohwr.org/projects/wr-nic/ [wr-nic]: http://www.ohwr.org/projects/wr-nic/
[wr-starting-kit]: http://www.ohwr.org/projects/wr-starting-kit/ [wr-starting-kit]: http://www.ohwr.org/projects/wr-starting-kit/
[spec-sw]: http://www.ohwr.org/projects/spec-sw/ [spec-sw]: http://www.ohwr.org/projects/spec-sw/
[wrpc-sw]: http://www.ohwr.org/projects/wrpc-sw/ [wrpc-sw]: http://www.ohwr.org/projects/wrpc-sw/
[spec-golden]: http://www.ohwr.org/projects/spec/repository/show/trunk/hdl/golden [fmc-dio-5chttla]: https://ohwr.org/project/fmc-dio-5chttla/
[coht-vic]: https://ohwr.org/project/coht-vic/
[spec-2-spec]: http://www.ohwr.org/projects/wr-cores/wiki/spec-to-spec [spec-2-spec]: http://www.ohwr.org/projects/wr-cores/wiki/spec-to-spec
[spec-getting-started.pdf]:http://www.ohwr.org/projects/spec-getting-started/wiki [spec-getting-started.pdf]:http://www.ohwr.org/projects/spec-getting-started/wiki
[wr-nic.pdf]: http://www.sevensols.com/dl/wr-nic/doc/latest_stable.pdf [wr-nic.pdf]: http://www.sevensols.com/dl/wr-nic/doc/latest_stable.pdf
[fmc-bus.pdf]: http://www.ohwr.org/attachments/download/2685/fmc-bus-2014-02-release.pdf [fmc-bus.pdf]: http://www.ohwr.org/attachments/download/2685/fmc-bus-2014-02-release.pdf
[spec-sw.pdf]:http://www.sevensols.com/dl/spec-sw/latest_stable.pdf [spec-sw.pdf]:https://www.ohwr.org/project/spec-sw/uploads/1893da4fbb480352be53888d535fd140/spec-sw-2014-02-release.pdf
[wr_external_reference.pdf]: http://www.ohwr.org/attachments/1647/wr_external_reference.pdf [wr_external_reference.pdf]: http://www.ohwr.org/attachments/1647/wr_external_reference.pdf
[wrpc.pdf]: http://www.ohwr.org/attachments/2559/wrpc-v2.1.pdf [wrpc.pdf]: http://www.ohwr.org/attachments/2559/wrpc-v2.1.pdf
[wrpc-v2.1.pdf]: http://www.ohwr.org/attachments/2559/wrpc-v2.1.pdf [wrpc-v2.1.pdf]: http://www.ohwr.org/attachments/2559/wrpc-v2.1.pdf
[Seven Solutions]: http://www.sevensols.com
[wr-starting-kit-v3.0_bin.tar.gz]: <https://ohwr.org/project/wr-starting-kit/wikis/uploads/b63d12f90cd0dbb89b78587603fdcfe6/wr-starting-kit-v3.0_bin.tar.gz>
[spec-golden]: https://www.ohwr.org/project/spec-sw/uploads/636e7eaa2e1c3a884e2f9f694fdfd1b9/spec-init.bin-2015-09-18
[sdbfs-standalone-160812.bin]: <https://www.ohwr.org/project/wr-cores/uploads/9dad995e74a3d49b472b8654833be01a/sdbfs-standalone-160812.bin>
\ No newline at end of file
etherbone @ d1b6b4bd
Subproject commit d1b6b4bd5b1fff8d50adc02665348814c40bb536
Subproject commit eea7bfc82e4cb3554d4343d93dfa75773d7b2fc2
Folder to places patches to apply before compiling the starting kit.
If empty calling this folder will do nothing
#! /bin/bash
# ******************************************************************************
# @file eb-mem.sh
# @brief Script to use easy Etherbone tools
#
# Copyright (C) 2013
#
# Memory access with Etherbone tools
#
# @author Miguel Jimenez Lopez <klyone@ugr.es>
#
# @bug none!
#
# ******************************************************************************
# This library is free software; you can redistribute it and/or
# modify it under the terms of the GNU Lesser General Public
# License as published by the Free Software Foundation; either
# version 3 of the License, or (at your option) any later version.
#
# This library is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
# Lesser General Public License for more details.
#
# You should have received a copy of the GNU Lesser General Public
# License along with this library. If not, see <http//www.gnu.org/licenses/>.
# ******************************************************************************
print_help() {
echo ""
echo "############################################################################"
echo ""
echo "Command: eb-mem <options>"
echo ""
echo "--read|-r: Perform a read operation. It needs a IP and memory address."
echo "--write|-w: Perform a write operation. It needs a IP, memory address and value."
echo "--scan|-s: Perform a scan operation. It needs a IP address."
echo "--compact|-c: Use compact format. Perform a read or write operation depending on arguments"
echo "--tcp|-t: Use TCP packets to communication."
echo "--udp|-u: Use UDP packets to communication."
echo "--bytes|-b: Indicates n-bytes alignment of memory."
echo "--ip|-i: Device IP address."
echo "--port|-p: Use a determinate port."
echo "--address|-a: Device address to read/write access."
echo "--value|-v: Value to write into device."
echo "--help|-h: Show this help."
echo ""
echo "NOTE: This script does not try to implement all options of Etherbone tools."
echo "If you want to execute these operations with other options, you must use "
echo "original tools developped by Etherbone team!!"
echo ""
echo "Examples:"
echo ""
echo "eb-mem --scan --ip 10.10.10.10"
echo "eb-mem --read --ip 10.10.10.10 --address 0x64233"
echo "eb-mem --write --ip 10.10.10.10 --address 0x64233 --value 0x123"
echo "(COMPACT READ) => eb-mem --compact --ip 10.10.10.10 --address 0x64233"
echo "(COMPACT WRITE) => eb-mem --compact --ip 10.10.10.10 --address 0x64233 --value 0x124"
echo ""
echo "############################################################################"
echo ""
}
nargs=$#
EB_TOOLS=${EB_TOOLS-../etherbone/api/tools}
n=0
mode='none'
t_transport='udp'
bytes=4
port=''
ip='none'
address='none'
value='none'
while (($n < $nargs)) ;
do
arg=$1
case $arg in
--read|-r) mode='read'; ;;
--write|-w) mode='write' ;;
--scan|-s) mode='scan' ;;
--compact|-c) mode='compact' ;;
--tcp|-t) t_transport='tcp' ;;
--udp|-u) t_transport='udp' ;;
--bytes|-b) shift; bytes=$1 ;;
--ip|-i) shift; ip=$1 ;;
--port|-p) shift; port="/$1";;
--address|-a) shift; address=$1 ;;
--value|-v) shift; value=$1 ;;
--help|-h) print_help ; exit 0;;
esac
n=$n+1
shift
done
if [ "$mode" = 'none' ];
then
echo "You must get access mode: --scan|--read|--write"
exit -1
fi
if [ "$ip" = 'none' ];
then
echo "You must get IP address to connect with Etherbone core"
exit -1
fi
case $mode in
scan) $EB_TOOLS/eb-ls $t_transport/$ip$port;;
read) if [ "$address" = 'none' ];
then
echo "You must get memory address in read operation"
exit -1
fi
$EB_TOOLS/eb-read $t_transport/$ip$port $address/$bytes
;;
write) if [ "$address" = 'none' ];
then
echo "You must get memory address in write operation"
exit -1
fi
if [ "$value" = 'none' ];
then
echo "You must get value in write operation"
exit -1
fi
$EB_TOOLS/eb-write $t_transport/$ip$port $address/$bytes $value
;;
compact) if [ "$address" = 'none' ];
then
echo "You must get memory address in read or write operation"
exit -1
fi
if [ "$value" = 'none' ];
then
$EB_TOOLS/eb-read $t_transport/$ip$port $address/$bytes
else
$EB_TOOLS/eb-write $t_transport/$ip$port $address/$bytes $value
fi
esac
#!/bin/dash
## Script to apply git patches for submodules.
##
## Authors:
## - Miguel Jimenez Lopez (Seven Solutions, www.sevensols.com)
##
## GNU Lesser General Public License Usage
## This file may be used under the terms of the GNU Lesser
## General Public License version 2.1 as published by the Free Software
## Foundation and appearing in the file LICENSE.LGPL included in the
## packaging of this file. Please review the following information to
## ensure the GNU Lesser General Public License version 2.1 requirements
## will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
#######################################################################################################
### Show help of the function
help ()
{
cat << EOF
Usage: $(basename $0) [Options]
Options:
-h|--help) Show this little help
EOF
exit 0
}
#################################################
### Main execution
GIT_REPOS="spec-sw wrpc-sw wr-nic fmc-dio coht-vic"
MAIN_DIR=".."
PATCHES_DIR="patches"
# setup script dir
sdir=$(dirname $0)
cd $sdir
sdir=$(pwd)
while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in
-h|--help) help;;
*) help;;
esac
shift # Check next set of parameters.
done
for i in $GIT_REPOS
do
if [ -e "$sdir/$MAIN_DIR/$PATCHES_DIR/$i" ] ; then
echo "Patching $i submodule"
cd "$sdir/$MAIN_DIR/$i"
git am $sdir/$MAIN_DIR/$PATCHES_DIR/$i/*.patch
cd "$sdir"
fi
done
...@@ -106,7 +106,11 @@ insthdl() ...@@ -106,7 +106,11 @@ insthdl()
if [ ! -d ${installdir} ]; then if [ ! -d ${installdir} ]; then
sudo mkdir -p ${installdir} sudo mkdir -p ${installdir}
fi fi
sudo cp -v ${DOWNLOADDIR}/spec-init.bin ${DOWNLOADDIR}/wr_nic_dio.bin ${installdir} sudo cp -v ${DOWNLOADDIR}/spec-init.bin \
${DOWNLOADDIR}/wr_nic_dio.bin \
${DOWNLOADDIR}/wr_nic.bin \
${DOWNLOADDIR}/wr_nic_lm32_sw.bin \
${installdir}
wr_echoret $? "OK" "ERROR" wr_echoret $? "OK" "ERROR"
checkdrv; checkdrv;
...@@ -290,7 +294,7 @@ exit 0 ...@@ -290,7 +294,7 @@ exit 0
# setup script dir # setup script dir
scriptdir=$(cd $(dirname $0); pwd) scriptdir=$(cd $(dirname $0); pwd)
DOWNLOADDIR=${scriptdir}/../firmware DOWNLOADDIR=${scriptdir}/../firmware
PKGURL="http://www.ohwr.org/attachments/download/2744/wr-starting-kit-v2.0_gw.tar.gz 9e48bbe6c30b18864ecddceb7627e6e9" PKGURL="https://ohwr.org/project/wr-starting-kit/wikis/uploads/b63d12f90cd0dbb89b78587603fdcfe6/wr-starting-kit-v3.0_bin.tar.gz"
while [ $# -gt 0 ]; do # Until you run out of parameters . . . while [ $# -gt 0 ]; do # Until you run out of parameters . . .
case "$1" in case "$1" in
......
Subproject commit eb9b9d03e3f54657fe29fca93021e2b45380da05 Subproject commit e76f5ca3bcda171318757b603abca131712d086e
# .gitignore file
# configuration file #
######################
configuration.cfg
Tests for WR-starting-kit.
This folder contains test files, documentation file and docker deployment files.
The folders are structured as following:
* `doc`: File documentation.
* `dockers`: Files Dockerfile to deploy WR-starting-kit in differents SO and kernerls.
* `validation`: Python files for tests.
\ No newline at end of file
Dokerfiles to deployment test
==========================
To build image
----------
You need to move to UbuntuXX folder and execute:
sudo docker build -t <name image> .
To run image
----------
You need to execute:
sudo docker run -it <name image>
Show images
----------
sudo docker images
Remove image
----------
sudo docker rmi -f <IMAGE ID>
\ No newline at end of file
# spec-sw Dockerfile ubuntu 16.04
#
#
# Pull base image.
FROM ubuntu:16.04
# Install.
RUN \
apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y git \
build-essential \
python-minimal \
wget \
libreadline-dev \
kmod \
linux-headers-4.4.0-21-generic \
linux-headers-4.8.0-34-generic \
linux-headers-4.10.0-14-generic \
linux-headers-4.13.0-16-generic \
linux-headers-4.15.0-13-generic
# Clone repository and detach HEAD
RUN \
git clone https://ohwr.org/project/wr-starting-kit.git &&\
cd wr-starting-kit &&\
# TODO: preliminary commit for wr-starting-kit-v3.0
git checkout 50f368abff0d4aed8223858f552b3184249695d2
# The kernel version 4.4.0-21-generic does not work
#set enviroment variable for kernel version 4.8.0-34-generic
ENV LINUX /lib/modules/4.8.0-34-generic/build
#construction spec-sw for kernel version 4.8.0-34-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.10.0-14-generic
ENV LINUX /lib/modules/4.10.0-14-generic/build
#construction spec-sw for kernel version 4.10.0-14-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.13.0-16-generic
ENV LINUX /lib/modules/4.13.0-16-generic/build
#construction spec-sw for kernel version 4.13.0-16-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#set enviroment variable for kernel version 4.15.0-13-generic
ENV LINUX /lib/modules/4.15.0-13-generic/build
#construction spec-sw for kernel version 4.15.0-13-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#create file FRU
RUN \
cd /wr-starting-kit/spec-sw/fmc-bus/tools &&\
FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-WR-FMCDIO5ch-2.0-Sx.yyy > example.bin
# Define default command.
CMD ["bash"]
#
# spec-sw Dockerfile ubuntu 18.04
#
#
# Pull base image.
FROM ubuntu:18.04
# Install.
RUN \
apt-get update &&\
apt-get upgrade -y &&\
apt-get install -y git \
build-essential \
python-minimal \
wget \
libreadline-dev \
kmod \
linux-headers-4.15.0-47-generic \
linux-headers-4.18.0-17-generic
# Clone repository and detach HEAD
RUN \
git clone https://ohwr.org/project/wr-starting-kit.git &&\
cd wr-starting-kit &&\
# TODO: preliminary commit for wr-starting-kit-v3.0
git checkout 50f368abff0d4aed8223858f552b3184249695d2
#set enviroment variable for kernel version 4.15.0-47-generic
ENV LINUX /lib/modules/4.15.0-47-generic/build
#construction spec-sw for kerner version 4.15.0-47-generic
RUN \
cd wr-starting-kit &&\
make &&\
make install
#set enviroment variable for kernel version 4.18.0-17-generic
ENV LINUX /lib/modules/4.18.0-17-generic/build
#construction spec-sw for kernel version 4.18.0-17-generic
RUN \
cd wr-starting-kit &&\
make clean &&\
make &&\
make install
#create file FRU
RUN \
cd /wr-starting-kit/spec-sw/fmc-bus/tools &&\
FRU_VENDOR="CERN" FRU_NAME="FmcDio5cha" FRU_PART="EDA-02408-V2-0" \
./fru-generator -s 7S-WR-FMCDIO5ch-2.0-Sx.yyy > example.bin
# Define default command.
CMD ["bash"]
The files in this folder are the following:
* `dio.py`: Class to interact with the ports of the board.
* `loadDriver.py`: Load the driver on the PC.
* `sample.cfg`: Sample configuration file of the tests, to execute the tests must be modified the parameters and renamed the file to `configuration.cfg`.
* `ssh.py`: Class used to execute commands by SSH.
* `testAdvDIO.py`: Verifies the correct reception and sending of packages.
* `testAll.py`: Execute all tests.
* `testDIO.py`: Check all ports of the boards.
* `testNIC.py`: Verifies the correct operation of the Network Interface Core.
* `testWR.py`: Check the correct operation of White Rabbit.
* `vuart.py`: Class to execute commands by virtual uart.
# @file dio.py
#
# @brief This class is to interact with the ports of the board
#
# @author Manuel Castilla
# @date 23/04/2019
#
###########################################################################
from ssh import SshCmd,SshCmdException
## Class DIO
#
class DIO ():
def __init__(self,hostName,userName,password,busId):
"""
Construcctor
Args:
hostName: ip or hostname
userName: username
password : password
busId: number PCIe bus
"""
self.hostName = hostName
self.userName = userName
self.password = password
self.busId = busId
self.command = "sudo wr-dio-cmd /dev/fmc-dio-%i:0" % int(busId,16)
self.sshCmd = SshCmd()
def configurePort(self,channel,mode):
"""
Configure the channel
Args:
channel: number 0 to 4
mode: I/i(Input), 0/1(Output, steady state fixed at 0 low or 1 high),D/d(DIO core output),
P/p(Channel 0 Output PPS),C/c(Channel 4 Clock Input to PTP core)
Raises:
error function
"""
try:
confCommand = self.command + " mode " + str(channel) + " " + mode
self.execCommand(confCommand)
except:
print("Error configure port, channel:",channel,"mode:",mode)
raise
def configurePorts(self,modechannels):
"""
Configure all channels
Args:
modechannels: <modech0><modech1><modech2><modech3><modech4>
Raises:
error function
"""
try:
confCommand = self.command + " mode " + modechannels
self.execCommand(confCommand)
except:
print("Error configure ports, mode channels:",modechannels)
raise
def armPulse(self,channel,period,count):
"""
generate a pulse in a channel
Args:
channel: number 0 to 4
period: pulse period
count: string whih number of instances to run
Raises:
error function
"""
try:
armCommand = self.command + " pulse " + str(channel) + " " + str(period) + " " + count
self.execCommand(armCommand)
except:
print("Error arm pulse, channel:",channel,"period:",period,"count:",count)
raise
def getTimestamp(self,channel):
"""
Get timestamp of channel
Args:
channel: number 0 to 4
Raises:
error function
"""
try:
ret = []
getCommand = self.command + " stamp " + str(channel) + " | cut -f2 -d ,"
stamp = self.execCommand(getCommand)
stampSplit = stamp.split()
for i in stampSplit:
ret.append(float(i))
return ret
except:
print("Error get timestamp, channel:",channel)
raise
def clearTimestamps(self):
"""
Clear all timestamps
Raises:
error function
"""
try:
command = self.command + " stamp &> /dev/null"
self.execCommand(command)
except:
print("Error clear timestamps")
raise
def execCommand(self,command):
"""
Execute a command
Args:
command: command to execute
Raises:
error function
"""
try:
return self.sshCmd.exec(self.hostName,command,self.userName,self.password)
except SshCmdException as e:
self.sshCmd.printSshErrorCommand(e.strError) #print error command
cleanup()
raise
#!/usr/bin/env python3
# @file loadDriver.py
#
# @brief Load the driver on the PC
#
# @author Manuel Castilla
# @date 16/04/2019
#
###########################################################################
from ssh import SshCmd,SshCmdException
import sys
import getpass
error = -1
def loadDriver(hostName,userName,password):
"""
This function load the driver on the PC
Args:
hostName: ip remote host
username: user name
password: password
Return:
True if the driver was loaded correctly, False otherwise
"""
ret = 0
try:
sshCmd = SshCmd()
command = "ifconfig | grep wr | wc -l"
value = sshCmd.exec(hostName,command,userName,password)
if (int(value) == 0):
commands = ["sudo modprobe spec","sudo modprobe htvic",
"sudo modprobe wr-nic","sudo modprobe wr-dio"]
for cmd in commands:
sshCmd.exec(hostName,cmd,userName,password)
command = "ifconfig | grep wr | wc -l"
value = sshCmd.exec(hostName,command,userName,password)
if (int(value) == 0):
ret = error
else:
print("The driver was previously loaded")
except SshCmdException as e:
sshCmd.printSshErrorCommand(e.strError)
ret = error
return ret
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
if len(sys.argv) < 2:
print("usage: app hostaname")
sys.exit(1)
hostName = sys.argv[1]
userName = input("Please enter username: ")
#password = getpass("Please enter password: ")
password = getpass.getpass()
if (loadDriver(hostName,userName,password) == 0):
print("Load driver: ok")
else:
print("Load driver: error")
[pc1]
hostName = 172.17.5.196
userName = test
password = test
busIdSpec = 0x01
interfaceName = wr0
ipWR = 192.168.2.100
[pc2]
hostName = 172.17.5.238
userName = test
password =test
busIdSpec = 0x01
ipWR = 192.168.2.200
interfaceName = wr0
\ No newline at end of file
# @file ssh.py
#
# @brief This class is used to execute commands by SSH
#
# @author Manuel Castilla
# @date 05/04/2019
#
###########################################################################
import paramiko
import os
import time
import warnings
warnings.filterwarnings(action='ignore',module='.*paramiko.*')
class SshCmdException (ValueError):
def __init__(self, arg):
self.strError = arg
self.args = {arg}
## Class SshCmd
# This class implements the snmpcmd command, used to send an
# SSH command to the target device.
class SshCmd ():
def __init__(self,timeWait=10):
"""
Constructor
Args:
timeWait: max time wait to execute commands
"""
self.timeWaitResponse = timeWait
self.ssh = None
def __del__(self):
"""
Destructor
"""
if (self.ssh != None):
self.ssh.close()
def exec(self,dev,command,user,passw=None,withResponse=True):
"""
Execute a command
Args:
dev: ip or hostname
command: command to execute
user: username
passw : password
withResponse: indicates if the command has a response
Raises:
SshCmdException
Return:
command result
"""
resp = ""
try:
self.ssh = paramiko.SSHClient()
self.ssh.set_missing_host_key_policy(paramiko.AutoAddPolicy())
self.ssh.connect(dev, username=user, password=passw,timeout=5)
except paramiko.AuthenticationException as error:
self.ssh.close()
raise SshCmdException("ssh failed autentication")
except:
self.ssh.close()
raise SshCmdException("ssh not connection")
# Send the command (non-blocking)
stdin, stdout, stderr = self.ssh.exec_command(command,get_pty=True)
stdin.close()
stderr.close()
if (withResponse):
# Wait for the command to terminate
i = 0
while not stdout.channel.exit_status_ready():
if i == self.timeWaitResponse:
stdout.channel.close()
stdout.close()
self.ssh.close()
raise SshCmdException("Not return command")
i = i + 1
time.sleep(1)
# Only print data if there is data to read in the channel
if stdout.channel.recv_exit_status() == 0:
resp = stdout.read().decode('utf-8')
else:
resp = stdout.read().decode('utf-8')
stdout.channel.close()
stdout.close()
self.ssh.close()
raise SshCmdException(resp)
#Close fds
stdout.channel.close()
stdout.close()
self.ssh.close()
return resp
def printSshErrorCommand(self,sshError,command = None):
"""
Print error command
Args:
sshError: error message
command: cammand executed
"""
if command != None:
print("Ssh error:",sshError,"Command:",command)
else:
print("Ssh error:",sshError)
#!/usr/bin/env python3
# @file testAdvDIO.py
#
# @brief Check the correct reception and sending of packages
#
# @author Manuel Castilla
# @date 25/04/2019
#
###########################################################################
import configparser
from dio import DIO
import time
from ssh import SshCmd,SshCmdException
delay = 0.001
maxOffset = 0.000000008
def findTimestamp(listStamp1,listStamp2,offset):
"""
This function compare two list and search if two timestamps match
Args:
listStamp1: first list of timestamps
listStamp2: second list of timestamps
offset: maximum offset between each comparison
Return:
True if it find a match in the two lists, False otherwise
"""
for i in listStamp1:
for j in listStamp2:
value = i - j
if (value <= offset and value >= -offset):
return True
return False
def testAdvDIO(hostName1,userName1,password1,interfaceName1,busId1,hostName2,userName2,password2,interfaceName2,busId2):
"""
Check the pulses generated on a remote board
Args:
hostName1: ip remote host 1
username1: user name host 1
password1: password
interfaceName1 : interface name
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
username2: user name host 2
password2: password
interfaceName2 : interface name
busId2: number PCIe bus PC 2
Raises:
error test
"""
try:
sshCmd1 = SshCmd()
sshCmd2 = SshCmd()
dio1 = DIO(hostName1,userName1,password1,busId1)
dio2 = DIO(hostName2,userName2,password2,busId2)
dio1.configurePorts("pdiii")
dio2.configurePorts("iiiii")
dio1.clearTimestamps()
dio2.clearTimestamps()
command = "sudo wr-dio-agent %s /dev/fmc-dio-%i:0" % (interfaceName1,int(busId1,16))
sshCmd1.exec(hostName1,command,userName1,password1,False)
command = "sudo wr-dio-ruler %s /dev/fmc-dio-%i:0 IN0 R1+%s" % (interfaceName2,int(busId1,16),str(delay))
sshCmd2.exec(hostName2,command,userName2,password2,False)
totalOffset = delay + maxOffset
time.sleep(2)
if(not findTimestamp(dio1.getTimestamp(0),dio1.getTimestamp(1),totalOffset)):
raise
except SshCmdException as e:
SshCmd.printSshErrorCommand(e.strError,command)
raise
except:
print("Test advanced error")
raise
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
def main(configuration):
hostName1 = configuration["hostName1"]
userName1 = configuration["userName1"]
password1 = configuration["password1"]
interfaceName1 = configuration["interfaceName1"]
busIdSpec1 = configuration["busIdSpec1"]
hostName2 = configuration["hostName2"]
userName2 = configuration["userName2"]
password2 = configuration["password2"]
interfaceName2 = configuration["interfaceName2"]
busIdSpec2 = configuration["busIdSpec2"]
try:
print("\nExecuting advanced DIO test")
print("This test needs White Rabbit working")
testAdvDIO(hostName1,userName1,password1,interfaceName1,busIdSpec1,hostName2,userName2,password2,interfaceName2,busIdSpec2)
print("Test advanced DIO: successful")
except:
print("Test advanced DIO: error")
if __name__ == '__main__':
try:
configuration = {}
nameConfig = "configuration.cfg"
config = configparser.ConfigParser()
config.readfp(open(nameConfig))
configuration["hostName1"] = config.get('pc1',"hostName")
configuration["userName1"] = config.get('pc1',"userName")
configuration["password1"] = config.get('pc1',"password")
configuration["interfaceName1"] = config.get('pc1',"interfaceName")
configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
configuration["hostName2"] = config.get('pc2',"hostName")
configuration["userName2"] = config.get('pc2',"userName")
configuration["password2"] = config.get('pc2',"password")
configuration["interfaceName2"] = config.get('pc2',"interfaceName")
configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
main(configuration)
except configparser.Error as e:
print("Error load configuration:",e.message)
#!/usr/bin/env python3
# @file testAll.py
#
# @brief Execute all tests
#
# @author Manuel Castilla
# @date 29/04/2019
#
###########################################################################
import configparser
tests = ["testNIC","testWR","testDIO","testAdvDIO"]
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
def main(configuration):
print("Executing all tests")
for i in tests:
test = __import__(i)
test.main(configuration)
print("Test All: completed")
if __name__ == '__main__':
try:
configuration = {}
nameConfig = "configuration.cfg"
config = configparser.ConfigParser()
config.readfp(open(nameConfig))
configuration["hostName1"] = config.get('pc1',"hostName")
configuration["userName1"] = config.get('pc1',"userName")
configuration["password1"] = config.get('pc1',"password")
configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
configuration["ipWR1"] = config.get('pc1',"ipWR")
configuration["interfaceName1"] = config.get('pc1',"interfaceName")
configuration["hostName2"] = config.get('pc2',"hostName")
configuration["userName2"] = config.get('pc2',"userName")
configuration["password2"] = config.get('pc2',"password")
configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
configuration["ipWR2"] = config.get('pc2',"ipWR")
configuration["interfaceName2"] = config.get('pc2',"interfaceName")
main(configuration)
except configparser.Error as e:
print("Error load configuration:",e.message)
#!/usr/bin/env python3
# @file testDIO.py
#
# @brief Check all ports of the boards
#
# @author Manuel Castilla
# @date 25/04/2019
#
###########################################################################
import configparser
from dio import DIO
import time
maxOffset = 0.000000017 #offset 17 nanoseconds
def findTimestamp(listStamp1,listStamp2,offset):
"""
This function compare two list and search if two timestamps match
Args:
listStamp1: first list of timestamps
listStamp2: second list of timestamps
offset: maximum offset between each comparison
Return:
True if it find a match in the two lists, False otherwise
"""
for i in listStamp1:
for j in listStamp2:
value = i - j
if (value <= offset and value >= -offset):
return True
return False
def tryChannel(hostName1,userName1,password1,busId1,hostName2,userName2,password2,busId2,channel):
"""
Try the input and output of channel
Args:
hostName1: ip remote host 1
username1: user name host 1
password1: password
busId1: number PCIe bus PC 1
hostName2: ip remote host 2
username2: user name host 2
password2: password
busId2: number PCIe bus PC 2
channel: number of channel to try(0 to 4)
Return:
True if the channel fail, False otherwise
"""
try:
dio1 = DIO(hostName1,userName1,password1,busId1)
dio2 = DIO(hostName2,userName2,password2,busId2)
dio1.configurePorts("pdddd")
dio2.configurePorts("iiiii")
dio1.clearTimestamps()
dio2.clearTimestamps()
if (channel != 0):
dio1.armPulse(channel,0.1,"now")
else:
time.sleep(2) #wait 2 seconds to ensure some timestamp
if(findTimestamp(dio1.getTimestamp(channel),dio2.getTimestamp(channel),maxOffset)):
dio1.configurePorts("iiiii")
dio2.configurePorts("pdddd")
dio1.clearTimestamps()
dio2.clearTimestamps()
if (channel != 0):
dio2.armPulse(channel,0.1,"now")
else:
time.sleep(2) #wait 2 seconds to ensure some timestamp
if(findTimestamp(dio1.getTimestamp(channel),dio2.getTimestamp(channel),maxOffset)):
print("Channel",channel,": ok in host:",hostName1,"and host:",hostName2)
return False
else:
raise
else:
raise
except:
print("Channel",channel,": error in host:",hostName1,"or host:",hostName2)
return True
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
def main(configuration):
hostName1 = configuration["hostName1"]
userName1 = configuration["userName1"]
password1 = configuration["password1"]
busIdSpec1 = configuration["busIdSpec1"]
hostName2 = configuration["hostName2"]
userName2 = configuration["userName2"]
password2 = configuration["password2"]
busIdSpec2 = configuration["busIdSpec2"]
error = False
numberChannels = 5
print("\nExecuting DIO test")
print("This test needs White Rabbit working")
for i in range(numberChannels):
error |= tryChannel(hostName1,userName1,password1,busIdSpec1,hostName2,userName2,password2,busIdSpec2,i)
if(not error):
print("Test DIO: successful")
else:
print("Test DIO: error")
if __name__ == '__main__':
try:
configuration = {}
nameConfig = "configuration.cfg"
config = configparser.ConfigParser()
config.readfp(open(nameConfig))
configuration["hostName1"] = config.get('pc1',"hostName")
configuration["userName1"] = config.get('pc1',"userName")
configuration["password1"] = config.get('pc1',"password")
configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
configuration["hostName2"] = config.get('pc2',"hostName")
configuration["userName2"] = config.get('pc2',"userName")
configuration["password2"] = config.get('pc2',"password")
configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
main(configuration)
except configparser.Error as e:
print("Error load configuration:",e.message)
#!/usr/bin/env python3
# @file testNIC.py
#
# @brief Check the correct operation of the Network Interface Core
#
# @author Manuel Castilla
# @date 16/04/2019
#
###########################################################################
from ssh import SshCmd,SshCmdException
from vuart import Vuart
import configparser
def configurationIpInterface(hostName,userName,password,busId,interfaceName,ip):
"""
Set ip of white rabbit interface
Args:
hostName: ip remote host
username: user name
password: password
busId: number PCIe bus
interfaceName : interface name
ip : ip set interface
Raises:
error function
"""
try:
sshCmd = SshCmd()
#check network manager
command = "sudo service network-manager status | grep running"
value = sshCmd.exec(hostName,command,userName,password)
if ("running" in value):
print("\nWarning: The network manager is running on host %s, the test may not work correctly\n" % ip)
command = "sudo ifconfig " + interfaceName + " " + ip
sshCmd.exec(hostName,command,userName,password)
command = "ifconfig | grep " + ip + " | wc -l"
value = sshCmd.exec(hostName,command,userName,password)
if (int(value) == 1):
print("Configuration ip interface: ok on host:",hostName)
else:
raise
except SshCmdException as e:
sshCmd.printSshErrorCommand(e.strError,command)
print("Configuration ip interface: error on host:",hostName)
raise
except:
print("Configuration ip interface: error on host:",hostName)
raise
def testIperf(hostName,userName,password,ip,hostName2,userName2,password2):
"""
Test iperf by white rabbit interfaces
Args:
hostName: ip remote host client
username: user name client
password: password
ip : ip server
hostName2: ip remote host server
username2: user name server
password2: password
Raises:
error function
"""
try:
sshCmdServer = SshCmd()
sshCmdClient = SshCmd()
command = "iperf -s"
sshCmdServer.exec(hostName2,command,userName2,password2,withResponse=False)
command = "iperf -t 4 -c " + str(ip)
value = sshCmdClient.exec(hostName,command,userName,password)
if ("failed" in value):
print("Test iperf: error")
raise
else:
print(value)
print("Test iperf: ok")
except SshCmdException as e:
print("Test iperf: error")
print(e.strError)
raise
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
def main(configuration):
hostName1 = configuration["hostName1"]
userName1 = configuration["userName1"]
password1 = configuration["password1"]
busIdSpec1 = configuration["busIdSpec1"]
ipWR1 = configuration["ipWR1"]
interfaceName1 = configuration["interfaceName1"]
hostName2 = configuration["hostName2"]
userName2 = configuration["userName2"]
password2 = configuration["password2"]
busIdSpec2 = configuration["busIdSpec2"]
ipWR2 = configuration["ipWR2"]
interfaceName2 = configuration["interfaceName2"]
try:
print("\nExecuting NIC test")
print("This test needs the network manager stopped")
configurationIpInterface(hostName1,userName1,password1,busIdSpec1,interfaceName1,ipWR1)
configurationIpInterface(hostName2,userName2,password2,busIdSpec2,interfaceName2,ipWR2)
testIperf(hostName1,userName1,password1,ipWR2,hostName2,userName2,password2)
print("Test NIC: successful")
except:
print("Test NIC: error")
if __name__ == '__main__':
try:
configuration = {}
nameConfig = "configuration.cfg"
config = configparser.ConfigParser()
config.readfp(open(nameConfig))
configuration["hostName1"] = config.get('pc1',"hostName")
configuration["userName1"] = config.get('pc1',"userName")
configuration["password1"] = config.get('pc1',"password")
configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
configuration["ipWR1"] = config.get('pc1',"ipWR")
configuration["interfaceName1"] = config.get('pc1',"interfaceName")
configuration["hostName2"] = config.get('pc2',"hostName")
configuration["userName2"] = config.get('pc2',"userName")
configuration["password2"] = config.get('pc2',"password")
configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
configuration["ipWR2"] = config.get('pc2',"ipWR")
configuration["interfaceName2"] = config.get('pc2',"interfaceName")
main(configuration)
except configparser.Error as e:
print("Error load configuration:",e.message)
#!/usr/bin/env python3
# @file testWR.py
#
# @brief Check the correct operation of White Rabbit
#
# @author Manuel Castilla
# @date 23/04/2019
#
###########################################################################
from vuart import Vuart
import configparser
import time
def whoIsMaster(hostName,userName,password,busId):
"""
This function asks which spec has SFP purple (master)
Args:
hostName: ip remote host
username: user name
password: password
busId: number PCIe bus
Return:
True if the spec has SFP purple, False otherwise
"""
ret = False
try:
vuart = Vuart(hostName,userName,password,busId)
value = vuart.sfpDetect()
if ("AXGE-3454-0531" in value):
ret = True
except:
print("Who is master: error, host:",hostName)
raise
return ret
def putMode(hostName,userName,password,busId,mode):
"""
This function puts in mode master an spec
Args:
hostName: ip remote host
username: user name
password: password
busId: number PCIe bus
mode: mode ptp status("master","slave")
Raises:
error function
"""
try:
vuart = Vuart(hostName,userName,password,busId)
if (mode == "master"):
vuart.modeMaster()
else:
vuart.modeSlave()
vuart.ptpStart()
value = vuart.mode()
if(mode in value):
print("Put mode", mode,": ok, host:",hostName)
else:
raise
except:
print("Put mode: error, host:",hostName)
raise
def checkTrackPhase(hostName,userName,password,busId):
"""
This function check if the state is TRACK_PHASE
Args:
hostName: ip remote host
username: user name
password: password
busId: number PCIe bus
Raises:
error function
"""
try:
vuart = Vuart(hostName,userName,password,busId)
numberTimesTry = 15
i = 0
while not vuart.isTrackPhase():
if (i == numberTimesTry):
raise
i = i + 1
time.sleep(1)
print("Track Phase: ok")
except:
print("Track phase: error, host:",hostName)
raise
#--------------------------------------------------#
#--------------------------------------------------#
# MAIN
#--------------------------------------------------#
#--------------------------------------------------#
def main(configuration):
hostName1 = configuration["hostName1"]
userName1 = configuration["userName1"]
password1 = configuration["password1"]
busIdSpec1 = configuration["busIdSpec1"]
interfaceName1 = configuration["interfaceName1"]
hostName2 = configuration["hostName2"]
userName2 = configuration["userName2"]
password2 = configuration["password2"]
busIdSpec2 = configuration["busIdSpec2"]
interfaceName2 = configuration["interfaceName2"]
try:
print("\nExecuting WR test")
masterSpec1 = whoIsMaster(hostName1,userName1,password1,busIdSpec1)
masterSpec2 = whoIsMaster(hostName2,userName2,password2,busIdSpec2)
if (masterSpec1 == 1 or masterSpec2 == 1):
if (masterSpec1 == 1):
putMode(hostName2,userName2,password2,busIdSpec2,"slave")
putMode(hostName1,userName1,password1,busIdSpec1,"master")
checkTrackPhase(hostName2,userName2,password2,busIdSpec2)
else:
putMode(hostName1,userName1,password1,busIdSpec1,"slave")
putMode(hostName2,userName2,password2,busIdSpec2,"master")
checkTrackPhase(hostName1,userName1,password1,busIdSpec1)
print("Test WR: successful")
else:
print("Error: It is not possible to know who is master")
raise
except:
print("Test WR: error")
if __name__ == '__main__':
try:
configuration = {}
nameConfig = "configuration.cfg"
config = configparser.ConfigParser()
config.readfp(open(nameConfig))
configuration["hostName1"] = config.get('pc1',"hostName")
configuration["userName1"] = config.get('pc1',"userName")
configuration["password1"] = config.get('pc1',"password")
configuration["busIdSpec1"] = config.get('pc1',"busIdSpec")
configuration["interfaceName1"] = config.get('pc1',"interfaceName")
configuration["hostName2"] = config.get('pc2',"hostName")
configuration["userName2"] = config.get('pc2',"userName")
configuration["password2"] = config.get('pc2',"password")
configuration["busIdSpec2"] = config.get('pc2',"busIdSpec")
configuration["interfaceName2"] = config.get('pc2',"interfaceName")
main(configuration)
except configparser.Error as e:
print("Error load configuration:",e.message)
# @file vuart.py
#
# @brief This class is to execute commands by virtual uart
#
# @author Manuel Castilla
# @date 23/04/2019
#
###########################################################################
from ssh import SshCmd,SshCmdException
## Class Vuart
#
class Vuart ():
def __init__(self,hostName,userName,password,busId):
"""
Construcctor
Args:
hostName: ip or hostname
userName: username
password : password
busId: bus ID PCIe
"""
self.hostName = hostName
self.userName = userName
self.password = password
self.busId = busId
self.sshCmd = SshCmd()
self.command = ""
parse_dev = self.vUartCommand("lspci | grep CERN | cut -f2 -d :").split(".")
if (len(parse_dev) > 1):
self.command = "sudo wrpc-vuart -f /sys/bus/pci/devices/0000\:00\:%02x.0/0000" \
"\:%02x\:%02x.0/resource0 -o 0x20500 -c " % (int(busId,16),int(busId,16),int(parse_dev[0],16))
else:
print("Error: Spec does not detected on host: %s" % hostName)
raise
def setIp(self,ip):
"""
Set IP
Args:
ip: IP to assing
Return:
Result set ip
Raises:
error function
"""
try:
command = "ip\ set\ " + str(ip)
return self.vUartCommand(command)
except:
print("Error set ip:",ip)
raise
def modeMaster(self):
"""
Configure the board in master mode
Return:
Result mode master
Raises:
error function
"""
try:
command = "mode\ master"
return self.vUartCommand(command)
except:
print("Error mode master")
raise
def modeSlave(self):
"""
Configure the board in slave mode
Return:
Result mode slave
Raises:
error function
"""
try:
command = "mode\ slave"
return self.vUartCommand(command)
except:
print("Error mode slave")
raise
def sfpDetect(self):
"""
Ask SFP value
Return:
SFP value
Raises:
error function
"""
try:
command = "sfp\ match"
return self.vUartCommand(command)
except:
print("Error sfp detect")
raise
def ptpStart(self):
"""
Start PTP daemon
Return:
Result
Raises:
error function
"""
try:
command = "ptp\ start"
return self.vUartCommand(command)
except:
print("Error ptp start")
raise
def ptpStop(self):
"""
Stop PTP daemon
Return:
Result
Raises:
error function
"""
try:
command = "ptp\ stop"
return self.vUartCommand(command)
except:
print("Error ptp stop")
raise
def mode(self):
"""
Ask board mode
Return:
Board mode ("master" or "slave")
Raises:
error function
"""
try:
command = "mode"
return self.vUartCommand(command)
except:
print("Error mode")
raise
def isTrackPhase(self):
"""
Ask if the slave board is in TRACK_PHASE
Return:
True if TRACK_PHASE, False otherwise
Raises:
error function
"""
try:
ret = False
command = "stat\ 1"
value = self.vUartCommand(command)
if ("sv:1 ss:'TRACK_PHASE'" in value):
ret = True
return ret
except:
print("Error track phase")
raise
def vUartCommand(self,command):
"""
Execute a command
Args:
command: command to execute
Raises:
error function
"""
try:
uartCommand = self.command + command
ret = self.sshCmd.exec(self.hostName,uartCommand,self.userName,self.password)
if ("Unrecognized command" in ret):
print(ret)
raise
return ret
except SshCmdException as e:
self.sshCmd.printSshErrorCommand(e.strError) #print error command
cleanup()
raise
Subproject commit 2ff6c419ea4a23cb9ffc043f6c03d831e81f9f2f
Subproject commit 3c9b25b8c9afff89f425f4974a361e1a0c8bed8d
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment