Global Sources
EE Times-India
Stay in touch with EE Times India
 
EE Times-India > Memory/Storage
 
 
Memory/Storage  

How to check the Flash Version on M16C/62

Posted: 03 Oct 2003     Print Version  Bookmark and Share

Keywords:Embedded 

PDF document

REB05B0002-0102Z May 2003 Page 1 of 5

APPLICATION NOTE

M16C/62 Group

How to check the Flash Version on M16C/62

1.0 Abstract

The following article introduces and shows an example of how to check the internal Flash Version on M16C/62

group device.

2.0 Introduction

The Flash devices of the M16C/62 group have various types of Flash inside. Depending on the exact

typenumber of the microcontroller, different Flash technologies and processes are used. The M16C/62A series

has for example DINOR Flash technology inside, whereas the M16C/62P series utilizes HND Flash

technology. If more than one series is used in a product and the program needs to be updated in the field, it is

required to detect the correct type in order to apply the correct Flash programming algorithm in CPU

programming mode.

Here a method is presented how to do this for any M16C series by a "Flash identification register".

REB05B0002-0102Z May 2003 Page 2 of 5

M16C/62 Group

How to check the Flash Version on M16C/62

3.0 Contents

3.1 The Flash identification register

The Flash identification register is a register not mentioned in the datasheet.

At M16C/62P series (0.2HND Flash technology) it is located at 01B4h.

At M16C/62A and M16C/62M series (0.5 DINOR Flash technology) it is located at 03B4h.

At M16C/62N series (0.35 HND Flash technology) it is also located at 03B4h.

A special procedure is needed to read out the correct value from this register.

Structure of the Flash identification register:

Flash identification register

Symbol Address

FIDR 01B4H (M16C/62P series)

03B4h (M16C/62A, M16C62M, M16C/62N)

Read/WriteBit

Symbol

Bit Name Function

R W

FIDR0 0 X

FIDR1

Flash identification value Flash value output

b0 b1

DINOR: 1 1 (Note 1)

0.35 HND: 0 0

0.2 HND: 1 0

0 X

Nothing is assigned to these bits. In an attempt to write to these bits, please write

"0". The value, if read, is indeterminate.

0 X

Note 1: This value is kept on the internal data bus latch. If external memory area or

SFR area is accessed during the readout procedure, the data may be changed.

Note 2: Although this register cannot be written, a special writing step is needed in order

to read out the correct value

3.2 Readout procedure

The readout procedure is shown in figure 1. This procedure is valid for any M16C/62 series, regardless of the

address of the Flash identification register. Before reading out the value of the Flash identification register

FIDR, `FFh' must be written to it.

Please note, that the FIDR value is kept into the internal data bus latch. Therefore, if external memory

or SFR area is accessed between writing `FFh' and reading out the value, the value that is read out,

may be changed.

Hence it is required to stop any access of external memory or SFR area between step 1 and step 2 and

between step 4 and step 5. Furthermore the interrupts and the DMA must be disabled.

REB05B0002-0102Z May 2003 Page 3 of 5

M16C/62 Group

How to check the Flash Version on M16C/62

Write `FFh' to the address 01B4h

read out value

value of 2 LSBs

equals 10b?

Yes M16C/62P Series

(0.2 HND Flash)

No

Write `FFh' to the address 03B4h

read out value

value of 2 LSBs

equals `00b'?

Yes

M16C/62N Series

(0.35 HND Flash)

No

M16C/62A Series or M16C/62M Series

(0.5 DINOR Flash)

step 1

step 2

step 3

step 4

step 5

step 6

Figure 1: Flow diagram how to check M16C/62 Flash versions

4.0 Reference

Renesas Technology Corporation Semiconductor Home Page

http://www.renesas.com/

Contact for Renesas Technical Support

E-mail: support_apl@renesas.com

Data Sheet

M16C/62A Group

M16C/62M Group

M16C/62N Group

M16C/62P Group

(Use the latest version on the home page: http://www.renesas.com/)

User's Manual

M16C/62A Group

(Use the latest version on the home page: http://www.renesas.com/)

REB05B0002-0102Z May 2003 Page 4 of 5

M16C/62 Group

How to check the Flash Version on M16C/62

5.0 Programming Code

This example program is a function written in generic C. So it should work with any C compiler. According to

the return code the functions for Flash programming in CPU programming mode should be selected. These

functions can be derived for example from the appropriate bootloader programs.

#define FIDR_ADDR_1 (*(unsigned int *)0x1B4) // FIDR on M16C/62P series

#define FIDR_ADDR_2 (*(unsigned int *)0x3B4) // FIDR on M16C/62A,M,N series

#define FLASH_TYPE_M16C62N 0x00 // value of FIDR for M16C/62N

#define FLASH_TYPE_M16C62P 0x02 // value of FIDR for M16C/62P

#define FLASH_TYPE_M16C62A_M 0x03 // value of FIDR for M16C/62A or M16C/62M

#define DUMMY_VALUE 0xFF // value to write to Flash Identification register

#define FIDR_BITMASK 0x03 // Only 2 LSBs count

unsigned char CheckFlashVersion (void)

{

unsigned char FlashType; // return value

FIDR_ADDR_1 = DUMMY_VALUE; // write FF to 01B4h

FlashType = FIDR_ADDR_1; // read out value

FlashType &= FIDR_BITMASK; // mask out all other bits

if (FlashType == FLASH_TYPE_M16C62P)

{

return (FlashType); // It is M16C/62P

}

else

{

FIDR_ADDR_2 = DUMMY_VALUE; // write FF to 03B4h

FlashType = FIDR_ADDR_2; // read out value

FlashType &= FIDR_BITMASK; // mask out all other bits

if(FlashType == FLASH_TYPE_M16C62N)

{

return(FlashType); // It is M16C/62N

}

else

{

return(FLASH_TYPE_M16C62A_M); // It is M16C/62A or M16C/62M

}

}

}

Keep safety first in your circuit designs!

7 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

7 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 notconvey any

license under any intellectual property rights, or any other rights, belonging to Renesas Technology

Corporation or a third party.

7 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.

7 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).

7 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.

7 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.

7 The prior written approval of Renesas Technology Corporation is necessary to reprint or reproduce

in whole or in part these materials.

7 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.

7 Please contact Renesas Technology Corporation for further details on these materials or the

products contained therein.





Comment on "How to check the Flash Version on M1..."
Comments:  
*  You can enter [0] more charecters.
*Verify code:
 
 
Webinars

Seminars

Visit Asia Webinars to learn about the latest in technology and get practical design tips.

 

Go to top             Connect on Facebook      Follow us on Twitter      Follow us on Orkut

 
Back to Top