Raspberry Pi as a measurement system control unit

0 downloads 0 Views 664KB Size Report
Abstract—In this paper a system for measuring temperature in an FPGA structure is proposed. ... relationship were made using Gnuplot and Scilab. The results .... Scilab acceptable format files, calling Gnuplot for data visualization in 2D and ...
Raspberry Pi as a Measurement System Control Unit Sławomir Michalak Faculty of Electronics and Telecommunications Poznan University of Technology Poznań, Poland [email protected] Abstract—In this paper a system for measuring temperature in an FPGA structure is proposed. In this arrangement the Spartan-3 XC3S200 programmable FPGA device was tested and the popular small educational microcomputer Raspberry Pi, was employed as a control unit for the whole system. Part of the system was implemented inside the tested structure. There was an array of ring oscillators as temperature sensors and a structure for controlling the array. Ring oscillators are often implemented in FPGA devices. They are used both as single elements or an array of sensors for measuring the chip’s temperature or path delay of SUT. The sensors can be located in different areas of the chip. In the case of this tested device 36 sensors were used, but generally, their number depends on the designer. The ring oscillator’s frequency depend on the temperature, and the frequency of the activated sensor was measured outside with an oscilloscope. The Raspberry Pi controlled the measurement process via an SPI and the results were collected from the oscilloscope via a UART/RS232 interface. 2D and 3D visualizations of the frequency to temperature relationship were made using Gnuplot and Scilab. The results should visualize the temperature distribution inside the device, but first, the right calibration of sensors should be performed. Keywords— Raspberry Pi; ring oscillator; FPGA

I. INTRODUCTION Thermal verification of FPGA devices can help the designer notice if a particular block is operating in accordance with specifications. One of the ways of temperature measurement is to measure the output frequencies of an array of ring-oscillators previously implemented in the device. The main benefit is that neither external components nor analog parts are necessary. An FPGA-oriented temperature monitoring system is proposed here and the main part of this system is the Raspberry Pi – a single-board and low-cost microcomputer that has recently become very popular. The Raspberry Pi is a credit-card-sized (86 x 56 mm) single-board and low-cost computer (Fig.1) developed by the Raspberry Pi Foundation (supported by the University of Cambridge Laboratory and Broadcom Corporation) with the intention of promoting the teaching of basic computer science in schools [1]. The comparatively low price and the relatively large possibilities of the central unit resided in, caused the Raspberry Pi being often used not only for educational purposes but also (individually or in sets) in steering processes or measurement systems.

Fig. 1. Raspberry Pi Model B.

The module of the Raspberry Pi microcomputer is based on the Broadcom BCM2835 SoC unit. Generally, the SoC (system - on - the chip) defines the structure that includes a complete microprocessor system, so there is the central unit (CPU), FLASH or ROM, EEPROM and RAM memory, digital and analog devices, and also the analog-to-digital and digital-to-analog converters, as well as serial interfaces. In distinction from the microcontroller, SoC devices are equipped with central units with comparatively large computational power, making it possible to run the operational system. The Broadcom BCM2835 contains the ARM1176JZFS processor, VideoCore IV GPU graphics, and 256 MB (Model A) or 512 MB (Model B) of RAM memory. Raspberry Pi does not include a built-in hard disk or solidstate drive, but it uses an SD card for booting (the operating system is installed on the SD card) and persistent storage (the card is used to store all data). II. ARCHITECTURE OF THE MEASUREMENT SYSTEM The general architecture of the proposed measurement system is depicted in Fig.2. The examined device was a programmable FPGA with an array of ring oscillators (RO) working as temperature sensors. The Raspberry Pi microcomputer controls all tasks of the measurement system. Every ring oscillator was composed of an odd number of inverters. The propagation delay of the inverters and the frequency of the ring oscillators depends (among others things) on temperature. Some results of the experiments concerned with ring oscillator frequency versus temperature are given in the references [2], [3].

978-1-4799-7009-4/14/$31.00 ©2014 IEEE

bytes on the MISO line, so verification is possible. The /STR signal confirms every byte, so it additionally decreases the possibility of error and wrong byte interpretation, in case of noises on data or clock lines. One by one, sensors are activated by sending an n-bit long word. The demultiplexer (DEMUX) selects one of the 2n output lines and enables the input (EN) of the chosen ring oscillator (Fig.4) for a period of time determined by the /STR signal. Frequency signal fosc from the activated oscillator, via addressable multiplexer (MUX) and frequency divider is given on the output as a fout signal. Fig. 2. General architecture of the proposed measurement system.

The Raspberry Pi module controls the array of sensors via the SPI serial interface, and the serial UART/RS232 interface controls the digital oscilloscope. This one is used to measure the frequency of the generated signal. The functional tests were performed with the Spartan-3A XC3S200 (Xilinx) device. The block diagram of the structure implemented inside the device (Verilog language was used) is shown in Fig.3.

Fig. 4. A ring oscillator (RO) circuit with enable input.

In this version of the system an 8-bit word was used, so there was a possibility to use up to 28=256 sensors. This amount seems to be enough, even in the case of analyzing more complicated devices than the XC3S200. Increasing the number of sensors can be done through the modification of the multiplexer and the demultiplexer structures, and resizing the SPI register. The SPI as a simple serial-to-parallel register can be easily resized to an n-bit length word. A larger array of sensors could be controlled through line-column examination. The output frequency signal fout from the activated sensor was measured by the TDS1002 Tektronix oscilloscope via RS232 serial interface. For frequency measurement, a digital oscilloscope and SCPI commands were used. Although the SCPI language has been developed as a kind of standard for controlling measurement equipment, instruments from different producers need a little different command syntax. An example of SCPI commands for frequency measurement is shown in Table 1 (syntax for the Tektronix oscilloscope).

Fig. 3. Structure implemented inside the FPGA device.

In our experiment, we implemented an array of 36 identical ring-oscillators to illustrate some aspects of thermal testing. The oscillators were manually placed and routed in CLBs area to create a 6x6 array. The number and location of the sensors depended on the size (resources) of examined structure. The programmability of FPGA devices is very useful when we want to change the location of the sensors or decrease the size of the examined area inside the device. During the initial tests, the entire area of the examined FPGA structure was analyzed. Increasing the amount of the implemented ring oscillators, for better temperature measurement, is not always a good idea. The self-heating effect appears during the measurement, so rather it is better to minimize the amount of oscillators and optimize their location in the examined area, than to increase their number [4], [5]. In the proposed measurement system, the Raspberry Pi as a master device controls an array of sensors via the serial SPI interface. Inside the FPGA structure, a simple SPI register was implemented, working as a slave device. The master device gives an n-bit control word on the MOSI line and a clock signal on the SCK line. Also, there is a possibility to read

TABLE I.

SCPI COMMANDS FOR OSCILLOSCOPE

/query for the oscilloscope identification in IEEE 488.2 notation / *IDN?\n / returns the oscilloscope identification and its firmware/ a TEKTRONIX, TDS 1002,0, CF.99.1.CT FV.v2.12 TDS2CM:CMV:v1.04 /sets the immediate frequency measurement/ MEASUrement:IMMed:TYPe FREQency\n /executes the immediate oscilloscope measurement/ MEASUrement:IMMed:VALue?\n /oscilloscope response – measurement frequency result/ 3.1289112E7\n a.

Sample for TDS1002 oscilloscope (Tektronix)

The Raspberry Pi has a UART (so-called mini UART) intended to be used as a console by default. It needs to be enabled before it can be used as an interface. The mini UART has the following features: 7 or 8 bit operation, 1 start and 1 stop bit, no parities, break generation, FIFO for receive and transmit, controlled RTS and readable CTS, 16550 like registers and baud rate derived from a system clock. This mini UART does not have: break detection, framing error detection,

978-1-4799-7009-4/14/$31.00 ©2014 IEEE

parity bit, DCD, DSR, DTR or RI signals. The implemented UART is not fully 16650 compatible, but all control bits for simple UART receive/transmit operations are still available. With RxD and TxD signals, basic communication with measurement instruments (oscilloscope, frequency meter) is possible through the UART/RS232 interface. The ARM BCM2835 unit needs a 3.3V power supply, also the GPIO lines, including UART, are compatible only with 3.3V. To assure compatibility with the RS232 standard, an additional UART/RS232 converter was used (MAX3232 dedicated specially for a 3.3V supply). III. PROGRAM CODE FOR RASPBERRY PI The program in C language controls the system. The Raspberry Pi works under the Linux operating system. In this situation, the serial interface is used to service the terminal by default. It was necessary to make some modifications in configuration files to use UART resources and the serial interface for oscilloscope control. Additional C language libraries for SPI and UART, specially dedicated for BMC2835 could be used (WiringPi , BMC2835 libraries). For example, in our tested program, the BMC2835 library for SPI interface control was used. The Raspberry Pi module works under an Open Source operating system Linux (Raspbian). Therefore, also C program was written in a free programming environment (Geeny editor) and for data visualization, the free Gnuplot and Scilab environments were used. The main C language program has the following functions: SPI interface initialization, UART RxD and TxD lines initialization, sensor addressing in the array, frequency measurement, data presentation on terminal console, data saving in Gnuplot and Scilab acceptable format files, calling Gnuplot for data visualization in 2D and 3D plots. The program can also collect data in appointed time periods and create graphical files. Next, those files are used to produce animated movies to illustrate how the measured value changed in time. The Raspberry Pi does not come with a real-time clock, so the OS must use a network time server, or ask the user for time information at boot time to get access to time and date for file time stamping.

The program can be used both interactively and in batch mode using scripts. Gnuplot is not dedicated for mathematical environment, so for advanced computation and data analysis the Scilab environment was used. Scilab is an open source, cross-platform numerical computational package and a highlevel, numerically oriented programming language. It can be used for signal processing, statistical analysis, image enhancement, fluid dynamics simulations, numerical optimization, and modeling, simulation of explicit and implicit dynamical systems and (if a corresponding toolbox is installed) symbolic manipulations. Scilab is the most complete open source alternative to MATLAB. For each of the sensors the frequency was measured. An example of the results for 36 sensors, plotted by Gnuplot, and interpolated results from Scilab are shown in Fig.5 and Fig.6. In this case, the frequency results from the implemented ring oscillators can’t directly represent the temperature inside the tested structure. Although all ring oscillators were identical (the same inverters were implemented in CLBs), they were placed in differ parts of the FPGA area.

Fig. 5. Left: The frequencies of 36 sensors in an idling device XC3S200 (Gnuplot 3D chart). Right: Interpolated frequency (Scilab 3D visualization).

IV. FUNCTIONAL TESTS AND DATA VISUALIZATION Functional tests of the system and frequency measurements for each sensor were performed. In the FPGA device, there was only the measurement structure (i.e., the array of ring oscillators), no other structure was implemented. There were no other elements which could (intentionally or not) generate additional self-heating (idle mode). During the tests, the correctness of array and SPI register implementation was checked. Then, the commands for activity the chosen ring oscillator and data collection in Raspberry Pi were tested. For data visualization, Gnuplot from main C language was called. Gnuplot is a command-line program that can generate two- and three-dimensional plots of functions, data, and data fits. It is frequently used for publication-quality graphics as well as educational purposes. The program runs on all major computers and systems. Gnuplot can produce output directly on screen, or in many formats of graphics files (PNG, EPS, SVG, JPEG and many others). It is also capable of producing LaTeX code directly in LaTeX documents.

Fig. 6. Left: Interpolated color 3D map of sensors frequency in an idling device. Right: 2D map of frequency. Higher oscillation count is related to red color, lower frequency is related to blue one.

That way every ring oscillator has a different frequency, so an individual calibration process is needed. Therefore, to illustrate this frequency difference some measurements at various temperatures were performed. For all 36 sensors, the frequency versus temperature dependence was determined. Beside the ambient conditions, where package temperature was close to 35°C, an external heat source was used to obtain more measurement points, so the range from 35°C to 90°C (package temperature) was analyzed. The FPGA device was heated the stream of hot air and the package temperature was measured with an infra-red thermometer (IR NC100).

978-1-4799-7009-4/14/$31.00 ©2014 IEEE

It turned out (as expected) that the temperature-tofrequency relationship is almost linear for the temperature range tested (for a wider temperature range, especially below operating temperature and cryogenic range, the ring oscillators, as well as RC oscillators, have a strongly nonlinear dependence [9]). For future calibration equations, linear regression coefficients for every individual sensor can be calculated. In any case, in future measurements, the calibration process should take into account the thermal properties of the device, as well as sensors locations. V. CONCLUSIONS

Fig. 7. Interpolated RO frequencies layout for several temperatures (package temperature was measured). As we can see, ring oscillators have different frequencies, so an individual calibration process in needed.

Layouts of interpolated RO frequencies for several temperatures are shown in Fig.7 (package temperature was measured). These received results confirm that ring oscillators implemented in the device have different frequencies, so for future measurements an individual calibration process is required. The main approaches to this calibration process are described in literature. Some of them are based on physical thermal sensors integrated in devices (IOB diodes) [6]. Another calibration method determines ring oscillators frequencies in a controlled climate chamber, where also package temperature is measured by additional analog or digital temperature sensors [7]. A comparable method uses infra-red measurements of the device [8]. All these methods assume the temperature of the sensor is similar to that of the package. For each temperature, the frequencies are measured and the linear or polynomial regression is performed on data. The frequency versus temperature dependence is depicted in Fig.8. Only 2 of 36 sensors (including the slowest and the fastest RO) and the average were chosen for chart readability.

The use of the Raspberry Pi, a small education-dedicated computer, as a master unit of the measurement system, is an interesting alternative for PC computer based measurement systems. Of course, smaller (but not so little) resources of the BCM2835 central processor unit do not allow competing with PC computers based on advanced 64-bit architecture. But such features as possibility of working under one of Linux distribution operating system, the opportunity of communication with external advanced measurement instruments, not only via the serial UART/RS232 interface but also due to programmable (assembler, C, Python) I/O lines or SPI, I2C interfaces, allow to use of the Raspberry Pi as a part of an embedded measurement system co-operating with FPGA system under test structures. ACKNOWLEDGMENT This research work has been supported by Department of Electronic and Telecommunications, Poznan University of Technology resources (08/83/DSPB/4709). REFERENCES [1] [2]

[3]

[4]

[5]

[6]

[7]

[8]

[9] Fig. 8. Ring oscillator frequency to chip package temperature relationship (IR measurements). Only 3 charts were shown for chart readability (the slowest and the fastest and the average of all 36 RO).

E. Upton, G. Halfacree, “Meet the Raspberry Pi,” Wiley, 2012. S. Lopez-Buedo, J. Garrido, E. Boemo, “Thermal testing on programmable logic devices,” Proceedings of the ISCAS'98 IEEE International Symposium on Circuits and Systems, vol. 2, pp. 240-243, 1998. J.J.L. Franco, E. Boemo, E. Castillo, L. Parrilla, “Ring oscillators as thermal sensors in FPGAs: Experiments in low voltage,” In Programmable Logic Conference (SPL 2010), pp. 133-137, 2010. B. Lee, K. Chung, B. Koo, and N. Eum, “Thermal sensor allocation and placement for reconfigurable systems,” Transactions on Design Automation of Electronic Systems, vol. 4, no. 41, pp. 50:1–23, 2009. B.H. Lee, K. T. Kim, "Optimal allocation and placement of thermal sensors for reconfigurable systems and its practical extension," Design Automation Conference ASPDAC 2008, Asia and South Pacific. IEEE, pp. 703-707, 2008. M. Happe, A. Agne, C. Plessl, “Measuring and predicting temperature distributions on FPGAs at run-time,” International Conference on Reconfigurable Computing and FPGAs (ReConFig), pp. 55-60, 2011. P.H. Jones, J.W. Lockwood, Y.H. Cho, “A thermal management and profiling method for reconfigurable hardware applications,” IEEE In Field Programmable Logic and Applications International Conference, FPL'06, pp. 1-7, 2006. A. N. Nowroz, S. Reda, “Thermal and power characterization of fieldprogrammable gate arrays,” in Proceedings of the ACM/SIGDA International Symposium on Field-Programmable Gate Arrays, pp. 111114, 2011. S. Michalak, “Behaviour of ATtiny microprocessors in low temperetures,” Proceedings of the ICEC 23/ICMC 2010 International Cryogenic Engineering Conference and International Cryogenic Materials Conference, Wroclaw, pp.581-584, 2011.

978-1-4799-7009-4/14/$31.00 ©2014 IEEE