COMPUTER ORGANIZATION (ELE408) LAB 3

 

Interrupt Processing of the ColdFire MCF5208

 

1.    Pre-lab Report

·       Read Chapters 14, Sections 3.4, 3.5, and 3.6, and Chapter 21 of the MCF5208 Reference Manual.

·       Read this lab handout carefully. Take notes and prepare the programs required in this handout.

·       Review the class notes regarding exception processing and interrupt operations.

 

2.    Objectives of this Lab

 

The purpose of this lab is to learn and gain first hand experiences on interrupt processing of the ColdFire professor. You will apply your knowledge and basic concepts of exception processing and interrupt handling that you have learnt in the lectures to the lab experiments.

Specifically, you will learn and exercise the basics of

2.1.  Exception priorities, vector tables, and handler routines;

2.2.  How to configure and program the interrupt controller to process various interrupt events and functions;

2.3.  How to generate periodic events triggering interrupts

2.4.  How to use interrupt to save power consumptions.

 

3.    Basics

 

As discussed in the classes, interrupt is one of the most important mechanisms used in a computer system to handle various unexpected events such as bus errors, divide by zero, access errors, and so forth. It is also the most important interfacing technique to allow smooth communication between high speed devices such as CPU and RAM and low speed devices such as disks, displays, serial ports, printers etc. To design a microprocessor based system for any application, interrupt is one of the key mechanisms an engineer should master.

The MCF5208 processor has a hardware interrupt controller. In this lab, you will configure and program the controller to implement at least two interrupt handlers

4.     Experiment Requirements and Procedures

In this lab, you are required to implement at least two interrupt handlers to handle exceptional events of your choice. The handlers should be written in assembly code to set up priorities, vectors, masks, and necessary functions in an interrupt subroutine.

Main Functions To Be Implemented: Implement two interrupt handlers to process two exceptional events of your choice. One possible example is a real time clock using PIT0 and PIT1 both have interrupt source numbers: 4 and 5. You can use one timer to generate interrupt request periodically to display current time in digital clock format. The other timer could be used to generate high priority interrupt request to give an “alarm” in the same way as how an alarm clock works. Or you could do a calendar with schedules. While the timer is running, you can set the system at low power mode by disabling unused peripheral devices and setting CPU in low power mode. You can then use high priority interrupt to change from low power mode to normal operations.

Preparation:

Ø     Design an assembly program to configure the interrupt controller:

o      Setting up the appropriate registers in the interrupt controller to implement priority and vector numbers for your exceptional events

Ø     Design an assembly program to configure the peripheral device to enable interrupt request, such as PIT. For an example code, click here.

Ø     Write handler programs to process the events. For example, if you decide to design a real time clock, you would need to calculate the period for generating interrupts, displaying digital clock on the screen,  producing an alarm, or generating a schedule reminder

Ø     Write a program to configure the power management module

In the Lab:

Ø     Configure the interrupt controller using your assembly code

Ø     Initialize your system

Ø     Set CPU in an infinite loop or wait mode ready for interrupt requests

Ø     Generate necessary events to trigger interrupt requests

Ø     Perform necessary handling subroutines

Ø     Measure power consumption of different power mode and record values

5.    Lab Report Requirements

In your lab report, you should discuss your designs, trade-offs. Explanation and interpretation of your results are very important. The lab report will be graded based on your report and discussions. Total mark for the report is 100 points.

Ø       Prelab report: 20 points

Ø       Successful experiment: 50 points

Ø       Results analysis, interpretation, and discussions on your design and engineering constraints: 30 points

In the following items, numbers inside each bracket “[]” indicates the point you will earn on a satisfactory report and discussions.

 

In your discussion and explanations of your results, you should consider the following:

A.    What knowledge of mathematics, science and engineering have you applied in this lab? [5]

B.    How did you design the lab (including architecture, flowchart, programs, etc.)? How did you conduct the experiment? What is your interpretation and conclusion on the experiments? [5]

C.    Who is your team partner? How did you collaborate with each other and what roles did each of the team members play in the lab?  [5]

D.    What specific modern engineering tools have you used in your experiments. What specific techniques and skills have you learnt from the lab? [5]

 

 Did your design consider the following constraints? If yes, how did you make your design decisions?

 

Ø     Economic Constraint (performance/cost ratios) [3]

Ø     Manufacturability, Modularity and Expandability Constraints [3]

Ø     Environmental Constraint (power consumption) [2]

Ø     Sustainability: Is your design and implementation sustainable? [2]

 

Hand in the debugged source code with comments; the machine code is not necessary. Note that both hardcopy and a file with programs are required for the report. Be very specific with your comments that explain what you are doing and why you are doing it.