ETC PROGRAMMING

APPLICATION NOTE
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
1.0 Abstract
The following article describes using an asynchronous serial port and the FlashStart application to program the
user flash memory of the M16C/62 series of microcontrollers. This is referred to in the M16C/62 data sheets as
the “Standard Serial I/O Mode 2” method of flash programming.
2.0 Introduction
The Renesas M16C/62 series of microcontrollers is a 16-bit family of MCUs, based on Renesas’ 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. Standard Serial I/O Mode can be further divided into a synchronous mode
(Standard Serial I/O Mode 1) and an asynchronous mode (Standard Serial I/O Mode 2). 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.
Renesas provides a Windows based program, FlashStart, to serially download code (in S-record format) to
M16C/62 MCUs. The website for downloading the program is listed in section 5.0 Reference
3.0 Hardware Requirements for Asynchronous Serial Programming
The CNVSS pin on the microcontroller is the primary control line that determines whether the user area of the
flash or the boot area is accessed after the release of a reset. If the CNVSS pin is low the device will always
access the user flash area and will start in single chip mode. To execute the asynchronous serial rewrite program
in the boot area of the flash, the pins listed below must be connected as shown when a reset is performed (either
during power-up of the microcontroller or by forcing the Reset line low and then setting it high). Figure 1 shows a
typical connection.
REU05B0013-0100Z
June 2003
Page 1 of 6
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
Pin
Required Connection
CNVSS
Vcc
CE (P5-0)
Vcc
EPM (P5-5)
Vss
SCLK1 (P6-5)
Vss
Vcc
P5_0 (CE)
P5_5 (EPM)
5
RS-232
TRANSCEIVER
4
3
M16C/62
TTL
RECEIVE
RxD1
TTL
TRANSMIT
TxD1
RS-232
RECEIVE
RS-232
TRANSMIT
2
9
8
7
6
1
SCLK1
Connect to PC COM
Port Using StraightThrough Serial Cable
Vcc
CNVss
Jumper To
Enter Boot
Mode
Figure 1 Typical Connection for Asynchronous Serial Programming
4.0 Using the FlashStart Program
4.1 Startup
Selecting ‘flashstart.exe’ will start the program. For the M16C/60 series MCUs, select “internal flash memory”
and the COM port that is connected to the hardware. Select “OK”. See Figure 2.
REU05B0013-0100Z
June 2003
Page 2 of 6
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
Figure 2 Select Program Dialog Box
Once communications are established, the ID Check dialog box opens. If a communication error occurs, follow
the messages to properly set up communications
4.2 Selecting a File and ID Check
The ID Check dialog box is for inputting the name and ID of your work file. The program uses Motorola S2 format.
If no ID was previously defined, the ID code would be all zeros or all ones (‘00’ hex or ‘FF’ hex).
Figure 3 ID Check Dialog Box
REU05B0013-0100Z
June 2003
Page 3 of 6
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
Input the path and file name in the FilePath field box and the ID code in the ID field box. Selecting the Refer
button will open a browse window to locate the file on your PC. If the ID file is in the same folder (refer to the
FlashStart manual), the ID code is loaded when the file is selected. If there is no ID file, a warning message will
be shown that indicates the ID file cannot be found. Select "OK" in the warning box and enter the correct ID bytes
in the ID boxes or ‘FF’ or ‘00’ in the boxes if there is no ID code being used.
Figure 4 ID Check Dialog Box
Once the ID code has been entered, selecting the OK button will start the ID check and opens the FlashStart
Programmer window. This allows the device commands to be executed. If an ID matching error occurs, the
FlashStart Programmer window will still open; however, the user will be unable to execute the commands. In this
case, recheck the ID code.
Selecting the Cancel button will open the FlashStart Programmer window without running an ID check. The
FlashStart allows device commands to be used with cleared flash without performing an ID check.
4.3 FlashStart Programming Window
The FlashStart Programming window executes device commands. If the flash MCU is cleared, the device
commands can be used without running an ID check. However, if the flash is written, only the Load (ID), Status,
and Setting commands can be used until the ID check is run. Once the correct ID check is completed, all of the
following commands are available:
• Load (ID)
Selects a file and checks the ID code.
• Blank
Checks if a selected area of Flash ROM is blank.
• Read
Compares the contents of the Flash ROM with the selected file.
• Status
Displays the current status of the Flash ROM.
REU05B0013-0100Z
June 2003
Page 4 of 6
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
• E.P.R
Erases the Flash, followed by a Program cycle, followed by a Read verify check.
• B.P.R.
Runs a Blank check, followed by a Program cycle, followed by a Read verify check.
• Program
Programs the device with the selected file (note that the program area must beblank).
• Erase
Erases the entire user Flash ROM area.
• Setting
Is used to change the Baud rate.
• Download
Loads control program file selected into RAM and executes file.
Figure 5 ID Check Dialog Box
When Program and other commands are selected, the Input Address dialog box opens. The default addresses
are the low and high addresses of the file that was selected in the ID Check dialog box. If a file is not selected, the
start and end addresses of the M16C/62 are used.
Figure 6 Input Address Dialog Box
REU05B0013-0100Z
June 2003
Page 5 of 6
M16C/62
Programming the M16C/62 Flash in Asynchronous Serial Mode
5.0 Reference
Renesas Technology Corporation Semiconductor Home Page
http://www.renesas.com
E-mail Support
[email protected]
Data Sheets
• M16C/62 datasheets:62aeds.pdf
User’s Manual
• FlashStart Programmer Manual
REU05B0013-0100Z
June 2003
Page 6 of 6
Keep safety first in your circuit designs!
• Renesas Technology Corporation puts the maximum effort into making semiconductor products
better and more reliable, but there is always the possibility that trouble may occur with them. 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 substitutive, auxiliary circuits, (ii) use of nonflammable material or
(iii) prevention against any malfunction or mishap.
Notes regarding these materials
• These materials are intended as a reference to assist our customers in the selection of the Renesas
•
•
•
•
•
•
•
Technology Corporation product best suited to the customer's application; they do not convey any
license under any intellectual property rights, or any other rights, belonging to Renesas Technology
Corporation or a third party.
Renesas Technology Corporation assumes no responsibility for any damage, or infringement of any
third-party'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 are
subject to change by Renesas Technology Corporation without notice due to product improvements
or other reasons. It is therefore recommended that customers contact Renesas Technology
Corporation or an authorized Renesas Technology Corporation product distributor for the latest
product information before purchasing a product listed herein.
The information described here may contain technical inaccuracies or typographical errors.
Renesas Technology Corporation assumes no responsibility for any damage, liability, or other loss
rising from these inaccuracies or errors.
Please also pay attention to information published by Renesas Technology Corporation by various
means, including the Renesas Technology Corporation Semiconductor home page
(http://www.renesas.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. Renesas
Technology Corporation assumes no responsibility for any damage, liability or other loss resulting
from the information contained herein.
Renesas Technology 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 Renesas Technology Corporation or an authorized Renesas Technology Corporation 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 Renesas Technology Corporation is necessary to reprint or reproduce in
whole or in part these materials.
If these products or technologies are subject to the 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 Renesas Technology Corporation for further details on these materials or the
products contained therein.