Browse Source

final text cleaning

Ondřej Hruška 1 year ago
parent
commit
13efd58af6
Signed by: Ondřej Hruška <ondra@ondrovo.com> GPG key ID: 2C5FD5035250423D
7 changed files with 75 additions and 62 deletions
  1. 48 17
      ch.discussion.tex
  2. 9 3
      ch.hardware_realization.tex
  3. 10 2
      ch.pc_software.tex
  4. 4 36
      ch.summary.tex
  5. BIN
      thesis.pdf
  6. 3 3
      thesis.tex
  7. 1 1
      thesis.thanks.tex

+ 48 - 17
ch.discussion.tex View File

@@ -6,45 +6,76 @@ The objective of this work was to develop an extensible platform allowing the us
6 6
 
7 7
 We based the \textit{GEX} platform around STM32 microcontrollers from ST Microelectronics and developed the initial version for the STM32F072. This \gls{MCU} was chosen for its native \gls{USB} Full Speed support, its interesting set of peripheral blocks, and because it is a relatively recent model in the STM32F series, expecting it to be mature and without major flaws. A wireless connection was planned together with \gls{USB} and hardware \gls{UART}, for which we chose the nRF24L01+ transceiver from Nordic Semiconductor.
8 8
 
9
-In total, three custom hardware modules have been developed and realized for the project: GEX Hub, GEX Zero, and the wireless gateway. GEX Hub verified the designed schematic and general functionality of the module, after first testing the firmware on a STM32 Discovery development board. GEX Zero is more advanced and compact than GEX Hub, also offering wireless connectivity for field experiments; we re-used the form factor of the Raspberry Pi Zero for this board, which makes it compatible with many existing enclosures and add-on boards. In addition to custom hardware, the GEX firmware may be used with STM32 development boards (``STM32F072B-DISCO'').
10
-
11
-The initial version of the project presented in this paper provides access to digital communications interfaces \gls{SPI}, \gls{I2C}, \gls{USART}, and 1-Wire, is capable of loading data into NeoPixel RGB \gls{LED} strips and \gls{SIPO} shift registers, and implements additional measurement and signal generation features---analog signal acquisition, waveform generation, frequency, phase, and duty cycle measurement, and \gls{PWM} output.
12
-
13
-We developed a transaction-based binary protocol that is used by all three communication interfaces. As the implementation of the protocol would be an inconvenience for the user, we also developed software libraries in languages C and Python that implement it and provide high level access to the hardware module. It has been tested and verified that the Python library can be used from MATLAB scripts, should the user need MATLAB, e.g., for data processing or visualization.
14
-
15
-To make the devices easy to reconfigure for the user, the configuration options---such as, which features to enable and what pins to use for them---are represented by entries in INI configuration files. The user can access these files through a virtual mass storage with an emulated FAT16 file system presented to the host \gls{PC} on the \gls{USB} port. Because the file system emulation relies on a certain pattern of behavior from the host, it may not work well in all cases. This is mitigated by making the files accessible also through the communication interface.
9
+In total, three custom hardware modules have been developed and realized for the project: GEX Hub, GEX Zero, and the wireless gateway. GEX Hub verified the designed schematic and general functionality of the module. GEX Zero is more advanced and compact than GEX Hub, also offering wireless connectivity for field experiments; we re-used the form factor of the Raspberry Pi Zero for this board, which makes it compatible with many existing enclosures and add-on boards. In addition to custom hardware, the GEX firmware may be flashed to STM32 development boards (``STM32F072B-DISCO'').
10
+
11
+\noindent
12
+The initial version of the project supports the following hardware buses and functions:
13
+
14
+\begin{itemize}[itemsep=1pt]
15
+	\item \textbf{Digital input} with asynchronous pin change detection
16
+	\item \textbf{Digital output} with pulse generation support
17
+	\item \textbf{Digital communication interfaces:}	
18
+\begin{itemize}
19
+\item \textbf{\gls{SPI}} with up to 16 slaves and multicast support
20
+\item \textbf{\gls{I2C}} master
21
+\item \textbf{\gls{USART}} with optional RS-485 driver support
22
+\item \textbf{1-Wire} master, implementing the \gls{ROM} Search algorithm
23
+\end{itemize}
24
+	\item \textbf{Frequency, pulse width, and duty cycle measurement}
25
+	\item \textbf{Pulse counting}
26
+	\item \textbf{\gls{PWM} signal generation}	
27
+	\item \textbf{Multi-channel shift register loading}
28
+	\item \textbf{NeoPixel RGB \gls{LED} strip control}
29
+	\item \textbf{Capacitive touch sensing}
30
+	\item \textbf{Analog signal acquisition}
31
+		\begin{itemize}
32
+			\item Immediate or averaged voltage measurement
33
+			\item Isochronous sampling: fixed sample count, or a continuous stream
34
+			\item Threshold-based triggering with a pre-trigger buffer
35
+		\end{itemize}
36
+	\item \textbf{Analog signal generation}
37
+		\begin{itemize}
38
+			\item Sine, triangle, sawtooth, or rectangle waveform generation using \gls{DDS}
39
+			\item \gls{DC} level output
40
+		\end{itemize}
41
+\end{itemize}
42
+
43
+
44
+We developed a transaction-based binary protocol that is used by all three communication interfaces. Software libraries implementing this protocol have been developed in programming languages C and Python. It has been tested and verified that the Python library may be integrated into MATLAB scripts, should the user need MATLAB, e.g., for data processing or visualization.
45
+
46
+To make the devices easy to reconfigure, the configuration options---such as, which features to enable and what pins to use for them---are presented by entries in INI configuration files. The user can edit these files in a virtual \gls{USB} mass storage device with an emulated FAT16 file system. Because the emulation relies on a certain pattern of behavior from the host, it may not work reliably in all cases. This is mitigated by making the files accessible also through the communication interface.
16 47
 
17 48
 \section{Results and Possible Applications}
18 49
 
19 50
 The designed device, and the accompanying software stack, make a practical tool for the research and development in the field of embedded electronics, and may be used as a learning aid to demonstrate the timings and format of the various supported hardware buses. The inclusion of analog signal acquisition and generation features makes it possible to measure the analog characteristics of electronic components, or acquire data from physical phenomena. 
20 51
 
21
-The use in automation offers itself thanks to the programmatic control from high level programming languages on the \gls{PC}; this has an advantage over programming the embedded firmware itself in that the user can focus on the behavior of the device they are developing, rather than having to deal with low level implementation details, such as memory management, or interrupt priority configuration.
52
+The use in automation offers itself thanks to the programmatic control from high level programming languages on the \gls{PC}; this has an advantage over programming the embedded firmware itself in that the user can focus on the behavior of the device they are developing, rather than having to deal with low level implementation details, such as memory management, or interrupt priority configuration. An inherent downside of this universal platform lies in greater latencies and lower performance than could be achieved with a custom embedded system.
22 53
 
23
-As the GEX platform is open source~\cite{gex-gh}, our solution may be freely expanded and adapted to support other hardware platforms, to add new features, or to further optimize its performance. The platform is modular and may be extended by adding new, independent functional blocks.
54
+As the GEX platform is open source, with all source code and hardware materials made available on GitHub~\cite{gex-gh}, our solution may be freely expanded and adapted to support other hardware platforms, to add new features, or to further optimize its performance.
24 55
 
25 56
 \section{Comparison with Existing Solutions}
26 57
 
27
-The integration of the \gls{PC} with low-level hardware is an appealing idea that has already been explored in several alternative solutions, which we listed in \cref{sec:prior_art}. It is our belief that the project offers enough unique features and qualities to find its place among the competition.
58
+The integration of the \gls{PC} with low-level hardware is an appealing idea that has been explored in several alternative solutions, which we listed in \cref{sec:prior_art}. It is our belief that the GEX project offers enough unique features and qualities to find its place among the competition.
28 59
 
29 60
 Compared to the Raspberry Pi, GEX is less powerful and cannot be used as a stand-alone device without the host \gls{PC}. However, it is more straightforward to use, the required configuration is minimal, and it offers features not available in the Raspberry Pi, such as the \gls{ADC} and \gls{DAC}.
30 61
 
31
-The Bus Pirate excels as a bus analyzer and general purpose device and implements features we did not explore in this project, while having much fewer \gls{GPIO} pins, a lower resolution of the \gls{ADC}, and completely missing a \gls{DAC}. The two projects serve a slightly different purposes and appear to be complementary.
62
+The Bus Pirate excels as a bus analyzer and general purpose device and implements features we did not explore in this project, while having much fewer \gls{GPIO} pins, a lower resolution of the \gls{ADC}, and completely misses a \gls{DAC}. The two projects serve a slightly different purposes and appear to be complementary.
32 63
 
33
-It is clear that GEX does not pose a real threat to professional tools in terms of performance, but even at the prototype cost it is significantly more affordable. By integrating many diverse features, it can replace several such tools at once when its performance is sufficient for the particular application. 
64
+It is clear that GEX does not pose a real threat to professional tools in terms of performance, but even at the prototype cost it is significantly more affordable. By integrating many diverse features, GEX can replace several instruments at once, allowing the creation of more advanced measurement systems in a compact form.
34 65
 
35 66
 \section{Limitations}
36 67
 
37
-Our solution was designed with the expectation that the users are familiar with programming and the requirement to develop a control script or application will not pose a problem. However, is not universally true and some users who might benefit from the platform will be left unable to use it without a more user-friendly interface.
68
+Our solution was designed with the expectation that the users are familiar with programming, and the requirement to develop a control script or application would not pose a problem. However, that is not universally true, and some users who might benefit from the platform will not be able to use it without a more user-friendly interface.
38 69
 
39
-The STM32F072 microcontroller proved sufficient for the verification of the designed architecture, and in most cases provides a sufficient performance. Future expansion of the project is, unfortunately, limited by its flash and \gls{RAM} capacity, which are already used at about 85\,\%, based on the size of the binary image and the amount of allocated memory. Further, the STM32F072 has a Cortex-M0 core without any hardware support for floating point arithmetics, making any calculations with those numbers slow and requiring additional library functions, further increasing the firmware image size. Its power consumption has not yet been measured or optimized, but the inclusion of a wireless connection capability predisposes the device to be used in battery-powered applications; the microcontroller choice and the power supply design may need to be revised for efficient battery operation.
70
+The STM32F072 microcontroller proved sufficient for the verification of the design, and in many cases provides a sufficient performance. Future expansion of the project is, unfortunately, limited by its flash and \gls{RAM} capacity, which are already used at about 85\,\%, based on the size of the binary image and the amount of allocated memory. Further, the STM32F072 has a Cortex-M0 core without any hardware support for floating point arithmetics, making any calculations with those numbers slow and requiring additional library functions, further increasing the firmware image size. The modules' power consumption has not been measured or optimized, but the inclusion of a wireless interface predisposes them to be used in battery-powered applications; the microcontroller choice and the power supply design may need to be revised for efficient battery operation.
40 71
 
41
-Another limitation concerns the support software; our client libraries have not been tested on MS Windows, with Linux being the development platform. The C library uses POSIX \gls{API} and is not portable to the non-conforming \gls{OS}. The Python library should work on MS Windows, provided libUSB is installed correctly. Further, on MS Windows prior to version 10, the virtual COM port functionality requires the ``STM32 Virtual COM port driver'' to be manually installed and assigned in the Device Manager. 
72
+Another limitation concerns the support software; our client libraries have not been tested on MS Windows, with Linux being the main development platform. The C library uses POSIX \gls{API} and UNIX-specific \gls{API} to manage the serial port, which is not portable. The Python library should work on MS Windows, provided libUSB is installed correctly. Further, on MS Windows prior to version 10, the virtual COM port connection requires the ``STM32 Virtual COM port driver'' to be manually installed and assigned in the Device Manager. 
42 73
 
43 74
 \section{Future Development}
44 75
 
45
-Future development of the project might focus on expanding the number of supported hardware platforms, in order to overcome the limitations of the used microcontroller model. In particular the STM32L series of low-power devices should be investigated, as it may be a better choice when a battery-based operation is needed. The hardware implementation should further be revised to maximize power efficiency.
76
+Future development of the project might focus on expanding the number of supported hardware platforms in order to overcome the limitations of the used microcontroller model. In particular the STM32L series of low-power devices should be investigated, as it may be a better choice when a battery-based operation is needed. The hardware implementation should further be revised to maximize power efficiency.
46 77
 
47
-The client libraries need to be tested on other operating systems, and the C library may be expanded to provide a higher level of comfort to the user. The library could be ported to more programming languages, such as Java or \CS, and graphical applications could be developed to make the device more approachable to users less familiar with programming.
78
+The client libraries need to be tested on other operating systems, and the C library may be expanded to provide a higher level of comfort to the user. The client library could further be reimplemented in more programming languages, such as Java or \CS, and graphical applications could be developed to make GEX more approachable to users less familiar with programming.
48 79
 
49 80
 GEX Zero, with the Raspberry Pi Zero form factor, introduced the possibility of using Raspberry Pi add-on boards. It would be interesting to test the compatibility with more such existing boards, and further to explore the possibility of designing custom ones. An add-on board could, for instance, add access to the \gls{DALI} bus, RS-485, \gls{CAN}, or Ethernet.
50 81
 

+ 9 - 3
ch.hardware_realization.tex View File

@@ -53,16 +53,22 @@ The Boot jumper was meant to be closed during normal operation, to avoid it gett
53 53
 
54 54
 A restart is required, in all cases, for the boot jumper changes to take effect. Revision 2 adds a flat reset button on the back side of the board for this purpose, making the firmware update process more straightforward.
55 55
 
56
-\section{GEX Zero}\label{sec:gzero}
56
+\begin{figure}[h]
57
+	\centering
58
+	\includegraphics[width=.9\textwidth]{img/photo-zero-pi-compare.jpg}
59
+	\caption[GEX Zero compared to Raspberry Pi Zero]{\label{fig:zpicompare}Comparison of Raspberry Pi Zero (top) with GEZ Zero (bottom), before soldering the header, buttons, and the wireless module.}
60
+\end{figure}
57 61
 
58 62
 \begin{figure}[h]
59 63
 	\centering
60 64
 	\includegraphics[width=.85\textwidth]{img/photo-zero-picase.jpg} \\
61 65
 	\vspace{1mm}
62 66
 	\includegraphics[width=.85\textwidth]{img/photo-zero-transparent.jpg}
63
-	\caption[The GEX Zero module]{\label{fig:gexzcases}GEX Zero in the official Raspberry Pi Zero case and an aftermarket acrylic case}
67
+	\caption[The GEX Zero module]{\label{fig:gexzcases}GEX Zero in the official Raspberry Pi Zero case, and an aftermarket acrylic case. The acrylic case is a better choice, as the button and the side connector are easier accessible, and the pin-out diagram on the back side of the board can be read without removing it.}
64 68
 \end{figure}
65 69
 
70
+\section{GEX Zero}\label{sec:gzero}
71
+
66 72
 Our desire to re-use the form factor of the Raspberry Pi (RPi) Zero to exploit the existing accessory market has been mentioned already in \cref{sec:formfactors}. It was brought to fruition with GEX Zero, the second realized GEX prototype (\cref{fig:gexzcases}). Its design involved several challenges given by constraints imposed by this form factor:
67 73
 
68 74
 \begin{itemize}
@@ -322,7 +328,7 @@ Unfortunately, neither the GEX Zero \gls{PCB} was flawless in the first revision
322 328
 
323 329
 \section{Wireless Gateway} \label{sec:rfgateway}
324 330
 
325
-The wireless gateway was designed as a ``\gls{USB} dongle'', using the \gls{USB} type A connector (\cref{fig:gwxgw}). It is fitted with an STM32F103 microcontroller, selected for its low cost and availability in small packages (in this case LQFP48). The nRF24L01+ module is partly sticking outside the board outline, allowing the \gls{PCB} to be smaller (and thus cheaper to manufacture), while reducing interference between components and copper plating on the board and the antenna. The schematic diagram of the wireless gateway is attached in \hyperref[apx:gex_wgw]{Appendix C}.
331
+The wireless gateway was designed as a ``\gls{USB} dongle'', using the \gls{USB} type A connector (\cref{fig:gwxgw}). It is fitted with an STM32F103 microcontroller, selected for its low cost and availability in small packages (in this case LQFP48)\footnote{ Ironically, the STM32F103 is more powerful than the \gls{MCU} used in GEX Zero and GEX Hub. Porting GEX to this platform is planned for future development.}. The nRF24L01+ module is partly sticking outside the board outline, allowing the \gls{PCB} to be smaller (and thus cheaper to manufacture), while reducing interference between components and copper plating on the board and the antenna. The schematic diagram of the wireless gateway is attached in \hyperref[apx:gex_wgw]{Appendix C}.
326 332
 
327 333
 Beyond the use with GEX, the gateway is a versatile tool which could be programmed with a different firmware and serve other purposes, e.g., as a wireless connection between two computers, to scan the radio spectrum for interference in order to find a clear channel, or to communicate with other devices that use the nRF24L01+ transceiver. The chosen microcontroller, unfortunately, does not include a USB bootloader, so a SWD programmer is required to change the firmware; SWD is routed to the pin header next to the wireless module.
328 334
 

+ 10 - 2
ch.pc_software.tex View File

@@ -41,7 +41,15 @@ Three transport implementations have been developed:
41 41
     \item \mono{gex.TrxRawUSB} -- similar to \mono{gex.TrxSerialThread}, but using raw USB endpoint access
42 42
 \end{itemize}
43 43
 
44
-The wireless gateway is accessed by wrapping either of the transports in an instance of \mono{gex.DongleAdapter} before passing it to \mono{gex.Client}.
44
+To use the wireless gateway, wrap either low-level transport in \mono{gex.DongleAdapter}. The adapter configures the gateway and converts the regular protocol to the right format.
45
+
46
+\begin{pythoncode}
47
+# Gateway connection example
48
+transport = gex.DongleAdapter(gex.TrxRawUSB(remote=True), slave=42)
49
+client = gex.Client(transport)
50
+# ...
51
+client.close()
52
+\end{pythoncode}
45 53
 
46 54
 \subsection{Example Python Script} \label{sec:ex_python_script}
47 55
 
@@ -126,7 +134,7 @@ The example in \cref{lst:matlab_api} (and \cref{fig:matlabpic}) demonstrates the
126 134
 
127 135
 The C library is more simplistic than the Python one; it supports only the serial port transport (\gls{UART} or \gls{CDCACM}) and does not implement asynchronous polling or the unit support drivers. The implemented features---the transport, a basic protocol handler, and payload building and parsing utilities---are sufficient for most applications, though less convenient than the Python library.
128 136
 
129
-This low-level library is intended for applications where the performance of the Python implementation is insufficient, or where an integration with existing C code is required. The full \gls{API} can be found in the library header files. A C version of the example Python script shown above, controlling an \gls{LED} matrix driver, is presented in \cref{lst:c_api_full}. Readers might point out that this example is unnecessarily obtuse, and that the payloads could be constructed in a more readable way. Indeed, two better methods of payload construction are available: one using C structs, and the other taking advantage of the Payload Builder utility bundled with TinyFrame, which is included in the library package.
137
+This low-level library is intended for applications where the performance of the Python implementation is insufficient, or where an integration with existing C code is required. The full \gls{API} can be found in the library header files. A C version of the example Python script shown above, controlling an \gls{LED} matrix driver, is presented in \cref{lst:c_api_full}. The payloads in this example are represented as binary strings for simplicity. Two better methods of payload construction are available: using C structs, or taking advantage of the Payload Builder utility (bundled with TinyFrame).
130 138
 
131 139
 \begin{listing}
132 140
 	\begin{ccode}

+ 4 - 36
ch.summary.tex View File

@@ -1,43 +1,11 @@
1 1
 \chapter{Conclusion}
2 2
 
3
-We have developed an open-source software and hardware platform providing high-level user applications running on a \gls{PC} with access to \gls{GPIO} pins, hardware buses, and signal acquisition and generation functions.
3
+We have developed an open-source software and hardware platform providing high-level user applications running on a \gls{PC} with access to \gls{GPIO} pins, common hardware buses, and signal acquisition and generation functions.
4 4
 
5
-The platform consists of a FreeRTOS-based firmware for the STM32F072 microcontroller, custom hardware modules, and support software libraries for programming languages C and Python, the latter also compatible with MATLAB. The firmware may be used with the custom hardware, or with existing STM32 development boards.
5
+The platform consists of a FreeRTOS-based firmware for the STM32F072 microcontroller, custom hardware module designs (including realized prototypes), and support software libraries for programming languages C and Python, the latter also compatible with MATLAB. The firmware may be used with the custom hardware, or with existing STM32 development boards.
6 6
 
7 7
 The devices are connected to the \gls{PC} by one of three interfaces: \gls{USB} as a virtual COM port or with raw endpoint access, a hardware \gls{UART}, or a radio link with the nRF24L01+ transceiver. Configuration is performed by editing INI files exposed in an emulated FAT16 file system through the \gls{USB} connection, or programmatically.
8 8
 
9
-\noindent
10
-The following features are available, implemented as independent functional blocks that can be enabled in any combination:
9
+The developed platform can be used as an learning aid, as an inexpensive development tool replacing professional laboratory equipment, or for automation purposes, taking advantage of its hardware interfacing capabilities to connect to multiple sensors and actuators.
11 10
 
12
-\begin{itemize}[itemsep=1pt]
13
-	\item \textbf{Digital input} with asynchronous pin change detection
14
-	\item \textbf{Digital output} with pulse generation support
15
-	\item \textbf{Digital communication interfaces:}
16
-\begin{itemize}
17
-\item \textbf{\gls{SPI}} with up to 16 slaves and multicast support
18
-\item \textbf{\gls{I2C}} master
19
-\item \textbf{\gls{USART}} with optional RS-485 driver support
20
-\item \textbf{1-Wire} master, implementing the \gls{ROM} Search algorithm
21
-\end{itemize}
22
-	\item \textbf{Analog signal acquisition}
23
-		\begin{itemize}
24
-			\item Immediate or averaged voltage measurement
25
-			\item Isochronous sampling: fixed sample count, or a continuous stream
26
-			\item Threshold-based triggering with a pre-trigger buffer
27
-		\end{itemize}
28
-	\item \textbf{Analog signal generation}
29
-		\begin{itemize}
30
-			\item Sine, triangle, sawtooth, or rectangle waveform generation using \gls{DDS}
31
-			\item \gls{DC} level output
32
-		\end{itemize}
33
-	\item \textbf{NeoPixel RGB \gls{LED} strip control}
34
-\item \textbf{Frequency, pulse width, and duty cycle measurement}
35
-\item \textbf{Pulse counting}
36
-\item \textbf{\gls{PWM} signal generation}	
37
-\item \textbf{Multi-channel shift register loading}
38
-\item \textbf{Capacitive touch sensing}
39
-\end{itemize}
40
-
41
-The developed platform may be used as an learning aid, as an inexpensive development tool replacing professional laboratory equipment, or for automation purposes, taking advantage of its hardware interfacing capabilities to connect to multiple sensors and actuators.
42
-
43
-Future development may focus on expanding support to other \gls{MCU} models, adding new features, improving the software libraries, and providing a more user-friendly control interface.
11
+Future development should focus on expanding support to other \gls{MCU} models, adding new features, improving the software libraries, and providing a more user-friendly control interface.

BIN
thesis.pdf View File


+ 3 - 3
thesis.tex View File

@@ -2,8 +2,8 @@
2 2
 
3 3
 \input{document_config} % import balíků a nastavení ctuthesis
4 4
 
5
-\usepackage[firstpage]{draftwatermark}
6
-\SetWatermarkLightness{0.9}
5
+%\usepackage[firstpage]{draftwatermark}
6
+%\SetWatermarkLightness{0.9}
7 7
 
8 8
 % --- obsah zvláštních oddílů ---
9 9
 
@@ -40,9 +40,9 @@
40 40
 \input{ch.fw_structure}
41 41
 \input{ch.source_and_porting}
42 42
 \input{ch.tinyframe}
43
+\input{ch.gex_units}
43 44
 \input{ch.wireless}
44 45
 \input{ch.hardware_realization}
45
-\input{ch.gex_units}
46 46
 \input{ch.pc_software}
47 47
 
48 48
 \part{Results}

+ 1 - 1
thesis.thanks.tex View File

@@ -13,7 +13,7 @@ Special thanks go to:
13 13
 \begin{itemize}
14 14
 \item Annie, for showing me Draw.io, and its developers, for building a great and free diagram drawing tool.
15 15
 \item Beatrix, for keeping a friendly server where I could hang out in the breaks between writing.
16
-\item Cpsdqs, who helped with proofreading.
16
+\item Cpsdqs and others who helped with proofreading.
17 17
 \item TeXstudio developers, the TeX.StackExchange.com community, and CTAN contributors, without whom this paper would have been much harder to write.
18 18
 \end{itemize}
19 19