Freescale Semiconductor Application Note AN2317/D Rev. 1, 10/2002 Freescale Semiconductor, Inc... Low-Cost Programming and Debugging Options for M68HC08 MCUs By: John Suchyta Applications Engineering 8/16-Bit Products Division Introduction This application note describes several low-cost ways to get a target M68HC908 microcontroller (MCU) into monitor mode for the purposes of programming FLASH memory, reprogramming, and debugging.
Freescale Semiconductor, Inc. AN2317/D What is Monitor Mode? Freescale Semiconductor, Inc... Monitor mode was developed as a feature of the M68HC08 MCU architecture to provide basic in-circuit debugging, as well as programming of nonvolatile memories. Monitor mode is not a substitute for full chip emulation, but it allows a low-cost connection to a host computer, which sends commands serially to the MCU. These commands perform read and write operations on the MCU’s registers and memory.
Freescale Semiconductor, Inc. AN2317/D Monitor Mode Signals Freescale Semiconductor, Inc... Monitor Mode Signals The physical monitor mode interface uses up to nine connections to configure the MCU and establish serial communications. As few as two or three connections are used to program the MCU’s FLASH memory when the FLASH is blank and the special “Forced Monitor Mode” is invoked. (Refer to the Monitor ROM section of the appropriate M68HC908 data sheet.
Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... AN2317/D MOD1, MOD0 The mode select pins must be at their prescribed levels if the VTST voltage is applied to the IRQ pin. These pins select monitor mode. They are also used by Motorola production test facilities and emulator manufacturers to gain access to special test and emulation features.
Freescale Semiconductor, Inc. AN2317/D MON08 Pods MON08 Pods The hardware that connects a PC and the target board ranges from full-featured development tools to simple communications circuits that anyone can build. Freescale Semiconductor, Inc... The ICS MON08 Connector Motorola builds In-Circuit Simulators (ICS) for many popular M68HC08 derivatives.
Freescale Semiconductor, Inc. AN2317/D The MON08 connector pinout for one MCU may not match the pinout for another due to the different biasing requirements among the M68HC08 MCU families. M68HC08 versions with smaller pin counts will generally have one or two fewer pins in the MON08 connection. Table 1 shows the MON08 pin number and target signal name for several popular M68HC08 MCUs. Freescale Semiconductor, Inc... Table 1.
Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... AN2317/D MON08 Pods Figure 2. Cyclone Programmer (Class V) Window Showing MON08 Pinout MON08-Multilink The MON08-Multilink is a low-cost version of the Cyclone. The Multilink connects to a PC’s parallel port and offers the same programming and debug capabilities as the Cyclone. However, the Multilink does not offer the stand-alone portability found on the Cyclone.
Freescale Semiconductor, Inc. AN2317/D Freescale Semiconductor, Inc... Custom MON08 Interfaces As mentioned above, monitor mode entry conditions can be introduced to a circuit board in many ways. The method of mode entry and communications can be as simple as including a “standard” MON08 interface (16-pin ribbon cable to a 2 x 8 dual row header) to program or debug.
Freescale Semiconductor, Inc. AN2317/D MON08 Pods MC68HC908 VDD VDD 10 k RST VDD VDDA VDDAD MAX232 1 C1 + Freescale Semiconductor, Inc... 4 C1– C2+ OSC1 C5 GND 15 C3 5 MOD0 VTST V+ 2 7 8 IRQ VDD V– 6 + 3 10 k + C4 MOD1 9.1 V 10 k 10 k 10 k 74HC125 5 6 10 9 1k SSEL DB9 2 10 k DIV4 9.8304 MHz + 5 C2– 0.1 µF OSC2 VDD VCC 16 + 3 C2 C1+ NC VDD 74HC125 3 2 VSSAD PTA0 4 VSSA VSS 1 Figure 4.
Freescale Semiconductor, Inc. AN2317/D Simpler Monitor Mode Circuit A simpler implementation of the monitor mode circuit of Figure 4 is shown in Figure 5. The two 74HC125 buffers are replaced by a resistor and diode. When PTA0 is outputting a 1, the input at the MAX232 pin 10 is held high. When PTA0 is outputting a 0, the input at pin 10 is driven low. The RS232 level at pin 8 is idling low which drives pin 9 to a logic one. This high level is blocked by the diode so there is no bus conflict.
Freescale Semiconductor, Inc. AN2317/D MON08 Pods Freescale Semiconductor, Inc... Oscillator Circuits Figure 6 shows two ways to supply the external oscillator for normal monitor mode operation. Figure 6a shows a canned oscillator while Figure 6b shows a discrete inverter-based oscillator. The canned oscillator is perhaps the best way to provide the external clock signal.
Freescale Semiconductor, Inc. AN2317/D VTST Generation The MAX232 shown in Figure 4 and Figure 5 can be used to supply the high voltage (VTST) for monitor mode entry. The V+ output of the MAX232 supplies about 9 V for the RS232 communications interface, which is adequate for monitor mode entry. A zener diode and current limiting resistor complete the VTST supply. The IRQ pin draws about 200 µA from the VTST supply when monitor mode is selected. Freescale Semiconductor, Inc...
Freescale Semiconductor, Inc. AN2317/D MON08 Pods S1 R8 10 k Q4 2N3906 SW SPDT 9V BATTERY OR SUPPLY R7 22 k R9 Q3 2N3904 VTST (IRQ) 1k r6 10 k VDD R1 10 k R2 Q1 2N3906 Freescale Semiconductor, Inc... PTA0 4.7 k U1 1 2 3 4 5 6 7 GND (VSS) NC NC NC VSS NC NC VSS 14 13 12 11 10 9 8 VCC NC NC OUT NC NC OUT 9.8304 MHz OSC OSC1 R3 3.9 k D1 1N4148 Q2 2N3904 r5 4.7 k + C1 1 µF R4 4.7 k P1 1 6 2 7 3 8 4 9 5 DB9 R12 SSEL 1k R13 R10 1k 1k R11 MOD1 MOD0 DIV4 1k Figure 7.
Freescale Semiconductor, Inc. AN2317/D Freescale Semiconductor, Inc... User Monitor Mode Implementation C7 VDD The evaluation board shown in Figure 8 was built for the introduction of the 8-pin MC68HC908QT4 MCU. This board has a preprogrammed M68HC908QT4 on it that jumps to the monitor mode firmware when the PTA2 pin is held low during power-up. This MCU has so few pins that a full MON08 interface takes just about every pin on the chip.
Freescale Semiconductor, Inc. AN2317/D MON08 Connections on a Target Board MON08 Connections on a Target Board With proper planning, an application can have the appropriate mode and control pins preconfigured to reduce the number of pins required to enter monitor mode.
Freescale Semiconductor, Inc. AN2317/D Here are some suggestions on how to configure I/O pins for monitor mode entry: High level needed: • Use as inputs, active low. Need weak pullup resistors (~10 kΩ). • Use as outputs, active low. External circuitry could be LEDs with pullup resistors. Freescale Semiconductor, Inc... Low level needed: • Use as inputs, active high. Need weak pulldown resistors (~10 kΩ). • Use as outputs, active high.
Freescale Semiconductor, Inc. AN2317/D MON08 Connections on a Target Board OSC/OSC1 The OSC signal is always applied to the OSC1 pin on every M68HC08 for monitor mode entry. This pin may have a crystal or RC attached to it in normal operation. The external oscillator can easily overdrive the crystal or RC to provide the 9.8 MHz monitor mode frequency.
Freescale Semiconductor, Inc. AN2317/D Freescale Semiconductor, Inc... Low-Cost MON08 Software Free or low-cost software options for programming and debugging M68HC908 MCUs are available from P&E Microcomputer Systems (www.pemicro.com), Metrowerks (www.metrowerks.com), and ImageCraft (www.imagecraft.com/software/). P&E’s ICS08 interface software packages are available at no charge for individual use by registering at their web site.
Freescale Semiconductor, Inc. AN2317/D Low-Cost MON08 Software Programming the FLASH on an M68HC908 is relatively easy with the PROG08SZ component. Simply open the WinIDE, then develop and assemble your code. When your MON08 interface is attached between the PC and target board, select the programmer icon (lightning bolt). The PROG08SZ programmer launches and configures the PC’s COM port.
Freescale Semiconductor, Inc. AN2317/D Here are the main steps in programming the FLASH with PROG08SZ in normal monitor mode: 1. Launch P&E’s WinIDE from the ICS08 software. 2. Open desired file or develop new code. 3. Assemble the file. 4. Attach MON08 pod between PC and target. 5. Click on programmer icon. 6. From Target Hardware Type, select Class III (see Figure 10). 7. Select the PC port and the appropriate baud rate (see Figure 11). Freescale Semiconductor, Inc... 8.
Freescale Semiconductor, Inc. Freescale Semiconductor, Inc... AN2317/D Low-Cost MON08 Software Figure 12. P&E’s PROG08SZ Programmer Window Low-Cost Programming and Debugging Options for M68HC08 MCUs For More Information On This Product, Go to: www.freescale.
Freescale Semiconductor, Inc. AN2317/D Freescale Semiconductor, Inc... ICD08SZ Getting into the ICD08SZ debugger is even simpler. With a MON08 interface between PC and target, select the In-Circuit Debugger icon from the WinIDE menu bar. Follow the instructions in the Power Cycle dialog box if using the Class III hardware type. The debugger establishes communications with the target and interrogates the memory spaces on the MCU.
Freescale Semiconductor, Inc. AN2317/D Low-Cost MON08 Software Freescale Semiconductor, Inc... a great bargain for serious programmers.
Freescale Semiconductor, Inc. AN2317/D 2. Click the + sign to expand the Sources folder. 3. Modify the source file if necessary. Freescale Semiconductor, Inc... 4. Click the Debug icon (green arrow). The True-Time Simulator and Real-Time Debugger launches. Figure 15. Figure 15. True-Time Simulator & Real-Time Debugger Window 24 Low-Cost Programming and Debugging Options for M68HC08 MCUs For More Information On This Product, Go to: www.freescale.
Freescale Semiconductor, Inc. AN2317/D Low-Cost MON08 Software 5. Select the PEDebug pulldown menu and navigate to the appropriate device as shown in Figure 16. Freescale Semiconductor, Inc... 6. Likewise, in the PEDebug pulldown menu, select Mode: In-Circuit Debug/Programming. Figure 16. PEDebug Pulldown Menu Low-Cost Programming and Debugging Options for M68HC08 MCUs For More Information On This Product, Go to: www.freescale.
Freescale Semiconductor, Inc. AN2317/D The PROG08SZ Attempting to contact target and pass security… window appears. (Refer to Figure 11) 7. Select the appropriate class in Target Hardware Type (Class III for low-cost MON08 circuit from Figure 7) and baud rate. 8. Click Contact target with these settings… 9. Follow the Power Cycle dialog instructions. 10. Click Yes in Confirm window. (Figure 17) 11. Click Yes in Erase and Program FLASH window. (Figure 18) Freescale Semiconductor, Inc... 12.
Freescale Semiconductor, Inc. AN2317/D Conclusion Freescale Semiconductor, Inc... Conclusion Several aspects must be considered when implementing in-circuit FLASH programming and debugging in M68HC908 applications. The hardware to connect a personal computer to the target board (Cyclone, ICS, Multilink, custom pod), the physical connections to the target board, and the software to develop an application and program the MCU each have wide ranges of cost and complexity associated with them.
Freescale Semiconductor, Inc. How to Reach Us: Home Page: www.freescale.com E-mail: support@freescale.com Freescale Semiconductor, Inc... USA/Europe or Locations Not Listed: Freescale Semiconductor Technical Information Center, CH370 1300 N. Alma School Road Chandler, Arizona 85224 +1-800-521-6274 or +1-480-768-2130 support@freescale.