fancy new table style, used in ADC now

master
Ondřej Hruška 6 years ago
parent 05a2b1d93e
commit 04cc505be1
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 199
      ch.unit.adc.tex
  2. 34
      ch.unit.di.tex
  3. 82
      document_config.tex
  4. BIN
      thesis.pdf

@ -4,3 +4,202 @@ The analog/digital converter unit is one of the most complicated units implement
It's possible to activate any number of the 16 analog inputs of the ADC peripheral simultaneously. The maximum continuous sampling frequency, which reaches 70\,ksps with one channel, lowers with an increasing number of enabled channels as the amount of data to transfer to the host increases.
\subsection{ADC Configuration}
\begin{inicode}
[ADC:adc@8]
# Enabled channels, comma separated
# 0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17
# A0 A1 A2 A3 A4 A5 A6 A7 B0 B1 C0 C1 C2 C3 C4 C5 Tsens Vref
channels=16
# Sampling time (0-7)
sample_time=2
# Sampling frequency (Hz)
frequency=1000
# Sample buffer size
# - shared by all enabled channels
# - defines the maximum pre-trigger size (divide by # of channels)
# - captured data is sent in half-buffer chunks
# - buffer overrun aborts the data capture
buffer_size=256
# Enable continuous sampling with averaging
# Caution: This can cause DAC output glitches
averaging=Y
# Exponential averaging coefficient (permil, range 0-1000 ~ 0.000-1.000)
# - used formula: y[t]=(1-k)*y[t-1]+k*u[t]
# - not available when a capture is running
avg_factor=500
\end{inicode}
\subsection{ADC Events}
\begin{cmdlist}
50 & \cname{TRIGGERED}
The first event generated when a triggering condition occurs. The payload includes pre-trigger and the transaction continues with a sequence of CAPTURE events sharing the same frame ID. The serial number is incremented with each stream chunk and can be used to detect lost data frames.
&
\begin{cmdpld}
\cfield{u32} pre-trigger length
\cfield{u8} triggering edge (1-falling, 2-rising, 3-forced)
\cfield{u8} stream serial number
\cfield{u16[]} pre-trigger data
\end{cmdpld}
\\
51 & \cname{CAPTURE\_DATA}
A chunk of sampled data in a stream, block, or a triggered capture. More data will follow.
&
\begin{cmdpld}
\cfield{u8} stream serial number
\cfield{u16[]} sample data
\end{cmdpld}
\\
52 & \cname{CAPTURE\_END}
Indicates the end of a multi-part capture. The payload may be empty if there is no more data to send (e.g. a stream had to be unexpectedly closed).
&
\begin{cmdpld}
\cfield{u8} stream serial number
\cfield{u16[]} sample data
\end{cmdpld}
\end{cmdlist}
\subsection{ADC Commands}
\begin{cmdlist}
0 & \cname{READ\_RAW}
Get the last raw sample from enabled channels.
&
\begin{cmdresp}
\cfield{u16[]} raw values 0-4095
\end{cmdresp}
\\
1 & \cname{READ\_SMOOTHED}
Get the averaged values from enabled channels. Not available for high sample rates and when disabled.
&
\begin{cmdresp}
\cfield{float32[]} smoothed values 0-4095
\end{cmdresp}
\\
2 & \cname{READ\_CAL\_CONSTANTS}
Read factory calibration constants from the MCU's ROM
&
\begin{cmdresp}
\cfield{u16} VREFINT\_CAL (raw word)
\cfield{u16} VREFINT\_CAL\_VADCREF (mV)
\cfield{u16} TSENSE\_CAL1 (raw word)
\cfield{u16} TSENSE\_CAL2 (raw word)
\cfield{u16} TSENSE\_CAL1\_TEMP (°C)
\cfield{u16} TSENSE\_CAL2\_TEMP (°C)
\cfield{u16} TSENSE\_CAL\_VADCREF (mV)
\end{cmdresp}
\\
10 &
\cname{GET\_ENABLED\_CHANNELS}
Get numbers of all enabled channels (0-based)
&
\begin{cmdresp}
\cfield{u8[]} enabled channel numbers
\end{cmdresp}
\\
11 &
\cname{GET\_SAMPLE\_RATE}
Get the current sample rate (in Hz)
&
\begin{cmdresp}
\cfield{u32} requested sample rate
\cfield{float32} real sample rate
\end{cmdresp}
\\
20 &
\cname{SETUP\_TRIGGER}
Configure the triggering level and other trigger parameters. This command does \textit{not} arm the trigger!
&
\begin{cmdreq}
\cfield{u8} source channel number
\cfield{u16} triggering level
\cfield{u8} active edge (1-falling, 2-rising, 3-any)
\cfield{u32} pre-trigger sample count
\cfield{u32} post-trigger sample count
\cfield{u16} hold-off time (ms)
\cfield{u8} auto re-arm (0,1)
\end{cmdreq}
\\
21 & \cname{ARM}
Arm the trigger for capture.
&
\begin{cmdreq}
\cfield{u8} auto re-arm (0, 1, 255-no change)
\end{cmdreq}
\\
22 & \cname{DISARM}
Dis-arm the trigger.
& \\
23 & \cname{ABORT}
Abort any ongoing capture and dis-arm the trigger.
& \\
24 & \cname{FORCE\_TRIGGER}
Manually trip the trigger, as if the threshold level was reached.
& \\
25 & \cname{BLOCK\_CAPTURE}
Capture a fixed-length sequence of samples.
&
\begin{cmdreq}
\cfield{u32} number of samples
\end{cmdreq}
\\
26 & \cname{STREAM\_START}
Start a real-time stream of samples
& \\
27 & \cname{STREAM\_STOP}
Stop an ongoing stream
& \\
28 & \cname{SET\_SMOOTHING\_FACTOR}
Set the smoothing factor ($\times10^3$). %TODO add the formula
&
\begin{cmdreq}
\cfield{u16} smoothing factor 0-1000
\end{cmdreq}
\\
29 & \cname{SET\_SAMPLE\_RATE}
Set the sampling frequency.
&
\begin{cmdreq}
\cfield{u32} frequency in Hz
\end{cmdreq}
\\
30 & \cname{ENABLE\_CHANNELS}
Select channels to sample. The channels must be configured in the unit settings.
&
\begin{cmdreq}
\cfield{u32} bit map of channels to enable
\end{cmdreq}
\\
31 & \cname{SET\_SAMPLE\_TIME}
Set the sample time of the ADC's sample\&hold circuit.
&
\begin{cmdreq}
\cfield{u8} sample time 0--7
\end{cmdreq}
\end{cmdlist}

@ -10,23 +10,23 @@ The pin change event can be configured independently for each pin. In order to r
\subsection{Digital Input Configuration}
\begin{inicode}
[DI:in@2]
# Port name
port=A
# Pins (comma separated, supports ranges)
pins=0
# Pins with pull-up
pull-up=
# Pins with pull-down
pull-down=
# Trigger pins activated by rising/falling edge
trig-rise=
trig-fall=
# Trigger pins auto-armed by default
auto-trigger=
# Triggers hold-off time (ms)
hold-off=100
[DI:in@2]
# Port name
port=A
# Pins (comma separated, supports ranges)
pins=0
# Pins with pull-up
pull-up=
# Pins with pull-down
pull-down=
# Trigger pins activated by rising/falling edge
trig-rise=
trig-fall=
# Trigger pins auto-armed by default
auto-trigger=
# Triggers hold-off time (ms)
hold-off=100
\end{inicode}
\subsection{Digital Input Events}

@ -14,8 +14,11 @@
\usepackage{cprotect}
\usepackage{framed}
\usepackage{subcaption}
\usepackage{tabularx}
\usepackage{tabulary}
\usepackage{longtable}
\usepackage{tabu}
\usepackage{flafter} % ensures embeds won't go before their references
\usepackage{enumitem} % better list spacing
@ -25,16 +28,87 @@
\usepackage{makecell}
\newminted{ini}{frame=leftline,autogobble=true}
% Deprecated crap
\newcommand{\tabitem}{~~\llap{\textbullet}~~}
\newcommand{\tabitemo}{~~\llap{\textopenbullet}~~}
\newcommand\fld[1]{\tabitem \verb|#1|:}
\newcommand\fldo[1]{\tabitemo \verb|#1|:}
\newcommand\fld[1]{\tabitem \texttt{#1}:}
\newcommand\fldo[1]{\tabitemo \texttt{#1}:}
\newcommand{\fldwcode}{2.2em}
\newcommand{\fldwpld}{.35\textwidth}
\newcommand{\fldreq}{\textit{Request}\newline}
\newcommand{\fldresp}{\textit{Response}\newline}
\newcommand\flname[1]{\textbf{#1}\newline}
\newcommand{\fldreq}{\textit{Request}\\}
\newcommand{\fldresp}{\textit{Response}\\}
\newcommand{\cfield}[1]{\item \texttt{#1:}}
\newcommand{\cname}[1]{\textbf{#1}\newline}
% https://tex.stackexchange.com/questions/157389/how-to-center-column-values-in-a-table
% P will be a centered column that can have width
\newcolumntype{P}[1]{>{\centering\arraybackslash}p{#1}}
% This is a table of commands of events
\newenvironment{cmdlist}
{
\tabulinesep=3pt
\begin{longtabu} to \textwidth {P{\fldwcode} X[3] X[3,l]}
\toprule
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
\endhead
\bottomrule
\endfoot
}
{
\end{longtabu}
}
% a list of generic payload fields
\newenvironment{cmdpldlist}
{
%topsep=0pt,partopsep=0pt,
\begin{itemize}[
leftmargin=.5cm,
nosep,
after = \vspace{-.7\baselineskip} % remove the weird newline after the list
]
}
{
\end{itemize}
}
% a list of request fields, with a caption
\newenvironment{cmdreq}
{
\textit{Request:}
\begin{cmdpldlist}
}
{
\end{cmdpldlist}
}
% a list of request fields, with a caption
\newenvironment{cmdresp}
{
\textit{Response:}
\begin{cmdpldlist}
}
{
\end{cmdpldlist}
}
% a list of payload fields, with a caption
\newenvironment{cmdpld}
{
\textit{Payload:}
\begin{cmdpldlist}
}
{
\end{cmdpldlist}
}
\newcommand{\uF}{\micro\farad}

Binary file not shown.
Loading…
Cancel
Save