Homework 5 Document

advertisement
ECE 477
Digital Systems Senior Design Project
Rev 8/09
Homework 5: Theory of Operation and Hardware Design Narrative
Team Code Name: HULK
Group No. 9
Team Member Completing This Homework: Dhruv Lamba
E-mail Address of Team Member: dlamba@ purdue.edu
Evaluation:
SCORE
DESCRIPTION
Excellent – among the best papers submitted for this assignment. Very few
corrections needed for version submitted in Final Report.
Very good – all requirements aptly met. Minor additions/corrections needed for
9
version submitted in Final Report.
Good – all requirements considered and addressed. Several noteworthy
8
additions/corrections needed for version submitted in Final Report.
Average – all requirements basically met, but some revisions in content should
7
be made for the version submitted in the Final Report.
Marginal – all requirements met at a nominal level. Significant revisions in
6
content should be made for the version submitted in the Final Report.
Below the passing threshold – major revisions required to meet report
*
requirements at a nominal level. Revise and resubmit.
* Resubmissions are due within one week of the date of return, and will be awarded a score of “6”
provided all report requirements have been met at a nominal level.
10
Comments:
Comments from the grader will be inserted here
ECE 477
1.0
Digital Systems Senior Design Project
8/09
Introduction
The HULK (Huge Universal Language Keyboard) is designed to be a multi-language
keyboard, enabling the user to type using customizable layouts, which may be changed in real time
through a touch screen menu on the keyboard itself.
The external design of the HULK involves a 15” 4:3 aspect ratio LCD monitor surmounted
by a PCB containing a matrix of 61 switches (for the 61 keys) to receive user input. To the right of
and adjacent to the keyboard matrix is a touch screen menu which is used to select the language to
type in. In addition to typing in pre-programmed languages, the keyboard may be fed new
languages through an SD card interface on the keyboard itself. The keyboard communicates with a
host PC running suitable word processing software such as Microsoft Word/Word Pad. The
communication takes place via a PS2 connector that is converted to USB through a PS2-USB
adapter.
Internally, the HULK uses a PIC32MX695F512L microcontroller from Microchip [1] to
control the various peripherals. The microcontroller communicates with an FPGA, the Cyclone II
from Altera [2] via the microcontroller’s SPI; the FPGA in turn drives the VGA output for the LCD
monitor. The SD card also communicates with the micro through the SPI interface. The major subsection of the HULK circuit which is the actual keyboard consists of 61 switches [3] as described
above. The switches are laid out in 5 rows on a PCB surmounting the LCD monitor, with their
signal wires being read as parallel inputs into an array of 8 8-bit parallel-serial shift registers [4]
(total bit width of 64 bits for the 61 keys, with 3 don’t care bits). The shift registers are daisy
chained to output an 8 byte serial code to the micro, also via the SPI interface (3-wire). Finally, the
touch screen ELT240320ATP [5] also uses the SPI interface to convey touch input information, and
in addition uses 8 bits of bus width from the microcontroller to control the TFT screen display.
Regarding power components, the HULK uses AC power at 110V to serve the LCD monitor
directly. The 110V line is stepped down to 5.0 V using an AC-DC power supply, which provides a
power rail for all the devices operating at this logic level, e.g., the shift registers. The other devices
operating at 3.3 V, such as the microcontroller, the FPGA and the flash chip are powered using
another step down DC-DC 5.0 – 3.3 V power supply. Linear regulators are used in addition with the
power supply to keep the voltage levels constant. Inrush current limiters are also used to provide
surge protection and limit the current to below the absolute maximum ratings.
-1-
ECE 477
Digital Systems Senior Design Project
8/09
2.0 Theory of Operation
The circuit mainly consists of the following sub sections:
1) Power supply board
2) Microcontroller circuit board containing
a. FPGA based VGA signal generator
b. Touch screen module
c. SD Card module
d. Keyboard
1) Power Supply Circuit:
The LCD Monitor is powered directly with a 110 VAC line from a wall outlet, as the LCD
monitor we are using already has on board power management circuitry. For the remaining D.C.
components, an AC-DC converter is used to provide the DC voltages. Based on the DC
characteristics and logic levels of the microcontroller, the FPGA, the touch screen and the shift
registers; two main voltage levels were identified: 3.3 V and 5.0 V; namely, 3.3V for the
microcontroller, the FPGA, the control circuitry of the touch screen, the Flash I.C. as well as the
S.D card, and 5.0 V for the shift registers, the Pull Up rail for the pushbuttons and the backlight on
the touch screen.
The ZPSA20-5 power supply [6] is used to serve the 5.0 V rails, while a MPDTY027S [7] is
used to step down to the 3.3 V level. The ZPSA20-5 power supply has a reasonable power rating of
20 W, which makes sure that a number of devices can be powered without fear of
overloading/heating the power supply. Another assurance that power needs will be met is that all
our devices use an extremely low amount of current less than 200 mA.
Although the power supply has on board regulation, 3.3 V and 5.0 V voltage regulators, the
MCP1700T-3302E/TT [8]and ADP3303ARZ-5 [8] respectively, are used in conjunction with the
step down power supplies to ensure a constant voltage supply to all devices. This is because a drop
below 1.8 V on storage devices such as the flash or the microcontroller memory can lead to data
loss (see [1]).
Finally, inrush current limiters [10] that limit input current to 200mA are used to prevent
damage to the device, since the absolute maximum current for most of the devices is 200mA.
-2-
ECE 477
Digital Systems Senior Design Project
8/09
2) Microcontroller:
The microcontroller [1] will be communicating with the FPGA [2], the touch screen, as well
as the SD card chip using 3.3 V logic. The shift register array uses 5.0 V logic, however, and thus
will need to have the corresponding SPI port configured for 5.0 V operation.
(a) FPGA –Microcontroller Interface
The microcontroller needs to basically communicate with FPGA on two fronts. The first is
via 3 simple General Purpose I/O (GPIO) pins, two of which convey a 2 bit language code to the
FPGA, and one of which acts as a multiplexer line that allows either the microntroller/FPGA
exclusive control over the flash chip. The second is SPI which is used for data transfer between the
flash and the microcontroller. Since the Atmel Flash Chip [11] allows a constant write mode where
the chip select simply needs to be kept low to keep receiving serial data, the Chip Select of the SPI
needs to be configured to stay low for duration of the data transaction. The flash chip has a selftimed program cycle of 30μS which corresponds to a clock frequency of about 33.33kHz for the
SPI CLK.
The 3 GPIO pins going to the FPGA are simply combinational outputs, which are basically
set at startup/during language change. On startup, the microcontroller can effectively set the
multiplexer line to let the micro take control over the flash chip and check if the languages stored
on flash match the language codes on the SD card. If the language codes match, reprogramming the
flash with already stored languages is redundant, and hence the microcontroller can hand over flash
control back to the FPGA. If new languages do need to be loaded, the microcontroller can retake
control of the flash chip and burn it with the new language information from the SD card via SPI.
During language change (when the user selects a new language from the touch screen menu)
the 2 bit language lines convey the language code to the FPGA, thus giving it the necessary
information to change the layout displayed.
When the FPGA is independently controlling the flash however, it will operate at a
frequency of 25.175 MHz, since this is the standard VGA signal clock frequency. The VGA signal
is output as a 5 wire signal to the LCD monitor.
-3-
ECE 477
Digital Systems Senior Design Project
8/09
(b) Touch screen–Microcontroller Interface
The touch screen also uses 4 wire SPI to communicate with the microcontroller. The 4 wire
SPI mainly conveys user input on the touch screen. In addition 8 data lines send display pattern bits
to the TFT display underlying the touch screen. All logic on the touch screen is 3.3 V; the only 5.0
V usage being by the backlight. The typical operating frequency suggested for the touch screen is
335kHz; since there is no adequate reason to use a different frequency, considering that the touch
screen will simply be a static menu, that need not change extremely fast, the default frequency will
be used.
(c) SD Card –Microcontroller Interface
The SD card will basically store all the language information needed by the HULK. This
includes bitmap files to display on the LCD monitor, Unicode decoding scheme to send
hexadecimal character code to PC, as well as the language code, which would serve as unique
identifier for the language’s address in memory. The file system currently intended is FAT32.
Assuming a standard display resolution of 96 dpi for our LCD monitor, and the size of the
keyboard layout to be displayed as 12x5 inches, the bitmap file for the keyboard layout corresponds
to pixel dimensions of 1152x480. Using a monochrome color scheme or 1 bit/pixel, this
corresponds to a file size of about ~70kB (this was tested by saving a standard keyboard as a
monochrome file of dimensions 1152x480 pixels).
All communication between the microcontroller and the SD Card will take place through the
SPI interface, with the Data Out of the Microcontroller’s SPI port going in to the MOSI pin of the
SD card, Data In coming from the MISO, the CLOCK being fed from the SPI clock and the CS
being controlled by the SPI’s Slave Select. Since the data required on the SD card for language
information is assumed to be already present on it, there will be no write operations to the SD card.
-4-
ECE 477
Digital Systems Senior Design Project
8/09
(d) Keyboard
The keyboard as described above contains a total of 61 switches for the 61 keys on our
layout. The switches are laid out in 5 rows on a PCB surmounting the LCD monitor, with their
signal wires being read as parallel inputs into an array of 8 8-bit parallel-serial shift registers. The
switches are pulled up to 5.0 VCC using an array of 8 resistor packs [12] and provide contact
closures to ground.
By daisy chaining these together, an effective parallel to serial shift register of 64 bits is
obtained. The shift register array sends the keyboard state as 8 byte serial data to the
microcontroller through a 3 wire SPI interface. As mentioned earlier, the SPI port needs to be
configured for 5.0 V operation to account for the logic level of the shift registers.
Also, since the keys are ultimately mechanical switches and hence prone to bouncing, the
keyboard state needs to be read at a much slower frequency than the SPI typically operates at.
Assuming that a key bounces for about 8 ms, after which it resumes a constant state (high/low), the
keyboard needs to be read every 8ms or about 125 Hz.
Finally, the shift registers need to be selected using the chip select line of the SPI, which
must stay low for the entire data transaction. Therefore considering a 125Hz clock rate to shift out
64 bits of data, the chip select line must be low for a total of 64 clock cycles of the SPI clock or
0.512 seconds. If this cannot be changed as a register setting in the microcontroller, a GPIO pins
can be used instead to serve this purpose.
-5-
ECE 477
Digital Systems Senior Design Project
8/09
3.0 Hardware Design Narrative
The HULK does not require a very powerful microcontroller, as there are only a few
subsystems, all of which use either the SPI interface or GPIO pins. Other modules such as a PWM,
Timer, or ATD module are not required.
The subsystem that will be used the most is the SPI interface. For the current design, the
HULK requires four SPI ports for the following peripherals: SD card interface, the reading of the
keyboard, the flash ROM chip, and the touch screen interface. Because all of these devices perform
their operations serially and synchronously, SPI was a natural choice to interface all of the devices
with the microcontroller. The detailed theory of operation for each SPI device is described in
section 2.0 of this document.
The other major utilization of the microcontroller comes mainly in the form of general
purpose input/output pins. One of the interfaces for which a custom made data/clock signal is
necessary is the PS2 interface; which will be used to allow the HULK to communicate with the host
PC. This will require two pins including a data line and a clock. The touch screen interface also
requires eight designated pins for the graphics controller on the touch screen board. This is the
parallel graphics data for the bitmaps that will be displayed on the LCD screen.
Also, the FPGA and the microcontroller share a handshaking protocol for control of the
flash slave, that is selected by the microcontroller incase new languages need to be loaded from the
SD card, or by the FPGA when it needs to access the bitmaps to display on the monitor. This
handshaking is achieved by a single multiplexer select line that routes/disconnects the SPI of the
microcontroller to/from the flash chip.
Two additional GPIO pins are used to convey a 2 bit language code to the FPGA. The
language code basically serves as an identifier to the FPGA that tells it the location of the language
information in the flash memory map. The FPGA can be configured to read the GPIO pins every 1
second or so, since it is highly unlikely that a user will switch between the languages on the touch
screen at a rate faster than once every second.
-6-
ECE 477
Digital Systems Senior Design Project
8/09
4.0 Summary
The HULK (Huge Universal Language Keyboard) is designed to be a multi-language
keyboard that enables the user to type using customizable layouts, which may be changed in real
time through an interactive touch screen menu on the keyboard itself. To achieve its purpose, the
HULK uses an LCD monitor to display the dynamic keyboard layouts, surmounted by a layer of
transparent keys that reveal the displayed keys below. In addition, a touch screen menu is provided
that enables the user to change the language from the currently selected language to one of 4
languages supported by the keyboard. These languages may be loaded into the HULK at boot-up
from an SD card, a slot for which is also provided on the keyboard itself.
Internally, the HULK uses a PIC32MX360F512L to manage the various sub-systems that
include an FPGA to drive the VGA signal required by the monitor, an SD card interface, a touch
screen TFT display, as well as a daisy chain of shift registers to read the keyboard state. The
microcontroller uses 4 wire SPI to talk to the flash via the FPGA, 4 wire SPI to talk to the touch
screen, 3 wire SPI to read the keyboard state from the shift register array, and 4 wire SPI to read
from the SD card. In addition, the microcontroller uses 8 GPIO pins to send display patterns to the
touch screen LCD, 2 GPIO pins for instructing the FPGA on what language to display, 1 GPIO pin
to mux the SPI path from the microcontroller to the flash, and 2 GPIO pins configured as data and
clock to transmit data to the host PC via SPI.
The LCD monitor uses AC power from a direct AC line, while the power and ground rails
for the DC components is provided through a step down AC-DC power supply for the 5.0 V
components, which is further stepped down to 3.3 V for the remaining 3.3 V logic components.
-7-
ECE 477
Digital Systems Senior Design Project
8/09
List of References
[1]
[2]
[3]
[4]
[5]
[6]
[7]
[8]
[9]
[10]
[11]
[12]
Microchip PIC32MX695F512L Data Sheet USB, CAN and Ethernet 32-bit Flash
Microcontrollers: https://engineering.purdue.edu/477grp9/Datasheets/micro.pdf
Altera Cyclone II Device Family Datasheet:
https://engineering.purdue.edu/477grp9/Datasheets/fpga.pdf
Panasonic 6mm square SMD Light Touch Switches EVQ-Q2B02W
http://industrial.panasonic.com/www-data/pdf/ATK0000/ATK0000CE28.pdf
Asynchronous parallel in or synchronous serial in/serial out 8 - stage static shift register
HCF4021B: http://www.st.com/stonline/books/pdf/docs/8216.pdf
2.8” TFT LCD with Touchscreen: ELT240320ATP
https://engineering.purdue.edu/477grp9/Datasheets/touchscreen.pdf
TDK-Lambda 2 x 3.5" 20W AC-DC Power Supplies ZPSA20-5 series.
http://us.tdk-lambda.com/lp/ftp/Specs/zpsa.pdf
Murata Electronics 5.0 V – 3.3 V power supply MPDTY027S
http://www.murata.com/power/short/f07e1.pdf
Microchip Low Quiescent Current LDO MCP1700T-3302E/TT
http://ww1.microchip.com/downloads/en/DeviceDoc/21826b.pdf
Analog Devices Inc IC REG LDO 200MA 5V 8-SOIC. ADP3303ARZ-5
http://www.analog.com/static/imported-files/Data_Sheets/ADP3303.pdf
Cantherm Inrush Current Suppresor
http://www.cantherm.com/products/thermistors/cantherm_mf72.pdf
Atmel High Speed Small Sectored SPI Flash Memory
https://engineering.purdue.edu/477grp9/Datasheets/flashic.pdf
746X101103JP RESISTOR ARRAY 10K OHM BUSSED SMD
http://www.ctscorp.com/components/Datasheets/CTSChipArrayDs.pdf
-8-
ECE 477
Digital Systems Senior Design Project
8/09
Appendix A: System Block Diagram
Host PC
61 Keyboard
Keys
8 8-Bit Shift
Registers
61
SPI
SD Card
Reader
SPI
3
4
2
PS/2
SPI
3
VGA Monitor
4
FPGA
Micro
Touchscreen
5
SPI
4
8
SPI
4
Flash IC
-9-
Download