To all our customers Regarding the change of names mentioned in the document, such as Mitsubishi Electric and Mitsubishi XX, to Renesas Technology Corp. The semiconductor operations of Hitachi and Mitsubishi Electric were transferred to Renesas Technology Corporation on April 1st 2003. These operations include microcomputer, logic, analog and discrete devices, and memory chips other than DRAMs (flash memory, SRAMs etc.) Accordingly, although Mitsubishi Electric, Mitsubishi Electric Corporation, Mitsubishi Semiconductors, and other Mitsubishi brand names are mentioned in the document, these names have in fact all been changed to Renesas Technology Corp. Thank you for your understanding. Except for our corporate trademark, logo and corporate statement, no changes whatsoever have been made to the contents of the document, and these changes do not constitute any alteration to the contents of the document itself. Note : Mitsubishi Electric will continue the business operations of high frequency & optical devices and power devices. Renesas Technology Corp. Customer Support Dept. April 1, 2003 APPLICATION NOTE M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer 1. Abstract The following article describes using the ATC (Advanced Transdata) PGM1000 programmer to parallel program the flash memory of the M16C/62 series of microcontrollers. The MCU mode of parallel flash programming is referred to in the M16C/62 data sheets as “Parallel I/O Mode”. 2. Introduction The Mitsubishi M16C/62 series of microcontrollers is a 16-bit family of MCUs, based on Mitsubishi’s popular M16C CPU core. These parts provide high memory efficiency, power-saving ability, low noise emission, and improved noise immunity. The flash versions of the device contain flash memory that can be rewritten with a single voltage. The M16C/62 flash can be programmed using one of three methods: Parallel I/O Mode, Standard Serial I/O Mode, and CPU Rewrite Mode. It is the Parallel I/O Mode that is detailed in this article. The flash memory is divided into two major blocks, a user program area and a boot ROM area. The user program area is for the normal application program and data. Any program in the boot ROM area is accessed only when a special hardware reset sequence is initiated. This boot ROM area has a control program stored in it when shipped from the factory. The program allows asynchronous or synchronous serial programming of the user area of the flash. Changes to the boot area of the flash can only be made using Parallel I/O Mode. 3. Setting Up the PGM1000 Programmer Select the appropriate program adapter for the M16C device package that will be used. There are currently two adapters for the M16C/62 parts, as shown in Table 1 Table 1. Adapters for M16C Device Adapter Name Number Supported Devices APT-MCP6S M306XXXX-100P6S M30620/M30624FP (100-pin SPFQ) APT-MCP6Q M306XXXX-100P6Q M30620/M30624GP (100-pin QFP) The adapters are marked to indicate J1 and J2. AN-DECE-MCU-28-A September 2001 1 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer To install the adapter onto the PGM1000 programmer, follow these steps: 1. Connect the DC power supply. The ACTIVE LED will blink several times and then stay on when the programmer is ready. 2. Connect the programmer to the parallel port of the host computer using the DB25 cable. 3. Install the software on the host computer if it is not already installed. The PGM1000 has the following four windows that are used to display programming information: • • • • Boot ROM Memory Program Memory Device Configuration Verify Errors A view of the screen with these four windows open is shown in Figure 1. Figure 1. Screen View of Four Open Windows Use the Device Specification window to select the M16/62 (M30624). Also use this window to select Parallel I/O Mode as the Program Mode. AN-DECE-MCU-28-A September 2001 2 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer Install the device to be programmed into the socket. Ensure that pin 1 is lined up with the triangle on the programming adapter that indicates pin 1. 4. Programming the Boot ROM Area Note: The boot ROM area contains a factory programmed boot ROM code used for “Serial I/O Mode” programming of the user flash area. If the boot ROM area is re-programmed, the factory Serial I/O Mode programming modes can no longer be used. To enable access to the Boot ROM area, click the "Enable Boot ROM area" filed under Options in the Device Configuration. If this block is not checked, the Boot ROM area of the device cannot be accessed. To select the file to be loaded to the Boot ROM area, go to the File menu and select "Open File". This will open a dialog box. Clicking on the down arrow next to "Files of type" will result in a dialog box as shown in Figure 2. Figure 2. Open File Dialog Box Select either “Boot ROM - Intel 8-bit Hex files (*.hex)” or the “Boot ROM - Motorola S Hex Files (*.hex,*.mot)” for the type of file to be opened. If one of the User ROM file types is used as a file type. the program selected will be loaded into the Program ROM area buffer, not the Boot ROM area buffer. This will result in errors when programming is attempted. AN-DECE-MCU-28-A September 2001 3 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer Once the file has been selected, a complete program cycle can be selected by choosing the program button with the "Erase Device before Program", "Blank Check before Program", and "Verify Device after Program" boxes checked in the Programmer Device Configuration window. Figure 3. Device Configuration Window The Programmer will then erase the flash area, check that the area is blank, program the device with the data from the file selected, and then read the flash memory area and verify it against the information stored in the buffer. If there are errors during the verify they will be indicated in the Verify Error(s) window. 5. Programming the User Flash Area To program the user flash area, ensure that the "Enable Boot ROM area" check box in the options section of the Device Configuration window is not checked. To allow programming of all areas of user memory, the following Device Specifications should also be selected in the Device Configuration window. Program mode: Set to "Parallel I/O" Lock Type: Set to "Lock Bit Data is NOT Effective" Erase Type: Set to "All Memory" AN-DECE-MCU-28-A September 2001 4 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer Under the options section of the Device Configuration window, select the following boxes: "Erase Device before Programming" "Blank Check Device before Programming" "Verify Device after Programming" Once the setup of those options is complete, the program file needs to be selected. To select the file go to the File menu and select "Open File". A dialog box will open similar to the one shown in Figure 4. It is important to select the correct file type in the "Files of type:" section of the window. One of the three "User ROM" selections must be selected. Do not use the "Boot ROM" selections. If ID codes are to be programmed, refer to “Using ID Codes” in section 6 Figure 4. Open File Dialog Box Once the file has been selected, a complete program cycle can be selected by choosing the program button with the "Erase Device before Program", "Blank Check before Program", and "Verify Device after Program" boxes checked in the Programmer Device Configuration window. AN-DECE-MCU-28-A September 2001 5 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer Figure 5. Device Configuration Window The Programmer will then erase the flash area, check that the area is blank, program the device with the data from the file selected, and then read the flash memory area and verify it against the information stored in the buffer. If there are errors during the read and verify they will be indicated in the Verify Error(s) window. 6. Using ID Codes The M16C/62 devices have 7 bytes of flash memory mapped to be used as ID codes. These ID codes are checked as part of the initialization of the “Standard Serial I/O Mode” of programming. The ID codes provide protection against reading or modifying the flash memory. The data to be written to these locations can be written as fixed data in the program file or added to the buffer prior to programming the device. To add the ID code as part of the programming, load the original program file as outlined in section 5. After the program has been loaded to the memory buffer, select the ID Collation Function from the Device Specifications section of the Device Configuration window. Clicking on this button will open the dialog box shown in Figure 6. AN-DECE-MCU-28-A September 2001 6 M16C/62 Parallel Programming of the M16C/62 Flash Memory with the ATC PGM1000 Programmer Figure 6. ID Collation Dialog Box A 14-character hex string or 7-character ASCII string can be input into the dialog box. If a standard ID file has been created, it can be loaded using the "Load ID…" button. After the ID string is entered select the Memory Buffer option in the "Write ID To" section of the dialog box. Then clicking the Write button will place the ID string into the appropriate locations in the memory buffer. Programming the device at this point will transfer the original program with the ID bytes added. The contents of the memory buffer can be saved as a *.hex of *.obj file using the Save option under the File menu. This allows subsequent programming with the ID bytes to be accomplished by simply loading the file that was saved. 7. References • • M16C/62 datasheets:62aeds.pdf ATC (Advanced Transdata) PGM1000 Manual AN-DECE-MCU-28-A September 2001 7 Keep safety first in your circuit designs! • Mitsubishi Electric Corporation puts the maximum effort into making semiconductor products better and more reliable, but there is always a possibility of trouble occurring. Trouble with semiconductors may lead to personal injury, fire, or property damage. Remember to give due consideration to safety when making your circuit designs, with appropriate measures such as (i) placement of backup, auxiliary circuits, (ii) use of non-flammable material, or (iii) prevention against any malfunction or mishap. Notes regarding this information • This information is intended as a reference to assist our consumers in the selection of the Mitsubishi semiconductor product best suited to the customer’s application; it does not convey any license under any intellectual property rights, or any other rights, belonging to Mitsubishi Electric Corporation or a third party. • Mitsubishi Electric Corporation assumes no responsibility for any damage, or infringement of any thirdparty’s rights, originating in the use of any product data, diagrams, charts, programs, algorithms, or circuit application examples contained in these materials. • All information contained in these materials, including product data, diagrams, charts, programs and algorithms, represents information on products at the time of publication of these materials, and is subject to change by Mitsubishi Electric Corporation without notice due to product improvements or other reasons. It is therefore recommended that customers contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor for the latest product information before purchasing a product listed herein. • The information described herein may contain technical inaccuracies or typographical errors. Mitsubishi Electric Corporation assumes no responsibility for any damage, liability, or other loss arising from these inaccuracies or errors. • Please also pay attention to information published by Mitsubishi Electric Corporation by various means, including the Mitsubishi Semiconductor home page (http://www.mitsubishichips.com). • When using any or all of the information contained in these materials, including product, data, diagrams, charts, programs, and algorithms, please be sure to evaluate all information as a total system before making a final decision on the applicability of the information and products. Mitsubishi Electric Corporation assumes no responsibility for any damage, liability, or other loss resulting from the information contained herein. • Mitsubishi Electric Corporation semiconductors are not designed or manufactured for use in a device or system that is used under circumstances in which human life is potentially at stake. Please contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor when considering the use of a product contained herein for any specific purposes, such as apparatus or systems for transportation, vehicular, medical, aerospace, nuclear, or undersea repeater use. • The prior written approval of Mitsubishi Electric Corporation is necessary to reprint or reproduce these materials in whole or in part. • If these products or technologies are subject to Japanese export control restrictions, they must be exported under a license from the Japanese government and cannot be imported into a country other than the approved destination. • Any diversion or reexport contrary to the export control laws and regulations of Japan and/or the country of destination is prohibited. • Please contact Mitsubishi Electric Corporation or an authorized Mitsubishi Semiconductor product distributor for further details on these materials or the products contained therein. Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group USA Headquarters Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 1050 East Arques Avenue Sunnyvale, CA 94085-4601 Phone: 408-730-5900 FAX: 408-732-9382 Direct Sales Offices – USA Northwest Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 1050 East Arques Avenue Sunnyvale, CA 94085-4601 Phone: 408-730-5900 FAX: 408-737-1129 Southwest Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 20 Fairbanks, Suite 181 Irvine, CA 92618 Phone: 949-859-9453 FAX: 949-859-9450 Rocky Mountain Mexico Inquiries Northeast Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group PO Box 273377 Fort Collins, CO 80527 Phone: 970-669-4068 FAX: 970-669-4129 North Central Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 92 Montvale Avenue, Suite 2500 Stoneham, MA 02180 Phone: 781-245-6956 FAX: 781-245-4233 Western Mexico Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 20 Fairbanks, Suite 181 Irvine, CA 92618 Phone: 949-859-9453 FAX: 949-859-9450 Mid-Atlantic Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 3300 Edinborough Way, Suite 511 Edina, MN 55435 Phone: 952-837-9053 FAX: 952-837-9059 Mitsubishi Electric & Electronics USA, Inc. (Automotive Market Only) 50 West Big Beaver Rd., Suite 136 Troy, MI 48084 Phone: 248-526-9580 FAX: 248-526-9583 South Central Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 8310 Capital of Texas Hwy. N., Suite 260 Austin, TX 78731 Phone: 512-346-4200 FAX: 512-346-4434 Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 92 Montvale Avenue, Suite 2500 Stoneham, MA 02180 Phone: 781-245-6956 FAX: 781-245-4233 Eastern Mexico Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 8310 Capital of Texas Hwy. N., Suite 260 Austin, TX 78731 Phone: 512-346-4200 FAX: 512-346-4434 South Atlantic Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 2625 Meridian Parkway, Suite 100 Durham, NC 27713 Phone: 919-767-7900 FAX: 919-767-7902 Puerto Rico Inquiries Puerto Rico Southeast Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 2810 Premiere Parkway, Suite 400 Duluth, GA 30097 Phone: 678-258-4518 FAX: 678-258-4519 Mitsubishi Electric & Electronics USA, Inc. Electronic Device Group 2810 Premiere Parkway, Suite 400 Duluth, GA 30097 Phone: 678-258-4518 FAX: 678-258-4519 Mitsubishi Electric Sales Canada, Inc. Direct Sales Offices – Canada Central & Western Canada Mitsubishi Electric Sales Canada, Inc. 4299 14th Avenue Markham, Ontario, Canada L3R 0J2 Phone: 905-475-7728 FAX: 905-475-1918 Eastern Canada Mitsubishi Electric Sales Canada, Inc. 340 March Road, Suite 300 Kanata, Ontario, Canada K2K 2E4 Phone: 613-591-3348 FAX: 613-591-3948 JQA-QS0161 Mitsubishi Electric MCU products sold into the Automotive marketplace are QS-9000 certified. © 2002 Mitsubishi Electric & Electronics USA, Inc., Electronic Device Group. Mitsubishi Electric & Electronics USA, Inc. is a wholly owned subsidiary of Mitsubishi Electric Corporation. All trademarks are the property of their respective owners. The information supplied by Mitsubishi Electric & Electronics USA, Inc. is believed to be accurate and reliable but in no event shall Mitsubishi Electric & Electronics USA, Inc. be liable for any damages whatsoever arising out of the use or inability to use the information or any errors that may appear in this publication. THE INFORMATION IS PROVIDED AS IS WITHOUT ANY WARRANTIES OF ANY KIND, EITHER EXPRESS OR IMPLIED. MITSUBISHI ELECTRIC & ELECTRONICS USA, INC. RESERVES THE RIGHT, WITHOUT NOTICE, TO MAKE CHANGES TO THE INFORMATION OR TO THE DESIGN AND SPECIFICATIONS OF ITS HARDWARE AND/OR SOFTWARE PRODUCTS. PRODUCTS SUBJECT TO AVAILABILITY. Printed in U.S.A. www.mitsubishichips.com AN-DECE-MCU-28-A September 2001 9