From 97c1a4a4c835d880863be6b4510169572fe19408 Mon Sep 17 00:00:00 2001
From: Sam Anthony <sam@samanthony.xyz>
Date: Mon, 15 Dec 2025 12:37:49 -0500
Subject: report: testing

---
 doc/report/report.tex | 59 +++++++++++++++++++++++++++++++++++++++++++++------
 1 file changed, 52 insertions(+), 7 deletions(-)

(limited to 'doc/report/report.tex')

diff --git a/doc/report/report.tex b/doc/report/report.tex
index fe85a44..c9cda12 100644
--- a/doc/report/report.tex
+++ b/doc/report/report.tex
@@ -247,7 +247,7 @@ Thus, an 8-bit DAC with 256 steps would have been insufficient, and so a 10-bit
 The MCP4912 is a dual-channel 10-bit DAC, so two of them are required to drive the board's four analog outputs.
 
 
-\subsection{Power supply}
+\subsection{Power supply} \label{subsection:PowerSupply}
 
 Standard automotive electrical systems operate at a nominal voltage of around 13.7V, but can swing between 9 and 16V.
 The voltage supply often has a strong pulsating component as well, known as ripple.
@@ -287,28 +287,28 @@ JCLPCB manufactured the board \cite{jlcpcb}.
 
 \begin{figure*}
 	\centering
-	\includegraphics[width=\textwidth]{"schematic-v0.2.pdf"}
+	\includegraphics[width=\textwidth]{schematic-v0.2}
 	\caption{Schematic.}
 	\label{fig:Schematic}
 \end{figure*}
 
 \begin{figure}
 	\centering
-	\includegraphics[width=2.5in]{"pcb_pours-v0.2.pdf"}
+	\includegraphics[width=2.5in]{pcb_pours-v0.2}
 	\caption{PCB front and back copper pours.}
 	\label{fig:PcbPours}
 \end{figure}
 
 \begin{figure}
 	\centering
-	\includegraphics[width=2.5in]{"pcb_3d-v0.2.png"}
+	\includegraphics[width=2.5in]{pcb_3d-v0.2}
 	\caption{3D render of the PCB. Note the vestigial USB-B connector in the top left, to be removed in a future revision (see footnote \ref{foot:Usb}).}
 	\label{fig:Pcb3d}
 \end{figure}
 
 \begin{figure}
 	\centering
-	\includegraphics[width=2.5in]{"pcb_assembled-v0.2.jpg"}
+	\includegraphics[width=2.5in]{pcb_assembled-v0.2}
 	\caption{Fully-assembled PCB sitting on 3D-printed stand.}
 	\label{fig:PcbAssembled}
 \end{figure}
@@ -425,7 +425,7 @@ Ideally it should be ported to other operating systems in the future.
 
 \subsection{CAN bit timing calculation} \label{subsection:Bittiming}
 
-The second program is a small Python script for calculating CAN bit timing parameters.
+The second program is a small script for calculating CAN bit timing parameters.
 
 Each node in a CAN network has its own clock generator.
 The bit timing parameters can be configured individually at each node in order to achieve a common bit rate throughout the network even though the nodes' clock periods may be slightly out of sync.
@@ -446,7 +446,52 @@ This can be remedied in a future revision by adding a dedicated 20MHz oscillator
 
 \section{Testing} \label{section:Testing}
 
-TODO
+A suite of tests was developed to verify the functionality of the device.
+Each system test is a standalone firmware image designed to test a particular subsystem.
+For example, there are system tests for the CAN, DAC, and EEPROM modules, and for the tachometer and speedometer signal generation systems.
+There are also several unit tests to verify some of the more complex routines, such as the CAN decoding functions.
+The tests were used continually to check the functionality of each firmware module as they were being developed, and to detect regression as changes were made and new modules added.
+
+
+\subsection{Equipment} \label{subsection:TestEquipment}
+
+Some special equipment was required for testing.
+
+A USBtin USB-to-CAN interface enabled reading and writing CAN frames to the bus from a workstation computer \cite{usbtin}.
+It was used to monitor the bus during CAN system testing, and to flash the user-calibration onto the device.
+
+An EpoTek Labrador is an inexpensive all-in-one oscilloscope, signal generator, power supply, and logic analyzer \cite{espotek_labrador}.
+It proved invaluable during testing.
+The power supply provided 12V to the board.
+The logic analyzer was used to debug the SPI (serial peripheral interface) bus while developing the HAL firmware modules.
+And the oscilloscope was used to measure the tachometer and speedometer signals generated by the device.
+
+Finally, a simple multimeter was used for continuity testing to verify the design of the circuit board, and to measure the voltages of the board's analog outputs during system testing.
+
+
+\subsection{Results} \label{subsection:TestResults}
+
+An issue with the power supply was uncovered while testing the circuit board.
+As mentioned in \S\ref{subsection:PowerSupply}, the first stage of the power supply is supposed to output 7V.
+However, upon receiving the board, this rail measured only 5V, revealing a mistake in the calulation of the passive components surrounding the buck converter that control its output voltage.
+While this issue will have to be corrected in a future revision, it did not prevent the existing board from being used for the remainder of the project.
+Bypassing the second stage of the power supply by jumping the 7V and 5V rails, thus providing the ICs with the correct voltage, allowed the board to function well enough.
+This workaround can be seen in Fig. \ref{fig:TestSetup}.
+
+\begin{figure}
+	\centering
+	\includegraphics[width=2.5in]{test_setup-v0.2}
+	\caption{%
+		Testing setup: EspoTek Labrador (top), USBtin (left), gauge driver (center), PIC programmer (right).
+		Yellow wire jumps the 7V, 5V-analog, and 5V-digital rails, providing power to the board and circumventing the flaw in the first stage of the power supply.}
+	\label{fig:TestSetup}
+\end{figure}
+
+Overall, testing has been successful.
+Despite minor flaws in the board, the device is able to perform all of its duties.
+It is able to receive CAN frames from the bus, decode them, and generate signals to drive up to six analog gauges accordingly.
+It can generate two variable-frequency square waves to drive a tachometer and a speedometer, and four 0--5V analog signals to drive four pressure or temperature gauges.
+Furthermore, it can be configured for any combination of sensors, gauges, and CAN encoding schemes by flashing a user-calibration with the \emph{cal} program.
 
 
 \section{Conclusion} \label{section:Conclusion}
-- 
cgit v1.2.3

