Professional Documents
Culture Documents
8051 Microcontroller To FPGA
8051 Microcontroller To FPGA
8051 microcontroller to FPGA and ADC interface design for high speed
parallel processing systems – Application in ultrasound scanners
J. Jean Rossario Raj a,⇑, S.M.K. Rahman a,b, Sneh Anand a,b
a
Center for Bio-Medical Engineering, Indian Institute of Technology, New Delhi, India
b
Bio Medical Engineering Unit, All India Institute of Medical Sciences, New Delhi, India
a r t i c l e i n f o a b s t r a c t
Article history: Microcontrollers perform the hardware control in many instruments. Instruments requiring huge data
Received 17 January 2016 throughput and parallel computing use FPGA’s for data processing. The microcontroller in turn configures
Revised 28 March 2016 the application hardware devices such as FPGA’s, ADC’s and Ethernet chips etc. The interfacing of these
Accepted 20 April 2016
devices uses address/data bus interface, serial interface or serial peripheral interface. The choice of the
Available online 5 May 2016
interface depends upon the input/output pins available with different devices, programming ease and
proprietary interfaces supported by devices such as ADC’s. The novelty of this paper is to describe the
Keywords:
programming logic used for various types of interface scenarios from microcontroller to different
ADC
FPGA
programmable devices. The study presented describes the methods and logic flowcharts for different
Microcontroller interfaces. The implementation of the interface logics were in prototype hardware for ultrasound
Serial peripheral interface scanner. The internal devices were controlled from the graphical user interface in a laptop and the scan
Ultrasound scanner results are taken. It is seen that the optimum solution of the hardware design can be achieved by using a
common serial interface towards all the devices.
Ó 2016 Karabuk University. Publishing services by Elsevier B.V. This is an open access article under the CC
BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/).
http://dx.doi.org/10.1016/j.jestch.2016.04.004
2215-0986/Ó 2016 Karabuk University. Publishing services by Elsevier B.V.
This is an open access article under the CC BY-NC-ND license (http://creativecommons.org/licenses/by-nc-nd/4.0/).
J. Jean Rossario Raj et al. / Engineering Science and Technology, an International Journal 19 (2016) 1416–1423 1417
Start Start
Tx FPGA
had sufficient number of IO pins i.e. 19 pins. Hence, to make the operation, the data bus uses IN mode. This is configured using
program logic simple, address/data bus method of interfacing the P4MDOUT configuration depending upon the port being con-
was used. The interconnection between the FPGA and the micro- figured. CS is pulled low depending upon the device to be pro-
controller used 8-bit address bus, 8-bit data bus, read, write and grammed. Read or write pins are made active low depending
CS as shown in Fig. 2. The address bus is simplex i.e. from micro- upon the read or write operation. The address byte is sent to the
controller to the FPGA whereas the data bus is duplex. The logic address bus pins. In case of write operation, data byte is also sent
0 or low in read or write pin indicates that the proposed operation to the data bus pins whereas in read operation, data byte is read
is read or write. from the data bus pins.
The flow chart of the microcontroller program for read and The FPGA logic for the RW operations is presented in Fig. 4.
write operations of the microcontroller is given in Fig. 3. In the FPGA logic waits for the CS pins to be active low. FPGA initiates
write operation, the data bus uses OUT mode where as in read RW operation during the falling edge of the CS. When write pin
Clock = 1
Count = 0
Del
ay
Start
Increment
Clock = 0 counter MOSI = 1
MOSI = 0
Chip Select = 0 Clock = 0
No
No Next
Read Read / Write Count > 8
Bit = 0
Operation
Yes Yes
Write
Exit MOSI = 0
FPGA Write – 00 FPGA Write – 01
Byte (Read Byte (Write FPGA Write Byte Sub Routine
indicator ) indicator )
Clock = 1
FPGA Write – FPGA Write – Count = 0
Del
ay
Address Byte Address Byte
Increment Data = Data | 1
counter
FPGA Read – FPGA Write–
Data Byte Data Byte
Clock = 0
No
Clock = 0 No
MOSI = 0 Count > 8 MISO = 0
Chip Select = 1 Yes Yes
Exit
Data = Data | 0
Stop
FPGA Read Byte Sub Routine
Fig. 6. Flow chart of microcontroller firmware for SPI bus interfacing towards FPGA.
Count = 0
Move last byte to
address logic vector
Move previous byte to
Rising Edge of Move data from address logic vector
Clock No address location
Yes Register to data Move last byte to
Read Data Bit from logic vector Data logic vector
MOSI to LSB of logic
vector Count = 0
Rising Edge of
Increment Rising Edge of No Clock
counter No Clock Yes
No Yes Move data from
Count >= 8 Move MSB of data data logic vector to
Yes to MISO address location
LSB=1, Read register
LSB=0, Write Shift data logic
vector
No
Count >= 16
Increment
Yes counter
Yes
Read Operation
No Yes
No Count = 8
No
Count = 24
Yes
Yes Yes
Return Stop Return
Microcontroller Read Byte Sub Routine Composite Flow chart Microcontroller Write Byte Sub Routine
Fig. 9. Flow chart of microcontroller firmware for Serial bus interfacing towards ADC’s.
1420 J. Jean Rossario Raj et al. / Engineering Science and Technology, an International Journal 19 (2016) 1416–1423
Microcontroller
Programming 3. Results and discussions
header
Positive Pulse Trail of Excitation pulses are controlled by programming the ADC’s through the microcon-
troller as shown in Fig. 11. The control to the ADC is through serial
interface. In addition, the control to the Rx-FPGA is through SPI
interface. In addition, the start and stop of scan is controlled by
the configuration of the transmit and receive FPGA’s. Upon start
of a scan, the Tx-FPGA, excites the selected channels. The Rx-
FPGA receives the data from the ADC’s, convert the data into pack-
ets and it is sent to the laptop over the Ethernet interface. The Eth-
ernet packets received from the prototype is shown in Fig. 13.
The stop scan disables the channels and stop sending the Ether-
net data packets. Thus by programming control through the micro-
controller, the developed hardware is able to be controlled very
effectively. The image was taken using a linear array transducer
probe working at 4 MHz. The receive beamforming, image and
video processing algorithms like smoothening, sharpening, his-
togram equalization etc., were performed in MATLAB graphical
user interface. The receive beamforming required delay and sum
Negative Pulse Trail of Excitation pulses algorithm for the simultaneously received channels. The image
obtained with a lab phantom indicating the position of the inclu-
Fig. 12. Output pulse waveform based on microcontroller FPGA control. sion as well as the depth of the phantom is given in Fig. 14.
The comparison of the three methods of microcontroller inter-
facing is given in Table 1.
A channel is selected as shown in Fig. 11. Configure FPGA command, It is seen from Table 1 that serial interfacing is the most com-
transfers the HEX values to the microcontroller, which in-turn plex but most efficient in respect of pin usage and can be com-
writes the Tx FPGA registers through the parallel interface. The monly used across all the devices. Usually execution time is not
Tx-FPGA generates the required enable and excitation pulses. The an important criterion as the microcontroller interface is used for
output pulse waveforms of the transmit section used for exciting machine control. However, in case the microcontroller interface
the ultrasound transducer array is shown in Fig. 12 showing the pos- is used for data transfer, address/data bus configuration is pre-
itive and negative trail of high voltage pulses. ferred. Hence, the actual type of interfacing required is to be
Similarly, AD9272 parameters like the LNA Gain, VGA Gain, AAF decided after weighing all the pros and cons of different interfacing
upper and lower cutoff frequencies, generation of test pattern etc., methods.
Table 1
Comparison of the microcontroller interfacing methods.
Reflection by
Inclusion and
inside air gaps
Reflection from
bottom surface
Phantom with inclusion
used for the evaluation
Fig. 14. Ultrasound image of a phantom with inclusion captured using the prototype.
4. Conclusion of microcontroller interface with FPGA’s and ADC’s, the best option
will be to go for serial interface compatible with ADC for all types
The most important part of the development of the firmware of devices. This will have the following pros and cons. The micro-
was in the development of the interface programs that was suit- controller program becomes simple as single interface logic can
able for the interfaces supported by the application specific device be used for all types of devices. This will also reduce the number
as well as the availability of pins in the interface devices. Interface of microcontroller pins used. This will further reduce the number
design is the most important step in the use of general-purpose of FPGA pins required for control also. However, the FPGA program
devices like microcontrollers and FPGA’s for application specific will be very complex and FPGA will require more storage space.
usages and control. The use of general-purpose microcontrollers But same FPGA interface code can be used for both the FPGA’s.
and FPGA’s will make the hardware miniaturised and cost effective, While developing the different interfaces the main aspect of
which is an essential requirement for telemedicine application consideration was the ease of programming. As a future step, all
[21]. With the innovative approaches, it was possible to develop the interfaces can be made common so that the microcontroller
highly configurable, scalable and flexible FPGA based ultrasound program further simplifies even though there would be more com-
systems [14,22]. The development of these interfaces helped in plications in the FPGA program algorithms. This could further
the miniaturization of the hardware, thus enabling the hardware improve the design architecture.
to be used for telemedicine applications [1,23,24]. The FPGA based
implementation has helped in the hardware to be operated at high Acknowledgment
frame rates of the order of 8000 [25,26].
One important conclusion arrived from the study after using The authors thank Department of Science and Technology,
different types of interfaces was that it is always preferable to Government of India for providing financial support for this
use one type of interfacing across multiple devices. In this study project.
J. Jean Rossario Raj et al. / Engineering Science and Technology, an International Journal 19 (2016) 1416–1423 1423
References [13] J.J.R. Raj, S. Rahman, A. Sneh, Electronic hardware design for ultrasound
transient elastography, Int. J. Eng. Sci. Technol. 4 (2012) 3700–3704.
[14] H.J. Hewener, H.-J. Welsch, H. Fonfara, F. Motzki, S.H. Tretbar, Highly scalable
[1] J. Raj, S. Rahman, S. Anand, Interfacing high frame rate data through ethernet
and flexible FPGA based platform for advanced ultrasound research, in: 2012
without loss for tele-medical applications, in: 2015 International Conference
IEEE International Ultrasonics Symposium (IUS), IEEE, 2012, pp. 2075–2080.
on Signal Processing and Communication (ICSC), IEEE, New Delhi, 2015, pp.
[15] L.L. Li, J.Y. He, Y.P. Zhao, J.H. Yang, Design of microcontroller standard SPI interface,
51–55, http://dx.doi.org/10.1109/ICSPCom.7150618.
in: Applied Mechanics and Materials, Trans Tech Publ, 2014, pp. 563–568.
[2] J.J.R. Raj, S. Rahman, S. Anand, Acquisition of lossless data in transient window
[16] B. Mondal, M. Meetei, J. Das, C.R. Chaudhuri, H. Saha, Quantitative recognition
through Ethernet in high frame rate machines, in: 2015 2nd International
of flammable and toxic gases with artificial neural network using metal oxide
Conference on Computing for Sustainable Global Development (INDIACom),
gas sensors in embedded platform, Eng. Sci. Technol. Int. J. 18 (2015) 229–234,
IEEE, New Delhi, 2015, pp. 591–596.
http://dx.doi.org/10.1016/j.jestch.2014.12.010.
[3] X.R. Zhao, F.Y. Ye, X.F. Qian, H.Y. Fu, W. Jin, Remote monitoring system for
[17] E.D. Moreno, F.D. Pereira, A modular multicore architecture in FPGAs for
communication base based on short message, TELKOMNIKA Indones. J. Electr.
embedded critical applications, in: 2015 Ninth International Conference on
Eng. 12 (2014) 459–467.
Complex, Intelligent, and Software Intensive Systems (CISIS), IEEE, 2015, pp.
[4] B.-E. Byambasuren, M. Oyun-Erdene, S.-Y. Nam, D.-H. Kim, S.-M. Han, Design of
364–371.
USB-based high rate data communication for transcranial Doppler ultrasound
[18] M. Mielke, S. Hardt, A. Grünewald, R. Brück, FPGA implementation of an
system, Int. J. Control Autom. 5 (2012) 97–106.
evolutionary algorithm based charge management for electric vehicles, in:
[5] J.R. Raj, S. Rahman, S. Anand, Microcontroller USB interfacing with MATLAB
2012 Proceedings of the 19th International Conference Mixed Design of
GUI for low cost medical ultrasound scanners, Eng. Sci. Technol. Int. J. 19
Integrated Circuits and Systems (MIXDES), IEEE, 2012, pp. 559–563.
(2016) 964–969.
[19] S. Hauck, The roles of FPGAs in reprogrammable systems, Proc. IEEE 86 (1998)
[6] A. Al-Dhaher, Integrating hardware and software for the development of
615–638, http://dx.doi.org/10.1109/5.663540.
microcontroller-based systems, Microprocess. Microsyst. 25 (2001) 317–328,
[20] V. Vasudevan, P. Govindan, J. Saniie, Dynamically reconfigurable analog front-
http://dx.doi.org/10.1016/S0141-9331(01)00124-7.
end for ultrasonic imaging applications, in: 2014 IEEE International
[7] S. Padmanaban, E. Kabalci, A. Iqbal, H. Abu-Rub, O. Ojo, Control strategy and
Ultrasonics Symposium (IUS), IEEE, 2014, pp. 1924–1927.
hardware implementation for DC–DC boost power circuit based on
[21] A. Chandra, S. Chattopadhyay, Design of hardware efficient FIR filter: a review
proportional–integral compensator for high voltage application, Eng. Sci.
of the state-of-the-art approaches, Eng. Sci. Technol. Int. J. (2015).
Technol. Int. J. 18 (2015) 163–170, http://dx.doi.org/10.1016/j.jestch.2014.
[22] E. Boni, L. Bassi, A. Dallai, F. Guidi, A. Ramalli, S. Ricci, J. Housden, P. Tortoli, A
11.005.
reconfigurable and programmable FPGA-based system for nonstandard
[8] D.T. Martinez, T.U. Ganiron Jr., C.S. Lacsamana, Development of hardware
ultrasound methods, IEEE Trans. Ultrason. Ferroelectr. Freq. Control 59
interfacing system for visual C++, Int. J. Adv. Appl. Sci. 2 (2013) 201–204.
(2012) 1378–1385, http://dx.doi.org/10.1109/TUFFC.2012.2338.
[9] M. Gökdağ, A.T. Sözer, H. Abdullah, A web-based remote monitoring of solar
[23] G.-D. Kim, C. Yoon, S.-B. Kye, Y. Lee, J. Kang, Y. Yoo, T.-K. Song, A single FPGA-
energy measurements and data storage system design for renewable energy
based portable ultrasound imaging system for point-of-care applications, IEEE
center of Karabuk University, Eng. Sci. Technol. Int. J. 16 (2013).
Trans. Ultrason. Ferroelectr. Freq. Control 59 (2012) 1386–1394, http://dx.doi.
[10] F. Vahid, L. Tauro, An object-oriented communication library for hardware–
org/10.1109/TUFFC.2012.2339.
software codesign, in: Proceedings of the Fifth International Workshop on
[24] J.J.R. Raj, S. Rahman, S. Anand, Acquisition of high frame rate ultrasound data
Hardware/Software Codesign, 1997. (CODES/CASHE’97), IEEE, 1997, pp. 81–86.
through Ethernet for telemedicine applications, Int. J. Basic Appl. Biol. 2 (2014)
[11] J. Blahuta, T. Soukup, P. Čermák, D. Novák, M. Večerek, Semi-automatic
28–33.
ultrasound medical image recognition for diseases classification in neurology,
[25] J.J.R. Raj, S. Rahman, S. Anand, An embedded system for elasticity
in: Advances in Intelligent Analysis of Medical Data and Decision Support
measurement using ultrasound waves, in: Proceedings of DIGNATE 2014:
Systems, Springer, 2013, pp. 125–133.
ETEECT 2014, New Delhi, 2014, pp. 38–43.
[12] N. Li, J. Guo, H.S. Nie, W. Yi, H.J. Liu, H. Xu, Design of embedded bio-impedance
[26] J.J.R. Raj, S. Rahman, S. Anand, Application of a novel software algorithm for
analyzer based on digital auto balancing bridge method, in: Applied Mechanics
information reduction in high frame rate ultrasonography, Int. J. Comput. Appl.
and Materials, Trans Tech Publ, 2012, pp. 396–401. doi: 10.4028/
Technol. Res. 3 (2014) 729–733, http://dx.doi.org/10.7753/ijcatr0311.1016.
www.scientific.net/AMM.135-136.396.