# Development of a Datalogger for Submarine Glider: Integration of Fault-Tolerant Software Layers
## 2 Datalogger Design  
To the datalogger design, first of all, we present the data to be stored as well as a brainstorm with the datalogger failure modes to design a software and hardware in order to reduce risks. An ECC code to reduce error probability in bits is necessary, thus we present a design of the ECC that must operate in parallel with the data collection. Finally, reception, encoding, reading, and decoding are implemented in an MSP430 microcontroller based on state diagrams. Multiple factors must be considered in the design of a data storage system: the type of memory device to be used, the sampling period, the type of error control intrinsic to the device, and controls against loss of electrical energy. The solutions that currently exist in storage devices may be suitable for different applications. However, an ad hoc device of a more suitable size, which facilitates the integration to a submarine glider is necessary. The glider developed in CIDESI is shown in Figure 1. To perform further analysis, it is necessary to monitor multiple variables. Some of the variables that the glider must monitor and store in the datalogger are listed in Table 1 There are 256 bytes that are obtained per sample, and 30 samples are taken every minute. In a later section, the storage period for different capacities of the memory chip will be described. For the current time period requirements of the glider in development, the storage device was the Spansion S34 ML08G NAND flash memory chip [47]. It has a capacity of 1 GB and is reasonably accessible because pieces with this features are economic and easy to find in different electronic product suppliers. A summary of the device features of the NAND flash device is given in Table 2. The chosen microcontroller is an MSP430 [48] \begin{table}
\begin{tabular}{c c c} \hline \hline
**Variable** & **Bytes per Sample** & **Unit** \\ \hline Sample number & 8 & \\ Date & 14 & ss:mm:hh DD/MM/YY \\ Battery voltage & 4 & Volts \\ Control voltage & 4 & Volts \\ Current & 8 & Amperes \\ Internal pressure & 5 & psi \\ Internal humidity & 4 & Percentage \\ Temperature & 4 & Celsius \\ Pitch position & 5 & Position in Volts \\ Roll position & 5 & Position in Volts \\ VBD position & 5 & Position in Volts \\ Compass pitch & 8 & Degree \\ Compass yaw & 8 & Degree \\ Compass roll & 8 & Degree \\ GPS & 23 & Latitude and longitude \\ External pressure & 5 & Bar \\ Conductivity & 7 & mS/cm \\ Temperature & 7 & Celsius \\ Salinity & 7 & PSU \\ Water density & 8 & kg/m\({}^{3}\) \\ Speed of Sound & 8 & m/s \\ Echologger & 10 & Meters \\ Free & 91 & Free for other applications or sensors \\ \hline \hline \end{tabular}
\end{table} 
Table 1: Variables of our submarine glider. Figure 1: AUV developed at CIDESI. Figure 3 shows the connection diagram of the electronic system in the glider, and Figure 4 shows the general block diagram of the datalogger. The central computer (C2000 microcontroller) sends information via serial bus at 115200 bauds (A and B) to the datalogger microcontroller. The MSP430 sends commands of configuration data, and commands to write, read, and erase the NAND flash memory chip. In the case that a write command is sent to NAND flash, then the datalogger activates the DMA (3w) and the DMA allocates the RAM (2w) to temporarily store the data that arrives via UART. The main function takes the data from RAM (C) to pass this data to the LFSR BCH (4w), and thus send it to the NAND flash memory chip through (5w, 6w, and D). In the NAND flash read command, the microcontroller activates the Reading function (2r), then, the NAND flash memory chip is read (1r and D). The data received is transferred to the syndrome computation function (3r and 6r). Then, the error locator polynomial is searched through the Peterson algorithm (7r) function [49], and then the roots are calculated with the Chien Algorithm function (8r) that returns the positions of the errors [44,49].