more work on units, ebtter table layout

master
Ondřej Hruška 6 years ago
parent dabde5fd03
commit 05a2b1d93e
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 93
      ch.unit.1wire.tex
  2. 27
      ch.unit.di.tex
  3. 23
      ch.unit.do.tex
  4. 185
      ch.unit.fcap.tex
  5. 21
      ch.unit.i2c.tex
  6. 36
      ch.unit.npx.tex
  7. 22
      ch.unit.sipo.tex
  8. 14
      ch.unit.spi.tex
  9. 90
      ch.unit.usart.tex
  10. 3
      document_config.tex
  11. BIN
      thesis.pdf

@ -1,3 +1,94 @@
\section{1-Wire Unit}
The 1-Wire unit implements the Dallas Semiconductor's 1-Wire protocol, most commonly used to interface smart thermometers (DS18x20). The protocol is explained in section \ref{sec:theory-1wire}. This unit implements the basic protocol, as well as the ROM Search algorithm used to recognizes all unique 1-Wire devices connected to the bus.
The 1-Wire unit implements the Dallas Semiconductor's 1-Wire protocol, most commonly used to interface smart thermometers (DS18x20). The protocol is explained in section \ref{sec:theory-1wire}.
This unit implements the ROM Search algorithm that is used to find the unique IDs of all 1-Wire devices connected to the bus. The algorithm can find up to 32 devices in one run; More devices can be found by issuing the SEARCH\_CONTINUE command.
Devices are addressed using their 64-bit (8-byte) identifiers. When only one device is connected, the value 0 may be used and the addressing will be skipped. Its ID may be recovered using the READ\_ADDR command or by the search algorithm.
\subsection{1-Wire Configuration}
\begin{inicode}
[1WIRE:ow@7]
# Data pin
pin=A0
# Parasitic (bus-powered) mode
parasitic=N
\end{inicode}
\subsection{1-Wire Events}
This unit generates no events.
\subsection{1-Wire Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0 & \flname{CHECK\_PRESENCE}
Test if there are any devices attached to the bus.
& \makecell[tl]{
\fldresp
\fld{u8} presence detected (0, 1)
} \\
1 & \flname{SEARCH\_ADDR}
Start the search algorithm.
& \makecell[tl]{
\fldresp
\fld{u8} should continue (0, 1) \\
\fld{u64[]} device addresses
} \\
2 & \flname{SEARCH\_ALARM}
Start the search algorithm, finding only devices in an alarm state.
& \makecell[tl]{
\fldresp
\fld{u8} should continue (0, 1) \\
\fld{u64[]} device addresses
} \\
3 & \flname{SEARCH\_CONTINUE}
Continue a previously started search
& \makecell[tl]{
\fldresp
\fld{u8} should continue (0, 1) \\
\fld{u64[]} device addresses
} \\
4 & \flname{READ\_ADDR}
Read a device address (single device only)
& \makecell[tl]{
\fldresp
\fld{u64} device address
} \\
10 & \flname{WRITE}
Write bytes to a device.
& \makecell[tl]{
\fldreq
\fld{u64} device address \\
\fld{u8[]} bytes to write
} \\
11 & \flname{READ}
Write a request and read response.
& \makecell[tl]{
\fldreq
\fld{u64} device address \\
\fld{u16} read length \\
\fld{u8} verify checksum (0, 1) \\
\fld{u8[]} request bytes
} \\
20 & \flname{POLL\_FOR\_1}
Wait for a READY status, used by DS18x20.
Not available in parasitic mode.
Responds with SUCCESS after all devices are ready.
& \\
\bottomrule
\end{tabularx}

@ -1,4 +1,4 @@
\section{DI: Digital Input}
\section{Digital Input}
The digital input unit is the input counterpart of the digital output unit.
@ -7,7 +7,7 @@ In addition to reading the immediate digital levels of the selected pins, this u
The pin change event can be configured independently for each pin. In order to receive a pin change event, it must be armed first; The pin can be armed for a single event, or it may be re-armed automatically with a hold-off time. It's further possible to automatically arm selected pin triggers on start-up.
\subsection{DI Configuration}
\subsection{Digital Input Configuration}
\begin{inicode}
[DI:in@2]
@ -29,14 +29,15 @@ The pin change event can be configured independently for each pin. In order to r
hold-off=100
\end{inicode}
\subsection{DI Events}
\subsection{Digital Input Events}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Meaning} & \textbf{Payload} \\
\textbf{Code} & \textbf{Meaning} & \textbf{Payload} \\
\midrule
0x00 & PIN\_CHANGE & A pin change event. The payload includes a snapshot of all configured pins captured immediately after the change was registered.
0 & \flname{PIN\_CHANGE}
A pin change event. The payload includes a snapshot of all configured pins captured immediately after the change was registered.
& \makecell[tl]{
\fld{u16} changed pins \\
\fld{u16} port snapshot
@ -44,32 +45,32 @@ The pin change event can be configured independently for each pin. In order to r
\bottomrule
\end{tabularx}
\subsection{DI Commands}
\subsection{Digital Input Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & READ & Read the pins
0 & \flname{READ} Read the pins
& \makecell[tl]{
\fldresp
\fld{u16} pin states
} \\
0x01 & ARM\_SINGLE & Arm for a single event
1 & \flname{ARM\_SINGLE} Arm for a single event
& \makecell[tl]{
\fldreq
\fld{u16} pins to arm
} \\
0x02 & ARM\_AUTO & Arm with automatic re-arming after each event
2 & \flname{ARM\_AUTO} Arm with automatic re-arming after each event
& \makecell[tl]{
\fldreq
\fld{u16} pins to arm
} \\
0x03 & DISARM & Dis-arm selected pins
3 & \flname{DISARM} Dis-arm selected pins
& \makecell[tl]{
\fldreq
\fld{u16} pins to dis-arm

@ -1,8 +1,8 @@
\section{DO: Digital Output}
\section{Digital Output}
The digital output unit provides a write access to one or more pins of a GPIO port. This unit additionally supports pulse generation on any of its pins. This is implemented in software with the timing derived from the system timebase, as the hardware timer outputs, otherwise used for PWM or pulse generation, are available only on several dedicated pins. The timing code is optimized to reduce jitter. \todo{Measure jitter and add it here}
\subsection{DO Configuration}
\subsection{Digital Output Configuration}
\begin{inicode}
[DO:out@1]
@ -16,42 +16,43 @@ initial=
open-drain=
\end{inicode}
\subsection{DO Events}
\subsection{Digital Output Events}
This unit generates no events.
\subsection{DO Commands}
\subsection{Digital Output Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & WRITE & Write to all pins
0 & \flname{WRITE} Write to all pins
& \makecell[tl]{
\fldreq
\fld{u16} new value
} \\
0x01 & SET & Set selected pins to 1
1 & \flname{SET} Set selected pins to 1
& \makecell[tl]{
\fldreq
\fld{u16} pins to set
} \\
0x02 & CLEAR & Set selected pins to 0
2 & \flname{CLEAR} Set selected pins to 0
& \makecell[tl]{
\fldreq
\fld{u16} pins to clear
} \\
0x03 & TOGGLE & Toggle selected pins
3 & \flname{TOGGLE} Toggle selected pins
& \makecell[tl]{
\fldreq
\fld{u16} pins to toggle
} \\
0x04 & PULSE & Generate a pulse on the selected pins. The $\mu$s scale may be used only for 0--999\,$\mu$s.
4 & \flname{PULSE}
Generate a pulse on the selected pins. The $\mu$s scale may be used only for 0--999\,$\mu$s.
& \makecell[tl]{
\fldreq
\fld{u16} pins to pulse \\

@ -1,4 +1,187 @@
\section{Frequency Capture Unit}
The frequency capture unit implements both the frequency measurement methods explained in section \ref{sec:theory-fcap}: direct and reciprocal. It can be operated in an on-demand or continuous measurement mode. The unit can be switched to two other modes: pulse counter, and the measurement of a single pulse.
The frequency capture unit implements both the frequency measurement methods explained in section \ref{sec:theory-fcap}: direct and reciprocal.
The unit has several operational modes: idle, reciprocal continuous, reciprocal burst, direct continuous, direct burst, free counting, and single pulse. Burst mode is an on-demand measurement with possible averaging. Continuous mode doesn't support averaging, but the latest measurement can be read at any time without a delay.
\subsection{Value Conversion Formulas}
Several of the features implemented in this unit would require floating point arithmetic to provide the measured value in the desired units (Hz, seconds). That is not available in Cortex-M0, only as a software implementation. The calculation is left to the client in order to save Flash space that would be otherwise used by the the arithmetic functions. This arrangement also avoids rounding errors and a possible loss of precision.
\subsubsection{Reciprocal (Indirect) Measurement}
Period (in seconds) is computed as:
\[
T = \dfrac{\mathrm{period\_sum}}{f_\mathrm{core,MHz} \cdot 10^6 \cdot \mathrm{n\_periods}}
\]
\noindent
The frequency is obtained by simply inverting it: \[f=T^{-1}\]
The average duty cycle is computed as the ratio of the sum of active-level pulses and the sum of all periods:
\[\mathrm{average\_duty} = \dfrac{\mathrm{ontime\_sum}}{\mathrm{period\_sum}}\]
\subsubsection{Direct Measurement}
The frequency can be derived from the pulse count and measurement time using its definition ($t_\mathrm{ms}$ is measurement time in milliseconds):
\[f = \dfrac{1000\cdot\mathrm{count}\cdot\mathrm{prescaller}}
{t_\mathrm{ms}}\]
\subsection{Frequency Capture Configuration}
\begin{inicode}
[FCAP:j@10]
# Signal input pin - one of:
# Full support: A0, A5, A15
# Indirect only: A1, B3
pin=A0
# Active level or edge (0-low,falling; 1-high,rising)
active-level=1
# Input filtering (0-15)
input-filter=0
# Pulse counter pre-divider (1,2,4,8)
direct-presc=1
# Pulse counting interval (ms)
direct-time=1000
# Mode on startup: N-none, I-indirect, D-direct, F-free count
initial-mode=N
\end{inicode}
\subsection{Frequency Capture Commands}
Some commands include optional parameter setting. Using 0 in the field keeps the previous value. Those fields are marked with *.
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0 & \flname{STOP} Stop all measurements, go idle & \\
1 & \flname{INDIRECT\_CONT\_START}
Start a repeated reciprocal measurement
& \\
2 & \flname{INDIRECT\_BUTST\_START}
Start a burst of reciprocal measurements
& \makecell[tl]{
\fldreq
\fld{u16} number of periods \\
\fldresp
\fld{u16} core speed (MHz) \\
\fld{u16} number of periods \\
\fld{u64} sum of all periods (ticks) \\
\fld{u16} sum of on-times (ticks)
} \\
3 & \flname{DIRECT\_CONT\_START}
Start a repeated direct measurement
& \makecell[tl]{
\fldreq
\fld{u16} *measurement time \\
\fld{u8} *prescaller (1, 2, 4, 8) \\
} \\
4 & \flname{DIRECT\_BURST\_START}
Start a single direct measurement. Longer capture time may help increase accuracy for stable signals.
& \makecell[tl]{
\fldreq
\fld{u16} *measurement time (ms) \\
\fld{u8} *prescaller (1, 2, 4, 8) \\
\fldresp
\fld{u8} prescaller \\
\fld{u16} measurement time (ms) \\
\fld{u32} pulse count
} \\
5 & \flname{FREECOUNT\_START}
Clear and start the pulse counter
& \makecell[tl]{
\fldreq
\fld{u8} *prescaller (1,2,4,8) \\
} \\
6 & \flname{MEASURE\_SINGLE\_PULSE}
Measure a single pulse of the active level. Waits for a rising edge.
& \makecell[tl]{
\fldresp
\fld{u16} core speed (MHz) \\
\fld{u32} pulse length (ticks) \\
} \\
7 & \flname{FREECOUNT\_CLEAR}
Read and clear the pulse counter.
& \makecell[tl]{
\fldresp
\fld{u32} previous counter value \\
} \\
10 & \flname{INDIRECT\_CONT\_READ}
Read the latest value from the continuous reciprocal measurement, if running.
& \makecell[tl]{
\fldresp
\fld{u16} core speed (MHz) \\
\fld{u32} period length (ticks) \\
\fld{u32} on-time (ticks) \\
} \\
11 & \flname{DIRECT\_CONT\_READ}
Read the latest value from the continuous direct measurement, if running.
& \makecell[tl]{
\fldresp
\fld{u8} prescaller \\
\fld{u16} measurement time (ms) \\
\fld{u32} pulse count
} \\
12 & \flname{FREECOUNT\_READ}
Read the pulse counter value
& \makecell[tl]{
\fldresp
\fld{u32} pulse count
} \\
20 & \flname{SET\_POLARITY}
Set pulse polarity (active level)
& \makecell[tl]{
\fldresp
\fld{u8} polarity (0,1)
} \\
21 & \flname{SET\_PRESCALLER}
Set prescaller for the direct mode
& \makecell[tl]{
\fldresp
\fld{u8} prescaller (1,2,4,8) \\
} \\
22 & \flname{SET\_INPUT\_FILTER}
Set input filtering (a hardware feature designed to ignore glitches)
& \makecell[tl]{
\fldresp
\fld{u8} filtering factor (0-15, 0=off) \\
} \\
23 & \flname{SET\_DIR\_MSEC}
Set direct measurement time
& \makecell[tl]{
\fldresp
\fld{u16} measurement time (ms) \\
} \\
30 & \flname{RESTORE\_DEFAULTS}
Restore all run-time adjustable parameters to their configured default values
& \\
\bottomrule
\end{tabularx}
\todo[inline]{split table to improve page layout}

@ -21,25 +21,23 @@ analog-filter=Y
digital-filter=0
\end{inicode}
\subsection{I2C Events}
This unit generates no events.
\subsection{I2C Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & WRITE & Raw write transaction
0 & \flname{WRITE}
Raw write transaction
& \makecell[tl]{
\fldreq
\fld{u16} slave address \\
\fld{u8[]} bytes to write \\
} \\
0x01 & READ & Raw read transaction
1 & \flname{READ}
Raw read transaction
& \makecell[tl]{
\fldreq
\fld{u16} slave address \\
@ -48,7 +46,8 @@ This unit generates no events.
\fld{u8[]} received bytes \\
} \\
0x02 & WRITE\_REG & Write to a slave register. Sends the register number and the data in the same I2C transaction. Multiple registers can be written to slaves supporting auto-increment.
2 & \flname{WRITE\_REG}
Write to a slave register. Sends the register number and the data in the same I2C transaction. Multiple registers can be written to slaves supporting auto-increment.
& \makecell[tl]{
\fldreq
\fld{u16} slave address \\
@ -56,8 +55,10 @@ This unit generates no events.
\fld{u8[]} bytes to write \\
} \\
0x03 & READ\_REG & Read from a slave register. Writes the register number and issues a read transaction of the given length. Multiple registers can be read from slaves supporting auto-increment.
3 & \flname{READ\_REG}
Read from a slave register. Writes the register number and issues a read transaction of the given length. Multiple registers can be read from slaves supporting auto-increment.
& \makecell[tl]{
\fldreq
\fld{u16} slave address \\
\fld{u8} register number \\
\fld{u16} number of read bytes \\

@ -1,10 +1,10 @@
\section{NPX: NeoPixel}
\section{NeoPixel Unit}
The NeoPixel unit implements the protocol needed to control a digital LED strip with WS2812, WS2811, or compatible LED driver chips. The protocol timing is implemented in software, therefore it is available on any GPIO pin of the module.
The color data can be loaded in five different format: as packed bytes, or as the little-endian or big-endian encoding of colors in the 32-bit format 0x00RRGGBB or 0x00BBGGRR. This data format is convenient when the colors are already represented by an array of 32-bit integers.
\subsection{NPX Configuration}
\subsection{NeoPixel Configuration}
\begin{inicode}
[NPX:neo@3]
@ -14,19 +14,18 @@ pin=A0
pixels=32
\end{inicode}
\subsection{NPX Events}
\subsection{NeoPixel Commands}
This unit generates no events.
\subsection{NPX Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & CLEAR & Switch all LEDs off (sets them to black) & \\
0x01 & LOAD & Load a sequence of R,G,B bytes
0 & \flname{CLEAR}
Switch all LEDs off (sets them to black) & \\
1 & \flname{LOAD}
Load a sequence of R,G,B bytes
& \makecell[tl]{
\fldreq
\tabitem For each LED: \\
@ -35,31 +34,36 @@ This unit generates no events.
~~\fldo{u8} blue \\
} \\
0x08 & LOAD\_U32\_ZRGB & Load 32-bit big-endian 0xRRGGBB (0,R,G,B)
4 & \flname{LOAD\_U32\_ZRGB}
Load 32-bit big-endian 0xRRGGBB (0,R,G,B)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data BE
} \\
0x09 & LOAD\_U32\_ZBGR & Load 32-bit big-endian 0xBBGGRR (0,B,G,R)
5 & \flname{LOAD\_U32\_ZBGR}
Load 32-bit big-endian 0xBBGGRR (0,B,G,R)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data BE
} \\
0x0A & LOAD\_U32\_RGBZ & Load 32-bit little-endian 0xBBGGRR (R,G,B,0)
6 & \flname{LOAD\_U32\_RGBZ}
Load 32-bit little-endian 0xBBGGRR (R,G,B,0)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data LE
} \\
0x0B & LOAD\_U32\_BGRZ & Load 32-bit little-endian 0xRRGGBB (B,G,R,0)
7 & \flname{LOAD\_U32\_BGRZ}
Load 32-bit little-endian 0xRRGGBB (B,G,R,0)
& \makecell[tl]{
\fldreq
\fld{u32[]} color data LE
} \\
0x10 & GET\_LEN & Get number of LEDs in the strip
10 & \flname{GET\_LEN}
Get number of LEDs in the strip
& \makecell[tl]{
\fldresp
\fld{u16} number of LEDs

@ -1,4 +1,4 @@
\section{SIPO: Shift Registers Driver}
\section{SIPO (Shift Register) Unit}
The shift registers driver unit is designed for the loading of data into \textit{serial-in, parallel-out} (SIPO) shift registers, such as 74HC4094 or 74HC595. Those are commonly used to control segmented LED displays, LED matrices etc.
@ -23,18 +23,15 @@ data-port=A
data-pins=3
\end{inicode}
\subsection{SIPO Events}
This unit generates no events.
\subsection{SIPO Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & WRITE & Load the shift registers and leave the data outputs in the "trailing data" state before sending the Store pulse.
0 & \flname{WRITE}
Load the shift registers and leave the data outputs in the "trailing data" state before sending the Store pulse.
& \makecell[tl]{
\fldreq
\fld{u16} trailing data \\
@ -42,15 +39,16 @@ This unit generates no events.
~~\fldo{u8[]} data to load
} \\
0x01 & DIRECT\_DATA & Directly write to the data pins (same like the DO unit's WRITE command)
1 & \flname{DIRECT\_DATA}
Directly write to the data pins (same like the DO unit's WRITE command)
& \makecell[tl]{
\fldreq
\fld{u16} values to write
} \\
0x02 & DIRECT\_CLEAR & Pulse the Clear pin, erasing the registers' data & \\
0x03 & DIRECT\_SHIFT & Pulse the Shift pin & \\
0x04 & DIRECT\_STORE & Pulse the Store pin & \\
2 & \flname{DIRECT\_CLEAR} Pulse the Clear pin, erasing the registers' data & \\
3 & \flname{DIRECT\_SHIFT} Pulse the Shift pin & \\
4 & \flname{DIRECT\_STORE} Pulse the Store pin & \\
\bottomrule
\end{tabularx}

@ -38,18 +38,15 @@ port=A
pins=0
\end{inicode}
\subsection{SPI Events}
This unit generates no events.
\subsection{SPI Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}lXp{\fldwpld}}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Name} & \textbf{Function} & \textbf{Payload} \\
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0x00 & QUERY & Exchange bytes with a slave device
0 & \flname{QUERY}
Exchange bytes with a slave device
& \makecell[tl]{
\fldreq
\fld{u8} slave number 0--16 \\
@ -60,7 +57,8 @@ This unit generates no events.
\fld{u8[]} received bytes \\
} \\
0x01 & MULTICAST & Send a message to multiple slaves at once. The address is a bit map (e.g. 0x8002 = slaves 1 and 15).
1 & \flname{MULTICAST}
Send a message to multiple slaves at once. The address is a bit map (e.g. 0x8002 = slaves 1 and 15).
& \makecell[tl]{
\fldreq
\fld{u16} addressed slaves \\

@ -1,8 +1,94 @@
\section{USART Unit}
The USART unit provides access to one of the microcontroller's USART peripherals. All USART parameters can be configured to match the application's needs.
The USART unit provides access to one of the microcontroller's USART peripherals. All USART parameters can be configured to match the application's needs. The peripheral is capable of driving RS485 transceivers with the Driver Enable (DE) output for switching between reception and transmission.
The unit implements asynchronous reception and transmission using DMA and a circular buffer. Received data is sent to the host in asynchronous events when either half of the buffer is filled, or after a fixed timeout from the last received byte.
\subsection{USART Configuration}
\begin{inicode}
[USART:ser@6]
# Peripheral number (UARTx 1-4)
device=1
# Pin mappings (TX,RX,CK,CTS,RTS/DE)
# USART1: (0) A9,A10,A8,A11,A12 (1) B6,B7,A8,A11,A12
# USART2: (0) A2,A3,A4,A0,A1 (1) A14,A15,A4,A0,A1
# USART3: (0) B10,B11,B12,B13,B14
# USART4: (0) A0,A1,C12,B7,A15 (1) C10,C11,C12,B7,A15
remap=0
# Baud rate in bps (eg. 9600)
baud-rate=115200
# Parity type (NONE, ODD, EVEN)
parity=NONE
# Number of stop bits (0.5, 1, 1.5, 2)
stop-bits=1
# Bit order (LSB or MSB first)
first-bit=LSB
# Word width (7,8,9) - including parity bit if used
word-width=8
# Enabled lines (RX,TX,RXTX)
direction=RXTX
# Hardware flow control (NONE, RTS, CTS, FULL)
hw-flow-control=NONE
# Generate serial clock (Y,N)
clock-output=N
# Clock polarity: 0,1
cpol=0
# Clock phase: 0,1
cpha=0
# Generate RS485 Driver Enable signal (Y,N) - uses RTS pin
de-output=N
# DE active level: 0,1
de-polarity=1
# DE assert time (0-31)
de-assert-time=8
# DE clear time (0-31)
de-clear-time=8
\end{inicode}
\subsection{USART Events}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Meaning} & \textbf{Payload} \\
\midrule
0 & \flname{DATA\_RECEIVED}
Data was received on the serial port.
& \makecell[tl]{
\fld{u8[]} received bytes
} \\
\bottomrule
\end{tabularx}
\subsection{USART Commands}
\begin{tabularx}{\textwidth}{p{\fldwcode}Xp{\fldwpld}}
\toprule
\textbf{Code} & \textbf{Function} & \textbf{Payload} \\
\midrule
0 & \flname{WRITE}
Add data to the transmit buffer. Sending is asynchronous, but the command may wait for free space in the DMA buffer.
& \makecell[tl]{
\fldreq
\fld{u8[]} bytes to write
} \\
1 & \flname{WRITE\_SYNC}
Add data to the transmit buffer and wait for the transmission to complete.
& \makecell[tl]{
\fldreq
\fld{u8[]} bytes to write
} \\
\bottomrule
\end{tabularx}
The clock output and hardware flow control may be enabled, as well as the Driver Enable (DE) output used by RS485 transceivers to switch between a reception and transmission mode.

@ -30,7 +30,8 @@
\newcommand\fld[1]{\tabitem \verb|#1|:}
\newcommand\fldo[1]{\tabitemo \verb|#1|:}
\newcommand{\fldwcode}{2.2em}
\newcommand{\fldwpld}{.32\textwidth}
\newcommand{\fldwpld}{.35\textwidth}
\newcommand\flname[1]{\textbf{#1}\newline}
\newcommand{\fldreq}{\textit{Request}\\}
\newcommand{\fldresp}{\textit{Response}\\}

Binary file not shown.
Loading…
Cancel
Save