ECE 477 Digital Systems Senior Design Project Rev 8/09

Homework 9: Software Design Considerations

Team Code Name: __Digi-Brush______Group No. _2_

Team Member Completing This Homework: ___Caleb Ayew-ew______

E-mail Address of Team Member: cayewew__@ purdue.edu

Evaluation:

SCORE

/

DESCRIPTION

10 /

Excellent – among the best papers submitted for this assignment. Very few corrections needed for version submitted in Final Report.

9 /

Very good – all requirements aptly met. Minor additions/corrections needed for version submitted in Final Report.

8 /

Good – all requirements considered and addressed. Several noteworthy additions/corrections needed for version submitted in Final Report.

7 /

Average – all requirements basically met, but some revisions in content should be made for the version submitted in the Final Report.

6 /

Marginal – all requirements met at a nominal level. Significant revisions in 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.

Comments:

Overall, this report needs to be expanded greatly. It is missing a lot of important details. See the inline comments below for what needs to be added. Also, you should strongly consider C instead of assembly. Assembly will make you lives much harder.

ECE 477 Digital Systems Senior Design Project Rev 8/09

1.0  Introduction

The Digi-Brush is a children's painting set that simulates painting with water colors on a 15” LCD touchscreen. The device is made up of three major components: the touchscreen display, color selectors, and the brush. The touchscreen will receive it's input from the brush. When the screen is touched the current color will be displayed in that location on the screen. When dragged it will simulate a brush-stroke. The color will change when the brush presses into a color selector pot. The color selected will mix with the color already on the brush and the LED in the brush will display that change.

2.0  Software Design Considerations

Since the device consists of two different programmable devices there will be two separate programming styles. The two major considerations for the micro-controller will be the inputs and the communication with the FPGA. The inputs for the micro-controller will consist of all eight color selectors, the clear brush selector, the touch-panel, the force resistor, and the save and clear buttons. All inputs are essentially analog. Two GPIO pins are also used as switch inputs, that the user presses. The inputs will be polled in a sequential continuous loop to ensure validity of an action.

The three considerations for the FPGA are the generation of the VGA signal, the double buffering with the external RAM, and the SPI communication with the SD card and micro-controller. The FPGA is to be loaded with an open core with slight modifications to handle the packets from the micro-controller. This open core will generate the VGA signals by double buffering.
Program space on the micro-controller will begin at 4000h, which is the beginning of Flash array addresses [1] in the Flash EEPROM. This space extends down to FFFFh leaving plenty of space for instructions and interrupt vectors if necessary. ATD ports PAD00-PAD08 are used by 8 of the color pots. ATD port PAD09-PAD11 are the water pot, touch screen, and force resistor respectively. IIC is utilized by the LED driver on ports PJ6-7. SPI is implemented on ports PS4-7 for communicating with the FPGA. Most pins have been routed to headers on the PCB for easy debugging, these pins include the BDM port for in-system programming.

Program space on the FPGA is a little more complicated. Since the Cyclone II's memory is non-volatile the configuration device will be the one programming the FPGA on start-up. This device will configure the FPGA in the most efficient manner [2]. Almost all of the FPGA pins can be configured to be either input or output [3]. The FPGA will have two SPI ports. One SPI for the SD card and one for micro-controller packets. The other pins will be used to communicate with a 512 Mb external RAM and the VDAC. The VDAC will supply the VGA signal to the monitor.

3.0  Software Design Narrative

The micro-controller will process all inputs and will be written in assembly while the FPGA will handle double buffering the VGA signal and saving the image to an SD card with a modified open core VGA driver. The micro-controller, after initialization of both it and the FPGA, will begin polling the analog inputs starting with the touch-panel. Thereafter, it updates the display, continues on to the color pots, followed by the save and clear buttons and finally repeats.

To have a touch recognized there needs to be force on the force resistor to ensure the brush is being held. As with the touch-panel there must also be force when changing colors. If a color change is detected it will call the mix color function and then call the update brush LED function. Since force is required to initiate a change the force channel is monitored during the color and display applications.
All analog inputs are discretely polled in the order mentioned above. The touch-panel's analog input is first averaged over five samples, then the standard deviation is found. The first STD is used to see if there was a touch on the X coordinate. If the STD for X is above 10 then it is not a touch. If it is below 10 then it repeats the average and STD for the Y coordinate and the STD is again compared to 10. The STD is necessary to eliminate the random values on the touch-panel lines from registering a false positive. After a successful touch, however, the update display function will be called. This function will form a packet consisting of the coordinates just received along with the current color on the brush and will be sent to the FPGA via SPI. The SCL will operate at 50Mhz which is a reasonable speed to communicate with the FPGA[3].

When a successful color change is detected the color selected will be passed to the update LED driver function. This will mix the colors by averaging the two and then sending a byte-sized packet[4] via IIC to the LED driver. This is done to inform the user what color they are painting with.

Finally when there is a save or clear request, a packet is formed to inform the FPGA as such. The save request will form an almost null packet that contains a single save bit. Once the save bit is received the FPGA will save the image on screen into the SD card. If no SD card is present it will do nothing. While the clear request will work in the same manner as the update display routine but will overwrite all pixels with white. This simulates a fresh sheet of paper to begin painting anew.
The micro-controller code is working for determining a change on any ATD channels on the development board. The touch-panel is thought to be working as well but cannot be 100% certain without using the FPGA. The packet forming is left up for discussion since the packet will be defined by the team. The FPGA is where the most work still needs to be done. Even with the open core the modifications may cause issues. This is still very pseudo-code, however, we can display an image on a VGA monitor with the development board.

4.0  Summary

Software design for the Digi-Brush ultimately relies on the communication between the two major ICs, those being the Freescale micro-controller and the Altera FPGA. The information received in the micro-controller should be given to the FPGA in a timely manner to give the illusion of apparent motion. The micro-controller will operate in a continuous polling loop to ensure changes are responded to. If time allows other features not covered in the scope of this document may be implemented to increase user functionality and experience.

List of References

[1]  Freescale FTS512K4
Block User Guide
V01.06
, [Online Document], 2001 Feb, [cited 2010 Mar],
Available HTTP:
http://www.freescale.com/files/microcontrollers/doc/ref_manual/S12FTS512K4V1.pdf

[2]  Altera Configuration Handbook, Vol. 1, Sect. 1, Chp. 13: Configuring Cyclone II Devices, [Online Document], 2007 Feb, [cited 2010 Mar],
Available HTTP: www.altera.com/literature/hb/cfg/cyc_c51014.pdf

[3]  Altera Cyclone II Device Handbook, Vol. 1, [Online Document], 2007 Feb, [cited 2010 Mar], Available HTTP: http://www.altera.com/literature/hb/cyc2/cyc2_cii5v1.pdf

[4]  Texas Instruments 16-Channel Fm+ I2C-bus Constant-Current LED Sink Driver, [Online Document], 2008 Feb, [cited 2010 Mar], Available HTTP: http://www.ti.com/lit/gpn/tlc59116

Appendix A: Flowchart/Pseudo-code for Main Program

Appendix B: Hierarchical Block Diagram of Code Organization

-2-