UART Communication Interface

UART communication interface needs two connections for the data transfer. TX and RX lines are used to exchange data between customer base board and sensor module. These lines tolerate maximum voltage of 3.6V. Signal levels below 0.8V are detected as low-level and signals above 2.4V are detected as high-level signals. The serial communication interface is configured with the parameters given in Table 1.

Table 1. UART communication interface configuration
UART lines: TX, RX (3.3V)
Baud rate: 115200
Word length: 8 bit
Parity: None
Stop bits: 1

Communication with the sensor is based on a simple exchange of ASCII character strings through the UART interface. Setting parameters and executing sensor functions are performed with ASCII commands. Spectral data consists of single precision floating point values representing the intensity values at different wavelengths. These values are transferred as a stream of binary data to avoid the overhead of using ASCII characters. The binary data can be easily rearranged by the user application to represent the intensity values of the spectrum.

ASCII command strings should be terminated with carriage return <cr> or line feed <lf> control character to be recognized as a valid command. The response strings from the sensor are terminated with <cr><lf> characters. Measurement data is sent in binary data format and during these transfers termination characters <cr> and <lf> can’t be used to terminate the transfer as the binary data might contain these characters as a part of the binary presentation of floating point values.

Measurement data in the device is an array of 32-bit floating point values. Maximum size of the array is 512 measurement points. Number of measurement points may be different depending on the user given measurement parameters. The data is sent as stream of 8 bit values and it is up to the application program to rearrange the measurement data back to 32-bit data representation of the single precision floating point values. The binary data is sent in little endian format.