Documenti di Didattica
Documenti di Professioni
Documenti di Cultura
www.freescale.com/universityprograms
Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners Freescale Semiconductor, Inc. 2006. Document Number: LABS12CINTRO33S /REV 0
This short course has been created using an adapted version of the Process Oriented Guided Learning (POGIL) method. For more information visit www.pogil.org
Freescale Semiconductor
Overview
Most embedded systems must operate continuously without any user input, even if something goes wrong. Most of us have experienced having our desktop or laptop computer locking up and requiring a reboot of the system to get it working again. We simply cannot afford to do this in an embedded system. Ideally, we would write our software so that it never crashes or fails. This, as you can guess, is really hard to do and so our microcontroller manufacturer has included a hardware feature called the Computer Operating Properly, or COP, reset generator. If this hardware feature does not receive a confirmation signal that our program is running properly, it will generate a reset to restart our program from the beginning or from a restart place that we can choose. The COP is also called a watchdog timer.
Learning Objectives
In this module we will help you learn about the COP, or watchdog timer.
Success Criteria
When you complete this module you will be able to demonstrate a program illustrating how the COP can reset the program if it times out and that it does not generate a restart if the COP timer is reset properly in the program.
Explore 1. 1. 2. Download and read Great Watchdogs from http://www.ganssle.com/watchdogs.htm. Make a list of all the things that could go wrong in your program that having a COP reset would assist in making a recovery.
Explore 2. 1. 2. In some processors the COP is enabled at reset and in others it is disabled. Which is the case for your microcontroller? The COPCTL COP Control Register has five control bits. a. Give the name and function of each bit. Bit 7: Bit 6: Bit 2:1:0: b. c. What is its address? What bits would you initialize to what value to have the COP time-out time be approximately 65 ms with your microcontroller?
Freescale Semiconductor
d. 3. 4.
Once the COP time rate select bits have been written, they cannot be changed in your program. Why is this a good thing?
The ARMCOP Arm COP Register is used to reset the COP timer. What is the sequence of actions that must occur within the time out period to successfully reset the timer? What is meant by a "windowed" COP operation and what does it help guard against?
Problem 1 1. You are to verify that your microcontroller asserts the RESET_L signal each time the COP times out. Come up with a plan to do this and demonstrate it to your laboratory instructor.
Problem 2 1. Design and write a program that demonstrates you can use the COP to generate a reset if the program stops working for some reason. Demonstrate the following: a. b. Your program working correctly without the COP timing out when you are resetting it properly. Your program is reset by the COP if you do not reset it in a timely manner.
Your program must have some visual or audible indication showing the two operational modes and you should test for a variety of failures such as hanging up in a loop, memory contents being destroyed, etc.
Communication Inter-Group
1. 2. 3. Compare your solution to Problem 2 with the other laboratory group. Exchange source listings of your solutions. Are there any differences in the approaches the two groups have used to illustrate the operation of the COP? Is one approach better than the other?
Communication Reporting
1. 2. Demonstrate to your laboratory instructor your program that illustrates the operation of the COP. Prepare a memo report for the laboratory instructor. Include comments gained during your Inter-Group Communication where you looked at another group's solution. Include listings of your and the other group's programs. How does each solution compare in terms of rigorously testing for various faults from which the COP should allow you to recover. What did you learn from seeing the other group's solution?
Freescale Semiconductor
Revision History
Revision 0 Comments Initial Release Author Fred Cady
Freescale Semiconductor
e-mail:
support@freescale.com
Japan:
Freescale Semiconductor Japan Ltd. Headquarters ARCO Tower 15F 1-8-1, Shimo-Meguro, Meguro-ku, Tokyo 153-0064, Japan 0120 191014 +81 3 5437 9125 support.japan@freescale.com
Asia/Pacific:
Freescale Semiconductor Hong Kong Ltd Technical Information Center 2 Dai King Street Tai Po Industrial Estate, Tai Po, N.T., Hong Kong +800 2666 8080 support.asia@freescale.com
Freescale and the Freescale logo are trademarks of Freescale Semiconductor, Inc. All other product or service names are the property of their respective owners. ARM is the registered trademark of ARM Limited. ARM9, ARM11, and ARML210 are the trademarks of ARM Limited. Java and all other Java-based marks are trademarks or registered trademarks of Sun Microsystems, Inc. in the U.S. and other countries. The PowerPC name is a trademark of IBM Corp. and used under license. Freescale Semiconductor, Inc. 2006. Document Number: LABS12CINTRO33S /REV 0