added the discussion chapter

master
Ondřej Hruška 7 years ago
parent 48b98f5d4b
commit 3d8192644b
Signed by: MightyPork
GPG Key ID: 2C5FD5035250423D
  1. 53
      ch.discussion.tex
  2. 2
      ch.existing_solutions.tex
  3. 15
      ch.summary.tex
  4. 2
      ch.unit.sipo.tex
  5. 2
      thesis.acronyms.tex
  6. 11
      thesis.bib
  7. BIN
      thesis.pdf

@ -1,3 +1,54 @@
\chapter{Discussion} \chapter{Discussion}
\todo[inline]{TODO} The objective of this work was to develop an extensible platform allowing the user to interact with hardware modules and circuitry from high-level applications running on their \gls{PC}, or, to rephrase it, to ``bring the Raspberry Pi GPIO header to the \gls{PC}''. It was important to design the platform in such a way that a user without much experience with embedded electronics and low level circuitry could still use it with a reasonable level of comfort and confidence.
\section{Solution Summary}
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.
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'').
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.
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.
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 providing a programmatic access to the configuration files also through the communication interface.
\section{Results and Possible Applications}
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.
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.
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.
\section{Comparison with Existing Solutions}
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.
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}.
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.
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.
\section{Limitations}
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.
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.
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.
\section{Future Development}
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.
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.
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 different existing add-ons, and further to explore the possibility of designing custom ones. An add-on board could, for instance, implement the support circuitry needed for the \gls{DALI} bus, RS-485, or for current loop sensors. The \gls{CAN} bus has not been added to GEX because the hardware peripheral cannot be enabled at the same time as \gls{USB}; its addition with an add-on board, or a different microcontroller model, is an interesting possibility.

@ -1,4 +1,4 @@
\chapter{\label{sec:prior_art}Existing Solutions} \chapter{Existing Solutions}\label{sec:prior_art}
The idea of making it easier to interact with low-level hardware from a \gls{PC} is not new. Several solutions to this problem have been developed, each with its own advantages and drawbacks. Some examples will be presented in this chapter. The idea of making it easier to interact with low-level hardware from a \gls{PC} is not new. Several solutions to this problem have been developed, each with its own advantages and drawbacks. Some examples will be presented in this chapter.

@ -1,6 +1,10 @@
\chapter{Summary} \chapter{Summary}
We developed an open source software and hardware platform providing access to low-level hardware buses and circuitry from user applications running on a \gls{PC}. The platform consists of an embedded firmware for the STM32F072 microcontroller, three hardware prototypes (two models of a \gls{GPIO} module, and a wireless gateway), and software libraries in programming languages C and Python. The Python library can be used in MATLAB scripts through the MATLAB/Python integration, or directly in Python, with the SciPy scientific calculations library. The firmware may be used with STM32 Discovery development boards, and can be relatively easily ported to other STM32 \gls{MCU} models. We developed an open source software and hardware platform providing access to hardware buses (SPI, \IIC, USART, and 1-Wire) and low-level circuitry from high-level user applications running on a \gls{PC}. The platform consists of a firmware for the STM32F072 microcontroller, three hardware prototypes, and software libraries in programming languages C and Python, the latter also compatible with MATLAB. The firmware may be used with the custom hardware or STM32 development boards.
The devices are connected to the \gls{PC} by one of three interfaces: \gls{USB} as a virtual COM port or using raw endpoint access, a hardware \gls{UART}, or a radio link with the nRF24L01+ transceiver.
The firmware is configured by editing INI files exposed in a virtual file system through a \gls{USB} connection, or programmatically via the communication interface. The configuration may be stored permanently in the \gls{MCU}'s flash memory, or temporarily in its \gls{RAM}.
\noindent \noindent
The following features are available, implemented as independent functional blocks that can be used in one or more instances: The following features are available, implemented as independent functional blocks that can be used in one or more instances:
@ -39,11 +43,6 @@ The following features are available, implemented as independent functional bloc
\item \textbf{Capacitive touch sensing} \item \textbf{Capacitive touch sensing}
\end{itemize} \end{itemize}
The firmware is configured by editing INI files exposed in a virtual file system through a \gls{USB} connection, or programmatically via the communication interface. The configuration may be stored permanently in the \gls{MCU}'s flash memory, or temporarily in its \gls{RAM}. 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 with a control program running on a PC.
The devices are connected to the \gls{PC} by one of three interfaces: \gls{USB} as a virtual COM port or using raw endpoint access, a hardware \gls{UART}, or a radio link with the nRF24L01+ transceiver. While the firmware has not yet been optimized for low power consumption, the wireless connection allows it to be used in battery-powered applications such as mobile robotics, or outdoor data harvesting.
The developed platform is versatile and may be used as an learning tool, as an inexpensive development tool replacing expensive laboratory equipment, or for automatisation purposes, taking advantage of its hardware interfacing capabilities with a control program running on a PC.
Future development shall focus on thorough testing and optimization of all existing features, porting the firmware to other hardware platforms (such as the STM32L073 for battery-based applications), improving the C library, and implementing client libraries in other programming languages, such as Java or \CS.
Future development shall focus on expanding support to other hardware platforms, improving the software library, and adding support to other programming languages.

@ -1,6 +1,6 @@
\section{SIPO (Shift Register) Unit} \section{SIPO (Shift Register) Unit}
The shift registers driver unit is designed for the loading of data into serial-in/parallel-out (SIPO) shift registers, such as 74xx4094 or 74xx595. These are commonly used to control segmented \gls{LED} displays, \gls{LED} user interfaces, etc. The shift registers driver unit is designed for the loading of data into \gls{SIPO} shift registers, such as 74xx4094 or 74xx595. These are commonly used to control segmented \gls{LED} displays, \gls{LED} user interfaces, etc.
\noindent \noindent
A SIPO shift register has the following digital pins: A SIPO shift register has the following digital pins:

@ -15,6 +15,8 @@
\newacronym{DALI}{DALI}{Digital Addressable Lighting Interface} \newacronym{DALI}{DALI}{Digital Addressable Lighting Interface}
\newacronym{mbus}{M-Bus}{Meter Bus} \newacronym{mbus}{M-Bus}{Meter Bus}
\newacronym{SIPO}{SIPO}{serial in, parallel out}
\newacronym{SSH}{SSH}{Secure Shell} \newacronym{SSH}{SSH}{Secure Shell}
\newacronym{NRZI}{NRZI}{Non Return to Zero Inverted} \newacronym{NRZI}{NRZI}{Non Return to Zero Inverted}
\newacronym{MSC}{MSC}{Mass Storage Class} \newacronym{MSC}{MSC}{Mass Storage Class}

@ -556,3 +556,14 @@
url = {https://pinout.xyz/}, url = {https://pinout.xyz/},
urldate = {2018-05-19} urldate = {2018-05-19}
} }
@online{gex-gh,
title = {GEX USB GPIO platform source code repository},
author = {Ondřej Hruška},
url = {https://github.com/gexpander},
year = {2018},
urldate = {2018-05-21}
}

Binary file not shown.
Loading…
Cancel
Save