##ReadSmartag2-VFlash

##Overview:
This code is used to decode information read from the SPaRAS application of the STmicroelectornics SMARTAG2 Evaluation board when running SmartagV3.2 code and saving environmental information to Flash memory. 
This code was developed through the duration of James Gerrans' PhD at the University of Reading.

The purpose of this code is to read information from output binary files from SPaRAS and output the information in human readable format in .txt and .csv files.

##Input Information File structure
All input information for this program must be contained within a single folder. The file structure within that folder is as follows.
The folder must contain two folders named "Input" and "Hex". All input information must be in .bin files placed within the Input folder. 
.bin files must be labelled In the following way rootfilenameBoardnumber-pagenumber.bin. 
(I.e "data2-7.bin" for information read from board 2 on page 7 when the root file name is "data")
The sensor configurations page from each board is required and should be labelled as above with page number being "0". Absence of the sensor configurations file for a board will result in error.
The input folder must contain information from all pages of environmental data from a device. 
Each file will contain 2 flash pages worth of information so files will start from page 1 and increase in intervals of 2 including only odd numbers. Any missing files will result in error.

Information from up to 4 board can be processed at once, this requires board numbers to start at 1 and increase in order. Any missing board numbers will result in error.

Outputs from the code will be placed into the folder containing Input and Hex folders

##BEFORE RUNNING CODE, update the following variables and definitions:
NO_BOARDS (line 125) the number of boards worth of information being processed (1-4)
char folderPath (line 127) the location of the folder containing all information required
char testName (line 128) the name of the folder containing all information required (the folder containing Input and Hex folders)
char fileName (line 129) the root file name of all input files, defaulted to data.
time_t manualStartTime (line 131) this contains the start time of the tests run on each board 1-4 in epoch form. (This is only needed if the starttime was not recorded on the SPaRAS deivce.)


##System Requirements and Dependencies:
This code has been developed in C and tested in the "Eclipse IDE for C and C++ Developers - 2025-06".
No other versions have been tested.

##Terms of Use:
Data, modifications to FP-SNS-SMARTAG2 code and documentation: copyright 2026 James and Gerrans and University of Reading. This material is licensed under a Creative Commons Attribution 4.0 International Licence: https://creativecommons.org/licenses/by/4.0/.

FP-SNS-SMARTAG2 (STMicroelectronics example code for the SMARTAG2 Evaluation Board, which has been modified by the creators of this item): copyright 2022 STMicroelectronics. All Rights Reserved. This code is distributed under the terms of the STMicroelectronics software licence, which is reproduced in the folder STM32CubeFunctionPack_SMARTAG2_V1.1.0 under SmartagV3.2.

##Acknowledgements:
This code includes code modified from the STmicroelectronics example code for the SMARTAG2 Evaluation Board (STM32CubeFunctionPack_SMARTAG2_V1.1.0)


