JP2013101457A - Semiconductor device - Google Patents

Semiconductor device Download PDF

Info

Publication number
JP2013101457A
JP2013101457A JP2011244291A JP2011244291A JP2013101457A JP 2013101457 A JP2013101457 A JP 2013101457A JP 2011244291 A JP2011244291 A JP 2011244291A JP 2011244291 A JP2011244291 A JP 2011244291A JP 2013101457 A JP2013101457 A JP 2013101457A
Authority
JP
Japan
Prior art keywords
voltage
external power
processor
power supply
cpu
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2011244291A
Other languages
Japanese (ja)
Inventor
Tsutomu Kumagai
勉 熊谷
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Electronics Corp
Original Assignee
Renesas Electronics Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Electronics Corp filed Critical Renesas Electronics Corp
Priority to JP2011244291A priority Critical patent/JP2013101457A/en
Publication of JP2013101457A publication Critical patent/JP2013101457A/en
Pending legal-status Critical Current

Links

Images

Abstract

PROBLEM TO BE SOLVED: To provide a semiconductor device which can automatically set a more appropriate operation mode and operation frequency in accordance with an external power source voltage.SOLUTION: The semiconductor device in accordance with an embodiment comprises: a processor; a nonvolatile memory that can be accessed by the processor; and a voltage detection unit that detects the external power source voltage for driving at least the processor and the nonvolatile memory. The processor sets the operation mode and/or the operation frequency of at least one of the processor and the nonvolatile memory in accordance with a voltage detected by the voltage detection unit, by executing an instruction group.

Description

本発明は、プロセッサおよび不揮発性メモリを含む半導体装置に関する。   The present invention relates to a semiconductor device including a processor and a nonvolatile memory.

従来から、同一基板上にプロセッサおよび不揮発性メモリが実装されたマイクロコンピュータがさまざまな用途で用いられている。このようなマイクロコンピュータに供給される外部電源の種類は、実装先の装置構成や用途などに応じて制約されることがある。   Conventionally, a microcomputer in which a processor and a nonvolatile memory are mounted on the same substrate has been used for various purposes. The type of external power supply supplied to such a microcomputer may be restricted depending on the device configuration and application of the mounting destination.

特開平07−029386号公報(特許文献1)に開示されるマイクロコンピュータに含まれるフラッシュメモリは、書込または消去動作時に使用される通常動作電圧よりもレベルの高い電圧を発生する高電圧発生回路を有する電源回路と、通常動作電圧を外部から供給する第1の電源端子と、書込または消去動作時に使用される通常動作電圧よりも高いレベルの電圧を外部から供給するための第2の電源端子とを有している。そして、第2の電源端子に供給された高レベルの電圧または高電圧発生回路で発生された高電圧のいずれかが選択されて、不揮発性記憶素子に供給される。このような昇圧電圧と外部高電圧とを切り換えてデータの消去、書込を行わせることで、携帯用装置において異なる電圧の電池を内蔵する必要がないという効果を奏する。   A flash memory included in a microcomputer disclosed in Japanese Patent Application Laid-Open No. 07-029386 (Patent Document 1) is a high voltage generation circuit that generates a voltage having a level higher than a normal operation voltage used during a write or erase operation. A first power supply terminal for supplying a normal operation voltage from the outside, and a second power supply for supplying a voltage at a level higher than the normal operation voltage used during the write or erase operation from the outside Terminal. Then, either the high level voltage supplied to the second power supply terminal or the high voltage generated by the high voltage generation circuit is selected and supplied to the nonvolatile memory element. By switching between the boosted voltage and the external high voltage so as to erase and write data, there is an effect that it is not necessary to incorporate batteries with different voltages in the portable device.

特開平07−029386号公報Japanese Patent Application Laid-Open No. 07-029386

上述したように、上述のようなマイクロコンピュータは、さまざまな用途に用いられることが想定されており、外部電源に対する汎用性を高めたいというニーズがある。すなわち、マイクロコンピュータに提供される外部電源の種類(電圧)は、実装先の装置構成や用途などによって制限されるので、より外部電源についての制約を受けないように、動作可能な電圧範囲を拡大するための取組みが進められている。   As described above, the microcomputer as described above is assumed to be used for various purposes, and there is a need to improve the versatility of the external power supply. In other words, the type (voltage) of the external power supply provided to the microcomputer is limited by the device configuration and application of the mounting destination, so the voltage range that can be operated is expanded so that it is not subject to restrictions on the external power supply. Efforts to do so are underway.

一方、プロセッサや不揮発性メモリの有する性能を最大限利用するためには、外部電源の電圧に応じて、より好適な動作モードや動作周波数を自動的に設定することが好ましい。しかしながら、このような機能を有する構成は存在しなかった。   On the other hand, in order to make maximum use of the performance of the processor and the nonvolatile memory, it is preferable to automatically set a more suitable operation mode and operation frequency according to the voltage of the external power supply. However, there is no configuration having such a function.

本発明は、かかる課題を解決するためになされたものであり、その目的は、外部電源の電圧に応じて、より適切な動作モードや動作周波数を自動的に設定することが可能な半導体装置を提供することである。   The present invention has been made to solve such a problem, and an object of the present invention is to provide a semiconductor device capable of automatically setting a more appropriate operation mode and operation frequency in accordance with the voltage of the external power supply. Is to provide.

ある実施の形態に従う半導体装置は、プロセッサと、プロセッサによるアクセスが可能な不揮発性メモリと、少なくともプロセッサおよび不揮発性メモリを駆動するための外部電源の電圧を検出する電圧検出部とを含む。プロセッサは、命令群を実行することで、電圧検出部によって検出された電圧に応じて、プロセッサおよび不揮発性メモリの少なくとも一方についての動作モードおよび/または動作周波数を設定する。   A semiconductor device according to an embodiment includes a processor, a nonvolatile memory that can be accessed by the processor, and a voltage detection unit that detects at least a voltage of an external power source for driving the processor and the nonvolatile memory. The processor sets an operation mode and / or an operation frequency for at least one of the processor and the nonvolatile memory in accordance with the voltage detected by the voltage detection unit by executing the instruction group.

ある実施の形態によれば、外部電源の電圧に応じて、より適切な動作モードや動作周波数を自動的に設定することができる。   According to an embodiment, a more appropriate operation mode and operation frequency can be automatically set according to the voltage of the external power supply.

本発明の実施の形態に従うマイクロコンピュータの構成を示す模式図である。It is a schematic diagram which shows the structure of the microcomputer according to embodiment of this invention. 本発明の実施の形態に従うマイクロコンピュータに含まれる電圧検出部の構成を示す模式図である。It is a schematic diagram which shows the structure of the voltage detection part contained in the microcomputer according to embodiment of this invention. 本発明の実施の形態に従うマイクロコンピュータにおけるクロック信号を発生する回路構成の一例を示す図である。It is a figure which shows an example of the circuit structure which generates the clock signal in the microcomputer according to embodiment of this invention. 本発明の実施の形態に従うマイクロコンピュータにおける設定処理およびフラッシュメモリへのアクセスの手順を示すフローチャートである。It is a flowchart which shows the procedure of the setting process in the microcomputer according to embodiment of this invention, and access to flash memory. 図4に示す外部電源の電圧検出処理における処理手順を示すフローチャートである。5 is a flowchart showing a processing procedure in voltage detection processing of the external power source shown in FIG. 図4に示す外部電源の電圧検出処理における処理手順を示すフローチャートである。5 is a flowchart showing a processing procedure in voltage detection processing of the external power source shown in FIG. 本発明の実施の形態に従うマイクロコンピュータにおける設定処理およびフラッシュメモリへのアクセスの手順の変形例を示すフローチャートである。It is a flowchart which shows the modification of the procedure of the setting process in the microcomputer according to embodiment of this invention, and the access to flash memory.

本発明の実施の形態について、図面を参照しながら詳細に説明する。なお、図中の同一または相当部分については、同一符号を付してその説明は繰返さない。   Embodiments of the present invention will be described in detail with reference to the drawings. Note that the same or corresponding parts in the drawings are denoted by the same reference numerals and description thereof will not be repeated.

<A.概要>
マイクロコンピュータに内蔵されているブートローダ(命令群)は、マイクロコンピュータ内のフラッシュメモリを書き換える(アクセスする)場合に、当該マイクロコンピュータに供給されている外部電源の電圧に応じて、CPUおよびフラッシュメモリの動作モードや動作周波数を適性化することが好ましい。さらに、フラッシュメモリにおけるデータの書き換えに要する時間を短縮化するためにも、動作周波数や動作モードをより好適に設定する必要がある。
<A. Overview>
The boot loader (instruction group) built in the microcomputer rewrites (accesses) the flash memory in the microcomputer according to the voltage of the external power supply supplied to the microcomputer. It is preferable to optimize the operation mode and the operation frequency. Further, in order to shorten the time required for rewriting data in the flash memory, it is necessary to set the operating frequency and the operating mode more suitably.

このような設定を行う場合には、マイクロコンピュータに供給されている外部電源の電圧を知る必要がある。   When performing such setting, it is necessary to know the voltage of the external power source supplied to the microcomputer.

従来の方法としては、ユーザが、パーソナルコンピュータ上で実行されるフラッシュメモリ書き換え用フロントエンドソフトウェアを用いて、ターゲット電圧を入力し、その情報をマイクロコンピュータへ送信することで、CPUおよびフラッシュメモリの動作モードや動作周波数を設定していた。   As a conventional method, the user inputs the target voltage using the flash memory rewriting front-end software executed on the personal computer, and transmits the information to the microcomputer. The mode and operating frequency were set.

しかしながら、このような方法では、ユーザが、パーソナルコンピュータ上で実行されるフラッシュメモリ書き換え用フロントエンドソフトウェアにて誤った電圧情報(ターゲット電圧)を入力しても、マイクロコンピュータ側ではその誤りを検出することができないので、マイクロコンピュータの予め規定された動作範囲外でフラッシュメモリの書き換えを行ってしまう可能性がある。   However, in such a method, even if the user inputs incorrect voltage information (target voltage) with the flash memory rewriting front-end software executed on the personal computer, the microcomputer detects the error. Therefore, there is a possibility that the flash memory is rewritten outside the predetermined operating range of the microcomputer.

また、電圧情報(ターゲット電圧)がマイクロコンピュータへ予め通知されないシステムでは、動作を保障するため、CPUやフラッシュメモリの動作周波数をより低く設定して動作させることが一般的であり、その結果、フラッシュメモリの書き換え時間が長くなるという課題があった。   Further, in a system in which voltage information (target voltage) is not notified to the microcomputer in advance, it is common to operate with a lower operating frequency of the CPU or flash memory in order to ensure the operation. There was a problem that the memory rewrite time was long.

そこで、本実施の形態においては、マイクロコンピュータに供給される外部電源の電圧を検出して、当該検出された電圧に応じたより好適なCPUおよびフラッシュメモリの動作モードや動作周波数を設定する。   Therefore, in this embodiment, the voltage of the external power supply supplied to the microcomputer is detected, and more preferable operation modes and operation frequencies of the CPU and the flash memory are set according to the detected voltage.

具体的には、本実施の形態に従うマイクロコンピュータは、プロセッサであるCPU(Central Processing Unit)が処理すべき情報(データ)を電気的な消去・書込によって書き換え可能な不揮発性メモリ(フラッシュメモリ)を有する。マイクロコンピュータは、マイクロコンピュータに供給される外部電源の電圧を検出する電圧検出部と、フラッシュメモリの書き換えを行うソフトウエア(ブートローダ)で構成される。   Specifically, the microcomputer according to the present embodiment includes a nonvolatile memory (flash memory) that can rewrite information (data) to be processed by a CPU (Central Processing Unit) that is a processor by electrical erasing / writing. Have The microcomputer includes a voltage detection unit that detects the voltage of an external power source supplied to the microcomputer and software (boot loader) that rewrites the flash memory.

一例として、電圧検出部は、VCC端子(電源端子)に印加されている外部電源を異なる分圧比で分圧した複数種類の電圧を生成し、レジスタを用いて検出したい電圧レベルを選択することにより、選択された電圧レベルがセレクタから出力される。この出力された電圧と基準電圧とを比較器により比較し、その比較結果がレジスタに格納される。この比較結果により、マイクロコンピュータに供給される外部電源の電圧を判断でき、ブートローダによって外部電源の電圧に応じてより好適なCPUおよびフラッシュメモリの動作モードや動作周波数の設定が可能となる。   As an example, the voltage detection unit generates a plurality of types of voltages obtained by dividing the external power supply applied to the VCC terminal (power supply terminal) at different voltage division ratios, and selects a voltage level to be detected using a register. The selected voltage level is output from the selector. The output voltage and the reference voltage are compared by a comparator, and the comparison result is stored in a register. From this comparison result, the voltage of the external power supply supplied to the microcomputer can be determined, and the operation mode and the operation frequency of the CPU and the flash memory can be more suitably set by the boot loader according to the voltage of the external power supply.

<B.全体構成>
図1は、本発明の実施の形態に従うマイクロコンピュータ1の構成を示す模式図である。図1を参照して、マイクロコンピュータ1は、CPU102と、ブートROM(Read Only Memory)104と、フラッシュメモリ106と、クロック発生回路108と、電圧検出部110とを含む。これらの各部は、内部バス100を介して互いデータ通信可能に接続されている。
<B. Overall configuration>
FIG. 1 is a schematic diagram showing a configuration of a microcomputer 1 according to the embodiment of the present invention. Referring to FIG. 1, microcomputer 1 includes a CPU 102, a boot ROM (Read Only Memory) 104, a flash memory 106, a clock generation circuit 108, and a voltage detection unit 110. These units are connected to each other via an internal bus 100 so that data communication is possible.

CPU102は、プロセッサの典型例であり、予め指定された順序で命令を順次実行することで、マイクロコンピュータ1に含まれる各部を制御する。   The CPU 102 is a typical example of a processor, and controls each unit included in the microcomputer 1 by sequentially executing instructions in a predetermined order.

ブートROM104は、マイクロコンピュータ1の起動時における各種処理を実行するための命令群を格納する記憶部である。すなわち、ブートROM104は、ブートローダとして機能する。具体的には、マイクロコンピュータ1の起動時において、CPU102は、ブートROM104に格納されている命令群を所定順序でロードして実行することで、後述するような、電圧検出部110によって検出された電圧に応じて、CPU102およびフラッシュメモリ106の動作モードおよび/または動作周波数を動作環境に応じた値に設定する。ブートROM104に格納される命令群は、このような動作モードおよび/または動作周波数を設定するためのプログラムに加えて、各種の初期化処理を実行するためのプログラムを含みうる。   The boot ROM 104 is a storage unit that stores a group of instructions for executing various processes when the microcomputer 1 is activated. That is, the boot ROM 104 functions as a boot loader. Specifically, when the microcomputer 1 is started, the CPU 102 loads and executes a group of instructions stored in the boot ROM 104 in a predetermined order, and is detected by the voltage detection unit 110 as described later. In accordance with the voltage, the operation mode and / or the operation frequency of the CPU 102 and the flash memory 106 are set to values according to the operation environment. The instruction group stored in the boot ROM 104 can include a program for executing various initialization processes in addition to the program for setting the operation mode and / or the operation frequency.

フラッシュメモリ106は、プロセッサであるCPU102によるアクセスが可能な不揮発性メモリの典型例であり、CPU102によって書き込まれたデータを不揮発的に格納する。フラッシュメモリ106は、メモリセルに対する電圧の印加によって、データの記憶(プログラム)および消去(イレース)を行う。本実施の形態において、フラッシュメモリ106としては、任意の構造(NAND型やNOR型)および任意のセル方式(SLC(Single Level Cell)やMLC(Multi Level Cell))のものを採用することができる。さらに、フラッシュメモリに限られず、MRAM(Magnetic Random Access Memory)やFeRAM(Ferroelectric Random Access Memory)などの不揮発性メモリを採用してもよい。   The flash memory 106 is a typical example of a nonvolatile memory that can be accessed by the CPU 102 that is a processor, and stores data written by the CPU 102 in a nonvolatile manner. The flash memory 106 stores (programs) and erases (erases) data by applying a voltage to the memory cell. In this embodiment, as the flash memory 106, an arbitrary structure (NAND type or NOR type) and an arbitrary cell type (SLC (Single Level Cell) or MLC (Multi Level Cell)) can be adopted. . Further, the present invention is not limited to a flash memory, and a nonvolatile memory such as an MRAM (Magnetic Random Access Memory) or FeRAM (Ferroelectric Random Access Memory) may be adopted.

クロック発生回路108は、CPU102およびフラッシュメモリ106、ならびに、内部バス100などのデータ伝送および処理タイミングなどを決定するクロック信号を発生する。後述するように、クロック発生回路108は、駆動されるデバイスの別に複数の動作周波数を有するクロック信号を発生するとともに、CPU102によって設定された動作周波数のクロック信号を各コンポーネントへ提供する。   The clock generation circuit 108 generates a clock signal for determining data transmission and processing timing of the CPU 102 and the flash memory 106 and the internal bus 100. As will be described later, the clock generation circuit 108 generates a clock signal having a plurality of operating frequencies for each device to be driven, and provides a clock signal having an operating frequency set by the CPU 102 to each component.

電圧検出部110は、マイクロコンピュータ1に供給される外部電源の電圧を検出する。外部電源は、少なくともCPU102およびフラッシュメモリ106を駆動する。電圧検出部110は、外部電源を供給するための端子であるVCC端子(電源端子)と電気的に接続される。より具体的には、電圧検出部110は、比較用処理回路120と、比較切換用レジスタ122と、比較器124と、比較結果格納レジスタ126とを含む。   The voltage detection unit 110 detects the voltage of the external power supply supplied to the microcomputer 1. The external power source drives at least the CPU 102 and the flash memory 106. The voltage detection unit 110 is electrically connected to a VCC terminal (power supply terminal) that is a terminal for supplying external power. More specifically, the voltage detection unit 110 includes a comparison processing circuit 120, a comparison switching register 122, a comparator 124, and a comparison result storage register 126.

比較用処理回路120は、VCC端子を介して入力される外部電源の電圧を比較するために前処理する回路である。比較器124は、外部電源に依存する電圧と基準電圧とを比較する。比較切換用レジスタ122は、外部電源の電圧レベルを判定するために、比較器124に入力される電圧信号を切り換える。比較結果格納レジスタ126は、比較器124により判断される大小関係と、比較切換用レジスタ122における切換指令との関係に基づいて、外部電源の電圧(電圧レベル)を判定する。   The comparison processing circuit 120 is a circuit that performs preprocessing in order to compare the voltage of the external power source input via the VCC terminal. The comparator 124 compares the voltage depending on the external power source with the reference voltage. The comparison switching register 122 switches the voltage signal input to the comparator 124 in order to determine the voltage level of the external power supply. The comparison result storage register 126 determines the voltage (voltage level) of the external power source based on the relationship between the magnitude relationship determined by the comparator 124 and the switching command in the comparison switching register 122.

マイクロコンピュータ1は、フラッシュメモリ106の内容を書き換えるにあたって、マイクロコンピュータ1に供給されている外部電源の電圧を電圧検出部110により検出し、当該外部電源の電圧に応じて、CPU102およびフラッシュメモリ106についてのより好適な動作モードおよび/または動作周波数を設定する。そして、マイクロコンピュータ1は、より好適な動作モードおよび/または動作周波数を設定した上で、フラッシュメモリ106を書き換える。このような動作モードおよび/または動作周波数の設定処理は、CPU102が、ブートROM104に格納されているブートローダ(命令群)に従って実行する。   When the microcomputer 1 rewrites the contents of the flash memory 106, the voltage detection unit 110 detects the voltage of the external power supply supplied to the microcomputer 1, and the CPU 102 and the flash memory 106 are detected according to the voltage of the external power supply. A more preferable operation mode and / or operation frequency is set. The microcomputer 1 rewrites the flash memory 106 after setting a more preferable operation mode and / or operation frequency. Such operation mode and / or operation frequency setting processing is executed by the CPU 102 in accordance with a boot loader (instruction group) stored in the boot ROM 104.

<C.電圧検出部>
次に、図2を参照して、図1に示す電圧検出部110の具体的な構成の一例を示す。図2は、本発明の実施の形態に従うマイクロコンピュータ1に含まれる電圧検出部110の構成を示す模式図である。図2(A)には、基準電圧を順次切り換えることで外部電源の電圧を検出する構成例である電圧検出部110Aを示し、図2(B)には、外部電源の分圧比を順次切り換えることで外部電源の電圧を検出する構成例である構成例である電圧検出部110Bを示す。
<C. Voltage detector>
Next, an example of a specific configuration of the voltage detection unit 110 illustrated in FIG. 1 will be described with reference to FIG. FIG. 2 is a schematic diagram showing a configuration of voltage detection unit 110 included in microcomputer 1 according to the embodiment of the present invention. 2A shows a voltage detection unit 110A that is a configuration example for detecting the voltage of the external power supply by sequentially switching the reference voltage, and FIG. 2B sequentially switches the voltage dividing ratio of the external power supply. The voltage detection part 110B which is a structural example which is a structural example which detects the voltage of an external power supply is shown.

(c1:基準電圧を切り換える構成)
図2(A)に示す電圧検出部110Aにおいて、比較用処理回路120Aは、VCC端子とグランドGNDとの間に直列に接続された分圧抵抗1201および1202と、内部基準電圧源(図示しない)から内部基準電圧を印加されるレベル選択回路1204とを含む。また、電圧検出部110Aは、比較切換用レジスタ122として、レベル選択用レジスタ1221を含む。
(C1: Configuration for switching the reference voltage)
In the voltage detector 110A shown in FIG. 2A, the comparison processing circuit 120A includes a voltage dividing resistor 1201 and 1202 connected in series between the VCC terminal and the ground GND, and an internal reference voltage source (not shown). And a level selection circuit 1204 to which an internal reference voltage is applied. The voltage detection unit 110 </ b> A includes a level selection register 1221 as the comparison switching register 122.

分圧抵抗1201と分圧抵抗1202との接続点にあるノード1203と比較器124の+端子が電気的に接続される。すなわち、外部電源の電圧が分圧抵抗1201と分圧抵抗1202との比で分圧された検出電圧Vdetが比較器124へ入力される。レベル選択回路1204は、レベル選択用レジスタ1221に設定される値(レジスタ値)に従って、入力される内部基準電圧を所定比率で分圧して基準電圧Vrefを出力する。すなわち、基準電圧Vrefが比較器124の−端子へ入力され、比較器124において、検出電圧Vdetと基準電圧Vrefとの大小関係が判定される。レベル選択用レジスタ1221に設定される値は、外部電源の電圧検出処理において、CPU102が順次切り換える。すなわち、レベル選択用レジスタ1221に設定される値を順次切り換えることで、比較器124へ入力される基準電圧Vrefを変化させていき、比較器124における大小関係が反転する基準電圧Vrefに基づいて、外部電源の電圧(電圧レベル)を判定する。なお、比較器124における比較結果は、比較結果格納レジスタ126(図1)へ格納される。   A node 1203 at a connection point between the voltage dividing resistor 1201 and the voltage dividing resistor 1202 and the + terminal of the comparator 124 are electrically connected. That is, the detection voltage Vdet obtained by dividing the voltage of the external power supply by the ratio of the voltage dividing resistor 1201 and the voltage dividing resistor 1202 is input to the comparator 124. The level selection circuit 1204 divides the input internal reference voltage at a predetermined ratio according to a value (register value) set in the level selection register 1221 and outputs a reference voltage Vref. That is, the reference voltage Vref is input to the negative terminal of the comparator 124, and the comparator 124 determines the magnitude relationship between the detection voltage Vdet and the reference voltage Vref. The value set in the level selection register 1221 is sequentially switched by the CPU 102 in the voltage detection process of the external power supply. That is, by sequentially switching values set in the level selection register 1221, the reference voltage Vref input to the comparator 124 is changed, and based on the reference voltage Vref that reverses the magnitude relationship in the comparator 124. Determine the voltage (voltage level) of the external power supply. The comparison result in the comparator 124 is stored in the comparison result storage register 126 (FIG. 1).

このように、図2(A)に示す電圧検出部110Aは、VCC端子(電源端子)に印加されている電圧を所定比率で分圧して得られた検出電圧Vdetを生成するとともに、内部基準電圧から検出したい電圧レベルをレベル選択用レジスタ1221で選択して基準電圧Vrefを生成する。そして、検出電圧Vdetと基準電圧Vrefとを比較器124により比較し、比較結果を比較結果格納レジスタ126(図1)に格納する。   As described above, the voltage detection unit 110A shown in FIG. 2A generates the detection voltage Vdet obtained by dividing the voltage applied to the VCC terminal (power supply terminal) at a predetermined ratio, and the internal reference voltage. The level selection register 1221 selects the voltage level to be detected from the reference voltage Vref. Then, the detection voltage Vdet and the reference voltage Vref are compared by the comparator 124, and the comparison result is stored in the comparison result storage register 126 (FIG. 1).

すなわち、電圧検出部110Aは、外部電源を所定比率で分圧した電圧と予め定められた基準電圧と比較する比較回路である比較器124と、基準電圧の大きさを複数種類に切り換える基準電圧発生回路であるレベル選択回路1204およびレベル選択用レジスタ1221と、比較器124における比較結果とレベル選択回路1204から出力される基準電圧とに基づいて、外部電源の電圧を判定する判定回路とを含む。   That is, the voltage detection unit 110A includes a comparator 124 that compares a voltage obtained by dividing the external power supply at a predetermined ratio with a predetermined reference voltage, and a reference voltage generation that switches the magnitude of the reference voltage to a plurality of types. The circuit includes a level selection circuit 1204 and a level selection register 1221 that are circuits, and a determination circuit that determines the voltage of the external power source based on the comparison result in the comparator 124 and the reference voltage output from the level selection circuit 1204.

(c2:外部電源の分圧比を切り換える構成)
図2(B)に示す電圧検出部110Bにおいて、比較用処理回路120は、VCC端子とグランドGNDとの間に直列に接続された分圧抵抗1205,1206,1207,1208と、分圧レベル選択回路1209とを含む。また、電圧検出部110Bは、比較切換用レジスタ122として、レベル選択用レジスタ1222を含む。
(C2: Configuration for switching the voltage division ratio of the external power supply)
In the voltage detection unit 110B shown in FIG. 2B, the comparison processing circuit 120 includes a voltage dividing resistor 1205, 1206, 1207, 1208 connected in series between the VCC terminal and the ground GND, and a voltage dividing level selection. Circuit 1209. The voltage detection unit 110 </ b> B includes a level selection register 1222 as the comparison switching register 122.

分圧抵抗1205と分圧抵抗1206との接続点にあるノードN1と、分圧抵抗1206と分圧抵抗1207との接続点にあるノードN2と、分圧抵抗1207と分圧抵抗1208との接続点にあるノードN3とのそれぞれが、分圧レベル選択回路1209と電気的に接続される。分圧レベル選択回路1209は、レベル選択用レジスタ1222に設定される値(レジスタ値)に従って、ノードN1,N2,N3のそれぞれからの電圧のうち指定された電圧を比較器124の+端子へ出力する。また、内部基準電圧である基準電圧Vrefが比較器124の−端子へ入力され、比較器124において、検出電圧Vdetと基準電圧Vrefとの大小関係が判定される。レベル選択用レジスタ1222に設定される値は、外部電源の電圧検出処理において、CPU102が順次切り換える。すなわち、レベル選択用レジスタ1222に設定される値を順次切り換えることで、比較器124へ入力される検出電圧Vdetを変化させていき、比較器124における大小関係が反転する検出電圧Vdetに基づいて、外部電源の電圧(電圧レベル)を判定する。なお、比較器124における比較結果は、比較結果格納レジスタ126(図1)へ格納される。   A node N1 at a connection point between the voltage dividing resistor 1205 and the voltage dividing resistor 1206, a node N2 at a connection point between the voltage dividing resistor 1206 and the voltage dividing resistor 1207, and a connection between the voltage dividing resistor 1207 and the voltage dividing resistor 1208. Each of the node N3 at the point is electrically connected to the voltage division level selection circuit 1209. Divided voltage level selection circuit 1209 outputs the specified voltage among the voltages from nodes N1, N2, and N3 to the + terminal of comparator 124 in accordance with the value (register value) set in level selection register 1222. To do. Further, the reference voltage Vref, which is an internal reference voltage, is input to the negative terminal of the comparator 124, and the comparator 124 determines the magnitude relationship between the detection voltage Vdet and the reference voltage Vref. The values set in the level selection register 1222 are sequentially switched by the CPU 102 in the external power supply voltage detection process. That is, by sequentially switching the value set in the level selection register 1222, the detection voltage Vdet input to the comparator 124 is changed, and based on the detection voltage Vdet in which the magnitude relationship in the comparator 124 is inverted, Determine the voltage (voltage level) of the external power supply. The comparison result in the comparator 124 is stored in the comparison result storage register 126 (FIG. 1).

このように、図2(B)に示す電圧検出部110Bは、VCC端子(電源端子)に印加されている電圧を異なる比率で分圧して得られた複数の検出電圧のうち、検出したい電圧レベルをレベル選択用レジスタ1222で選択して検出電圧Vdetを生成する。そして、検出電圧Vdetと基準電圧Vrefとを比較器124により比較し、比較結果を比較結果格納レジスタ126(図1)に格納する。   As described above, the voltage detection unit 110B illustrated in FIG. 2B is to detect a voltage level among a plurality of detection voltages obtained by dividing the voltage applied to the VCC terminal (power supply terminal) at different ratios. Is selected by the level selection register 1222 to generate the detection voltage Vdet. Then, the detection voltage Vdet and the reference voltage Vref are compared by the comparator 124, and the comparison result is stored in the comparison result storage register 126 (FIG. 1).

すなわち、電圧検出部110Bは、外部電源を分圧して複数段階の分圧電圧(検出電圧Vdet)を出力する分圧回路である分圧レベル選択回路1209と、分圧レベル選択回路1209により出力される検出電圧Vdetを予め定められた基準電圧と比較する比較回路である比較器124と、分圧レベル選択回路1209から出力される検出電圧Vdetと比較器124における比較結果とに基づいて、外部電源の電圧を判定する判定回路とを含む。   That is, the voltage detection unit 110B is output by a voltage division level selection circuit 1209 that is a voltage division circuit that divides an external power supply and outputs a divided voltage (detection voltage Vdet) in a plurality of stages, and a voltage division level selection circuit 1209. A comparator 124 that compares a detected voltage Vdet with a predetermined reference voltage, an external power supply based on the detected voltage Vdet output from the divided voltage level selection circuit 1209 and the comparison result in the comparator 124. And a determination circuit for determining the voltage of.

<D.動作モード/動作周波数の設定>
マイクロコンピュータ1の内部では、供給される外部電源を用いて、各種の内部クロック信号や内部電圧を生成する。そのため、外部電源の電圧は、マイクロコンピュータ1の性能を左右する。例えば、CPU102などを駆動するためのクロック信号の上限周波数は、外部電源の電圧に応じて制約される。また、フラッシュメモリ106においては、書込(プログラム)動作は、フローティングゲートへの電荷注入により行われ、消去(イレース)動作は、チャネルへの電圧印加によりフローティングゲートからの電荷引抜きにより行われる。そのため、これらの印加電圧を生成するための外部電源の電圧は重要である。
<D. Operation mode / frequency setting>
Inside the microcomputer 1, various internal clock signals and internal voltages are generated using the supplied external power supply. Therefore, the voltage of the external power source affects the performance of the microcomputer 1. For example, the upper limit frequency of a clock signal for driving the CPU 102 or the like is restricted according to the voltage of the external power supply. In the flash memory 106, the write (program) operation is performed by charge injection to the floating gate, and the erase (erase) operation is performed by extracting the charge from the floating gate by applying a voltage to the channel. For this reason, the voltage of the external power source for generating these applied voltages is important.

そのため、マイクロコンピュータ1は、外部電源の電圧に応じて、CPU102およびフラッシュメモリ106についての動作モードおよび/または動作周波数を設定する。具体的には、以下の表に示すように、複数の動作モードの別に動作電圧範囲を予め規定しておき、検出される外部電源の電圧に応じて、適切な動作モードを設定する。   Therefore, the microcomputer 1 sets an operation mode and / or an operation frequency for the CPU 102 and the flash memory 106 according to the voltage of the external power supply. Specifically, as shown in the following table, an operation voltage range is defined in advance for each of a plurality of operation modes, and an appropriate operation mode is set according to the detected voltage of the external power supply.

Figure 2013101457
Figure 2013101457

上記の表において定義される設定では、主として、外部電源の電圧が2.7Vおよび1.62Vにおいて、動作モードが切り換えられることになる。例えば、外部電源の電圧が3.0Vであれば、動作モード1〜3のいずれについても設定可能であるが、より高速な処理を行うという観点からは、動作モード1が選択される。これに対して、外部電源の電圧が2.5Vであれば、動作モード2および3のみが設定可能となる(但し、動作モード2においてはフラッシュメモリ106に対する読出(リード)動作のみが可能である)。このとき、フラッシュメモリ106に対する書込動作が要求されるのであれば、動作モード3が選択される。   With the settings defined in the above table, the operation mode is switched mainly when the voltage of the external power supply is 2.7 V and 1.62 V. For example, if the voltage of the external power supply is 3.0 V, any of the operation modes 1 to 3 can be set, but the operation mode 1 is selected from the viewpoint of performing higher-speed processing. On the other hand, if the voltage of the external power supply is 2.5 V, only the operation modes 2 and 3 can be set (however, in the operation mode 2, only the read (read) operation to the flash memory 106 is possible. ). At this time, if a write operation to the flash memory 106 is required, the operation mode 3 is selected.

各種クロック信号の動作周波数は、それぞれの動作モードに応じて固定値としてもよいが、外部電源の電圧に応じてさらに変更してもよい。すなわち、前者の場合には、外部電源の電圧に応じて、CPU102およびフラッシュメモリ106についての動作モードのみが設定される。一方、後者の場合には、外部電源の電圧に応じて、CPU102およびフラッシュメモリ106についての動作モードおよび動作周波数が設定されることになる。   The operating frequencies of the various clock signals may be fixed values according to the respective operation modes, but may be further changed according to the voltage of the external power supply. That is, in the former case, only the operation mode for the CPU 102 and the flash memory 106 is set according to the voltage of the external power supply. On the other hand, in the latter case, the operation mode and the operation frequency for the CPU 102 and the flash memory 106 are set according to the voltage of the external power supply.

一例として、動作モードの別に、各種クロック信号の動作周波数を以下のように設定することができる。   As an example, the operating frequencies of various clock signals can be set as follows depending on the operation mode.

Figure 2013101457
Figure 2013101457

このように、動作モードを設定した上で、さらに、マイクロコンピュータ1の各コンポーネントが使用するクロック信号をより詳細に設定することで、外部電源の電圧に応じて、マイクロコンピュータ1の性能を最大限発揮させることができる。   Thus, after setting the operation mode, the clock signal used by each component of the microcomputer 1 is set in more detail, so that the performance of the microcomputer 1 is maximized according to the voltage of the external power supply. It can be demonstrated.

なお、上述のような動作モードを区分することなく、外部電源の電圧に応じて、CPU102およびフラッシュメモリ106についての動作周波数のみを設定するようにしてもよい。   Note that only the operating frequency for the CPU 102 and the flash memory 106 may be set according to the voltage of the external power supply without dividing the above-described operation modes.

図3は、本発明の実施の形態に従うマイクロコンピュータ1におけるクロック信号を発生する回路構成の一例を示す図である。図3を参照して、マイクロコンピュータ1においては、主として、FlashIFクロック(FCLK)、システムクロック(ICLK)、周辺モジュールクロック(PCLKB,PCLKD)、および、外部バスクロック(BCLK)が用いられる。これらのクロック信号は、上述のクロック信号の設定例に対応している。   FIG. 3 shows an example of a circuit configuration for generating a clock signal in microcomputer 1 according to the embodiment of the present invention. Referring to FIG. 3, in microcomputer 1, a FlashIF clock (FCLK), a system clock (ICLK), peripheral module clocks (PCLKB, PCLKD), and an external bus clock (BCLK) are mainly used. These clock signals correspond to the clock signal setting examples described above.

FlashIFクロック(FCLK)は、フラッシュメモリ106に対するアクセス(読出動作、書込動作、消去動作)に用いられるクロック信号である。システムクロック(ICLK)は、内部バス100のデータ伝送やCPU102の駆動に用いられるクロック信号である。周辺モジュールクロック(PCLKB,PCLKD)は、マイクロコンピュータ1の入出力などの周辺モジュール(タイマーユニット、A/D変換ユニット、D/A変換ユニットなど)の駆動に用いられるクロック信号である。外部バスクロック(BCLK)は、マイクロコンピュータ1と外部装置との間でデータを遣り取りするために用いられるクロック信号である。   The Flash IF clock (FCLK) is a clock signal used for access (read operation, write operation, erase operation) to the flash memory 106. The system clock (ICLK) is a clock signal used for data transmission of the internal bus 100 and driving of the CPU 102. The peripheral module clocks (PCLKB, PCLKD) are clock signals used for driving peripheral modules (timer unit, A / D conversion unit, D / A conversion unit, etc.) such as input / output of the microcomputer 1. The external bus clock (BCLK) is a clock signal used for exchanging data between the microcomputer 1 and an external device.

図3を参照して、マイクロコンピュータ1のクロック信号を発生するための構成として、メインクロック発振器1081と、サブクロック発振器1082と、高速クロック発振器1083と、低速クロック信号発振器1084と、セレクタ130,140,144,148,152と、レジスタ132,142,146,150,154と、分周器134とを含む。   Referring to FIG. 3, as a configuration for generating a clock signal of microcomputer 1, main clock oscillator 1081, sub clock oscillator 1082, high speed clock oscillator 1083, low speed clock signal oscillator 1084, and selectors 130 and 140 are provided. , 144, 148, 152, registers 132, 142, 146, 150, 154, and a frequency divider 134.

メインクロック発振器1081、サブクロック発振器1082、高速クロック発振器1083、および、低速クロック信号発振器1084は、それぞれ所定の動作周波数のクロック信号を発生する。セレクタ130は、それぞれの発振器からのクロック信号のうち一つを選択し、分周器134へ出力する。セレクタ130は、レジスタ132に設定される値(CKSEL)に従って、クロック信号を選択する。基本的には、レジスタ132には、選択される動作モードに応じた値が設定される。すなわち、設定される動作モードに応じて、分周器134に入力されるクロック信号の動作周波数が切り換えられる。   The main clock oscillator 1081, the sub clock oscillator 1082, the high speed clock oscillator 1083, and the low speed clock signal oscillator 1084 each generate a clock signal having a predetermined operating frequency. The selector 130 selects one of the clock signals from the respective oscillators and outputs it to the frequency divider 134. The selector 130 selects a clock signal according to a value (CKSEL) set in the register 132. Basically, a value corresponding to the selected operation mode is set in the register 132. That is, the operating frequency of the clock signal input to the frequency divider 134 is switched according to the set operation mode.

分周器134は、入力されるクロック信号をそれぞれ異なる分周比で分周した複数のクロック信号を生成する。それぞれのクロック信号は、並列に配置されたバスによって、セレクタ140,144,148,152へそれぞれ与えられる。   The frequency divider 134 generates a plurality of clock signals obtained by dividing the input clock signal by different frequency division ratios. The respective clock signals are given to the selectors 140, 144, 148, 152 by buses arranged in parallel, respectively.

セレクタ140は、レジスタ142に設定される値(FCK)に従って選択したクロック信号を、FlashIFクロック(FCLK)として出力する。   The selector 140 outputs the clock signal selected according to the value (FCK) set in the register 142 as the FlashIF clock (FCLK).

セレクタ144は、レジスタ146に設定される値(ICK)に従って選択したクロック信号を、システムクロック(ICLK)として出力する。   The selector 144 outputs the clock signal selected according to the value (ICK) set in the register 146 as the system clock (ICLK).

セレクタ148は、レジスタ150に設定される値(PCKB,PCKD)に従ってそれぞれ選択したクロック信号(2種類)を、周辺モジュールクロック(PCLKB,PCLKD)として出力する。   The selector 148 outputs the clock signals (two types) selected according to the values (PCKB, PCKD) set in the register 150 as peripheral module clocks (PCLKB, PCLKD).

セレクタ152は、レジスタ150に設定される値(BCK)に従って選択したクロック信号を、外部バスクロック(BCLK)として出力する。   The selector 152 outputs the clock signal selected according to the value (BCK) set in the register 150 as the external bus clock (BCLK).

上述したように、典型的には、CPU102は、選択した動作モードに応じた値をレジスタ132に設定するとともに、選択した動作周波数に応じたそれぞれの値をレジスタ142,146,150,154に設定する。   As described above, typically, the CPU 102 sets values corresponding to the selected operation mode in the register 132 and sets values corresponding to the selected operation frequency in the registers 142, 146, 150, and 154. To do.

<E.処理手順>
次に、本実施の形態に従うマイクロコンピュータ1において実行される処理手順について説明する。基本的には、上述のCPU102およびフラッシュメモリ106の動作モードおよび/または動作周波数を動作環境に応じた値に設定する処理は、マイクロコンピュータ1の出荷時またはファームウェアのアップデート時に実行される。すなわち、CPU102は、電源投入後の起動時に、CPU102およびフラッシュメモリ106の動作モードおよび/または動作周波数を設定する。
<E. Processing procedure>
Next, a processing procedure executed in microcomputer 1 according to the present embodiment will be described. Basically, the processing for setting the operation mode and / or the operation frequency of the CPU 102 and the flash memory 106 to values according to the operation environment is executed when the microcomputer 1 is shipped or when the firmware is updated. That is, the CPU 102 sets the operation mode and / or the operation frequency of the CPU 102 and the flash memory 106 at the time of startup after power-on.

(e1:設定処理)
図4は、本発明の実施の形態に従うマイクロコンピュータ1における設定処理およびフラッシュメモリへのアクセスの手順を示すフローチャートである。図5および図6は、図4に示す外部電源の電圧検出処理における処理手順を示すフローチャートである。
(E1: Setting process)
FIG. 4 is a flowchart showing a setting process and a procedure for accessing the flash memory in microcomputer 1 according to the embodiment of the present invention. 5 and 6 are flowcharts showing a processing procedure in the voltage detection processing of the external power source shown in FIG.

図4を参照して、マイクロコンピュータ1の電源が投入されると、CPU102は、ブートROM104に格納されているブートローダを実行する(ステップS2)。続いて、CPU102は、CPU102およびフラッシュメモリ106の動作モードおよび動作周波数の設定の実行が要求されているか否かを判断する(ステップS4)。マイクロコンピュータ1に最初に電源が投入される場合や、ファームウェアをアップデートした場合などに、設定処理の実行が要求されることになる。   Referring to FIG. 4, when the microcomputer 1 is turned on, CPU 102 executes a boot loader stored in boot ROM 104 (step S2). Subsequently, the CPU 102 determines whether or not execution of setting of the operation mode and the operation frequency of the CPU 102 and the flash memory 106 is requested (step S4). When the power is first turned on to the microcomputer 1 or when the firmware is updated, execution of the setting process is requested.

動作モードおよび動作周波数の設定の実行が要求されていない場合(ステップS4においてNOの場合)には、ステップS6〜S10の処理はスキップされ、処理はステップS20へ進む。   If execution of the setting of the operation mode and the operation frequency is not requested (NO in step S4), the processes in steps S6 to S10 are skipped, and the process proceeds to step S20.

動作モードおよび動作周波数の設定の実行が要求されている場合(ステップS4においてYESの場合)には、CPU102は、外部電源の電圧検出処理を実行する(ステップS6)。この外部電源の電圧検出処理の詳細については、図5および図6を参照して後述する。   When execution of setting of the operation mode and the operation frequency is requested (YES in step S4), CPU 102 executes voltage detection processing of the external power supply (step S6). Details of the voltage detection processing of the external power supply will be described later with reference to FIGS.

続いて、CPU102は、外部電源の電圧検出処理によって検出される外部電源の電圧に基づいて、CPU102のより好適な動作モードおよび/またはより好適な動作周波数を設定する(ステップS8)。また、CPU102は、外部電源の電圧検出処理によって検出される外部電源の電圧に基づいて、フラッシュメモリ106のより好適な動作モードおよび/またはより好適な動作周波数を設定する(ステップS10)。なお、ステップS8およびS10の処理は、並列的に行ってもよい。   Subsequently, the CPU 102 sets a more preferable operation mode and / or a more preferable operation frequency of the CPU 102 based on the voltage of the external power supply detected by the voltage detection process of the external power supply (step S8). Further, the CPU 102 sets a more preferable operation mode and / or a more preferable operation frequency of the flash memory 106 based on the voltage of the external power supply detected by the voltage detection process of the external power supply (step S10). In addition, you may perform the process of step S8 and S10 in parallel.

以上の処理により、CPU102およびフラッシュメモリ106の動作モードおよび動作周波数の設定は完了する。その後、CPU102は、フラッシュメモリ106へのアクセス要求が発生したか否かを判断する(ステップS20)。フラッシュメモリ106へのアクセス要求が発生していない場合(ステップS20においてNOの場合)には、ステップS20以下の処理が繰返される。   With the above processing, the setting of the operation mode and the operation frequency of the CPU 102 and the flash memory 106 is completed. Thereafter, the CPU 102 determines whether or not an access request to the flash memory 106 has occurred (step S20). If an access request to the flash memory 106 has not occurred (NO in step S20), the processes in and after step S20 are repeated.

フラッシュメモリ106へのアクセス要求が発生した場合(ステップS20においてYESの場合)には、CPU102は、フラッシュメモリ106へのアクセスの種類を判断する(ステップS22)。そして、CPU102は、ステップS22において判断した種類に応じて、消去(イレース)処理、読出(ロード)処理、書込(プログラム)処理、ブランクチェック処理のいずれかを実行する(ステップS24)。そして、ステップS20以下の処理が繰返される。   If an access request to the flash memory 106 is generated (YES in step S20), the CPU 102 determines the type of access to the flash memory 106 (step S22). Then, the CPU 102 executes any one of an erase (erase) process, a read (load) process, a write (program) process, and a blank check process according to the type determined in step S22 (step S24). And the process after step S20 is repeated.

(e2:外部電源の電圧検出処理その1)
外部電源の電圧検出処理の一例として、図2(A)に示す電圧検出部110Aにより外部電源の電圧を検出する処理について説明する。
(E2: External power supply voltage detection process 1)
As an example of the voltage detection process of the external power supply, a process of detecting the voltage of the external power supply by the voltage detection unit 110A illustrated in FIG.

図5を参照して、CPU102は、基準電圧Vrefを最高レベルに設定する(ステップS100)。具体的には、CPU102は、レベル選択用レジスタ1221(図2(A))に基準電圧Vrefを最高レベルに設定するための値を設定する。   Referring to FIG. 5, CPU 102 sets reference voltage Vref to the highest level (step S100). Specifically, the CPU 102 sets a value for setting the reference voltage Vref to the highest level in the level selection register 1221 (FIG. 2A).

続いて、CPU102は、電圧検出部110Aを活性化し(ステップS102)、電圧検出部110Aにおける比較結果(図2(A)の電圧検出信号)を読出す(ステップS104)。そして、CPU102は、検出電圧Vdetが現在の基準電圧Vref以上であるか否かを判断する(ステップS106)。   Subsequently, the CPU 102 activates the voltage detection unit 110A (step S102), and reads the comparison result (voltage detection signal in FIG. 2A) in the voltage detection unit 110A (step S104). Then, the CPU 102 determines whether or not the detected voltage Vdet is equal to or higher than the current reference voltage Vref (step S106).

検出電圧Vdetが現在の基準電圧Vref以上である場合(ステップS106においてYESの場合)には、CPU102は、外部電源の電圧レベルを最高レベル以上であると判定する(ステップS108)。そして、処理は終了する。   When detection voltage Vdet is equal to or higher than current reference voltage Vref (YES in step S106), CPU 102 determines that the voltage level of the external power source is equal to or higher than the maximum level (step S108). Then, the process ends.

検出電圧Vdetが現在の基準電圧Vref未満である場合(ステップS106においてNOの場合)には、CPU102は、基準電圧Vrefを現在のレベルから1段階だけ低いレベルに設定し(ステップS110)、電圧検出部110Aにおける比較結果を読出す(ステップS112)。そして、CPU102は、検出電圧Vdetが現在の基準電圧Vref以上であるか否かを判断する(ステップS118)。   When the detection voltage Vdet is lower than the current reference voltage Vref (NO in step S106), the CPU 102 sets the reference voltage Vref to a level lower by one step from the current level (step S110), and detects the voltage. The comparison result in unit 110A is read (step S112). Then, the CPU 102 determines whether or not the detection voltage Vdet is equal to or higher than the current reference voltage Vref (step S118).

検出電圧Vdetが現在の基準電圧Vref以上である場合(ステップS118においてYESの場合)には、CPU102は、外部電源の電圧レベルを現在の基準電圧Vrefのレベル以上であり、かつ、現在の基準電圧Vrefのレベルより1段階だけ高いレベル未満であると判定する(ステップS120)。そして、処理は終了する。   When the detection voltage Vdet is equal to or higher than the current reference voltage Vref (YES in step S118), the CPU 102 sets the voltage level of the external power supply to be equal to or higher than the current reference voltage Vref and the current reference voltage. It is determined that the level is less than one level higher than the level of Vref (step S120). Then, the process ends.

検出電圧Vdetが現在の基準電圧Vref未満である場合(ステップS118においてNOの場合)には、CPU102は、現在の基準電圧Vrefが最低レベルであるか否かを判断する(ステップS122)。   When the detected voltage Vdet is less than the current reference voltage Vref (NO in step S118), the CPU 102 determines whether or not the current reference voltage Vref is at the lowest level (step S122).

現在の基準電圧Vrefが最低レベルである場合(ステップS122においてYESの場合)には、CPU102は、外部電源の電圧レベルを最低レベル未満であると判定する(ステップS124)。そして、処理は終了する。   If current reference voltage Vref is at the lowest level (YES in step S122), CPU 102 determines that the voltage level of the external power supply is lower than the lowest level (step S124). Then, the process ends.

現在の基準電圧Vrefが最低レベルではない場合(ステップS122においてNOの場合)には、ステップS110以下の処理が実行される。   If the current reference voltage Vref is not at the lowest level (NO in step S122), the processing from step S110 is executed.

(e3:外部電源の電圧検出処理その2)
外部電源の電圧検出処理の別の例として、図2(B)に示す電圧検出部110Bにより外部電源の電圧を検出する処理について説明する。
(E3: External power supply voltage detection process 2)
As another example of the voltage detection process of the external power supply, a process of detecting the voltage of the external power supply by the voltage detection unit 110B illustrated in FIG.

図6を参照して、CPU102は、最低レベルの検出電圧Vdetを選択する(ステップS200)。具体的には、CPU102は、レベル選択用レジスタ1222(図2(B))に最低レベルの検出電圧Vdetを選択するための値を設定する。すなわち、CPU102は、分圧比が最も低くなるように、分圧レベル選択回路1209を駆動する。   Referring to FIG. 6, CPU 102 selects detection voltage Vdet at the lowest level (step S200). Specifically, the CPU 102 sets a value for selecting the lowest level detection voltage Vdet in the level selection register 1222 (FIG. 2B). That is, the CPU 102 drives the voltage division level selection circuit 1209 so that the voltage division ratio is the lowest.

続いて、CPU102は、電圧検出部110Bを活性化し(ステップS202)、電圧検出部110Bにおける比較結果(図2(B)の電圧検出信号)を読出す(ステップS204)。そして、CPU102は、現在の検出電圧Vdetが基準電圧Vref以上であるか否かを判断する(ステップS206)。   Subsequently, the CPU 102 activates the voltage detection unit 110B (step S202), and reads the comparison result (voltage detection signal in FIG. 2B) in the voltage detection unit 110B (step S204). Then, the CPU 102 determines whether or not the current detection voltage Vdet is equal to or higher than the reference voltage Vref (step S206).

現在の検出電圧Vdetが基準電圧Vref以上である場合(ステップS206においてYESの場合)には、CPU102は、外部電源の電圧レベルを最高レベル以上であると判定する(ステップS208)。そして、処理は終了する。   If current detection voltage Vdet is equal to or higher than reference voltage Vref (YES in step S206), CPU 102 determines that the voltage level of the external power supply is equal to or higher than the maximum level (step S208). Then, the process ends.

現在の検出電圧Vdetが基準電圧Vref未満である場合(ステップS206においてNOの場合)には、CPU102は、現在のレベルから1段階だけ高い検出電圧Vdetを選択し(ステップS210)、電圧検出部110Bにおける比較結果を読出す(ステップS212)。そして、CPU102は、現在の検出電圧Vdetが基準電圧Vref以上であるか否かを判断する(ステップS218)。   When current detection voltage Vdet is lower than reference voltage Vref (NO in step S206), CPU 102 selects detection voltage Vdet that is higher by one step from the current level (step S210), and voltage detection unit 110B. The comparison result is read out (step S212). Then, the CPU 102 determines whether or not the current detection voltage Vdet is equal to or higher than the reference voltage Vref (step S218).

現在の検出電圧Vdetが基準電圧Vref以上である場合(ステップS218においてYESの場合)には、CPU102は、外部電源の電圧レベルを、現在の分圧比に対応するレベル以上であり、かつ、現在の分圧比に対応するレベルより1段階だけ高いレベル未満であると判定する(ステップS220)。そして、処理は終了する。   When current detection voltage Vdet is equal to or higher than reference voltage Vref (YES in step S218), CPU 102 sets the voltage level of the external power supply to be equal to or higher than the level corresponding to the current voltage dividing ratio, and It is determined that the level is lower by one level than the level corresponding to the partial pressure ratio (step S220). Then, the process ends.

現在の検出電圧Vdetが基準電圧Vref未満である場合(ステップS218においてNOの場合)には、CPU102は、現在の検出電圧Vdetが最高レベルであるか否かを判断する(ステップS222)。   When current detection voltage Vdet is lower than reference voltage Vref (NO in step S218), CPU 102 determines whether or not current detection voltage Vdet is at the highest level (step S222).

現在の検出電圧Vdetが最高レベルである場合(ステップS222においてYESの場合)には、CPU102は、外部電源の電圧レベルを最低レベル未満であると判定する(ステップS224)。そして、処理は終了する。   When current detection voltage Vdet is the highest level (YES in step S222), CPU 102 determines that the voltage level of the external power supply is lower than the lowest level (step S224). Then, the process ends.

現在の検出電圧Vdetが最高レベルではない場合(ステップS222においてNOの場合)には、ステップS210以下の処理が実行される。   If the current detection voltage Vdet is not at the highest level (NO in step S222), the processing from step S210 is executed.

(e4:変形例)
上述した出荷時/アップデート時に代えて、または、それに加えて、フラッシュメモリ106に対してアクセスする際に、CPU102およびフラッシュメモリ106の動作モードおよび/または動作周波数を動作環境に応じた値に設定する処理を行ってもよい。すなわち、CPU102は、フラッシュメモリ106へのアクセスが要求されたことに応答して、CPU102およびフラッシュメモリ106の動作モードおよび/または動作周波数を設定する。
(E4: Modification)
In place of, or in addition to, the above-mentioned shipment / update time, when the flash memory 106 is accessed, the operation mode and / or the operation frequency of the CPU 102 and the flash memory 106 are set to values according to the operation environment. Processing may be performed. That is, the CPU 102 sets the operation mode and / or operation frequency of the CPU 102 and the flash memory 106 in response to a request for access to the flash memory 106.

図7は、本発明の実施の形態に従うマイクロコンピュータ1における設定処理およびフラッシュメモリへのアクセスの手順の変形例を示すフローチャートである。   FIG. 7 is a flowchart showing a modification of the procedure of the setting process and the access to the flash memory in microcomputer 1 according to the embodiment of the present invention.

図7を参照して、マイクロコンピュータ1の電源が投入されると、CPU102は、ブートROM104に格納されているブートローダを実行する(ステップS52)。   Referring to FIG. 7, when the microcomputer 1 is powered on, CPU 102 executes a boot loader stored in boot ROM 104 (step S52).

続いて、CPU102は、フラッシュメモリ106へのアクセス要求が発生したか否かを判断する(ステップS54)。フラッシュメモリ106へのアクセス要求が発生していない場合(ステップS54においてNOの場合)には、ステップS54以下の処理が繰返される。   Subsequently, the CPU 102 determines whether or not an access request to the flash memory 106 has occurred (step S54). If an access request to the flash memory 106 has not occurred (NO in step S54), the processes in and after step S54 are repeated.

フラッシュメモリ106へのアクセス要求が発生した場合(ステップS54においてYESの場合)には、CPU102は、CPU102およびフラッシュメモリ106の動作モードおよび動作周波数を設定する。すなわち、まず、CPU102は、外部電源の電圧検出処理を実行する(ステップS56)。続いて、CPU102は、外部電源の電圧検出処理によって検出される外部電源の電圧に基づいて、CPU102のより好適な動作モードおよび/またはより好適な動作周波数を設定する(ステップS58)。また、CPU102は、外部電源の電圧検出処理によって検出される外部電源の電圧に基づいて、フラッシュメモリ106のより好適な動作モードおよび/またはより好適な動作周波数を設定する(ステップS60)。なお、ステップS58およびS60の処理は、並列的に行ってもよい。   When an access request to the flash memory 106 is generated (YES in step S54), the CPU 102 sets the operation mode and the operation frequency of the CPU 102 and the flash memory 106. That is, first, the CPU 102 executes a voltage detection process for the external power supply (step S56). Subsequently, the CPU 102 sets a more preferable operation mode and / or a more preferable operation frequency of the CPU 102 based on the voltage of the external power supply detected by the voltage detection process of the external power supply (step S58). Further, the CPU 102 sets a more preferable operation mode and / or a more preferable operation frequency of the flash memory 106 based on the voltage of the external power supply detected by the voltage detection process of the external power supply (step S60). In addition, you may perform the process of step S58 and S60 in parallel.

その後、CPU102は、フラッシュメモリ106へのアクセスの種類を判断する(ステップS62)。そして、CPU102は、ステップS52において判断した種類に応じて、消去(イレース)処理、読出(ロード)処理、書込(プログラム)処理、ブランクチェック処理のいずれかを実行する(ステップS64)。そして、ステップS54以下の処理が繰返される。   Thereafter, the CPU 102 determines the type of access to the flash memory 106 (step S62). Then, the CPU 102 executes any one of an erase (erase) process, a read (load) process, a write (program) process, and a blank check process according to the type determined in step S52 (step S64). And the process after step S54 is repeated.

<F.まとめ>
本実施の形態によれば、フラッシュメモリの書き換えなどが必要な場合に、マイクロコンピュータに供給されている外部電源の電圧を検出することにより、好適な動作モードや動作周波数が自動的に設定される。そのため、従来のように、ユーザが誤って電圧情報(ターゲット電圧)を入力しまうことで、マイクロコンピュータが誤動作することを防止できる。これにより、外部電源の電圧に応じて、マイクロコンピュータの動作により好適なCPUおよびフラッシュメモリの動作モードや動作周波数の設定が可能となり、フラッシュメモリの書き換え時間の短縮を実現できる。
<F. Summary>
According to the present embodiment, when the flash memory needs to be rewritten, a suitable operation mode and operation frequency are automatically set by detecting the voltage of the external power supply supplied to the microcomputer. . Therefore, it is possible to prevent the microcomputer from malfunctioning when the user erroneously inputs voltage information (target voltage) as in the prior art. As a result, it is possible to set the operation mode and the operation frequency of the CPU and the flash memory more suitable for the operation of the microcomputer in accordance with the voltage of the external power supply, and the flash memory rewriting time can be shortened.

今回開示された実施の形態はすべての点で例示であって制限的なものではないと考えられるべきである。本発明の範囲は上記した説明ではなくて特許請求の範囲によって示され、特許請求の範囲と均等の意味および範囲内でのすべての変更が含まれることが意図される。   The embodiment disclosed this time should be considered as illustrative in all points and not restrictive. The scope of the present invention is defined by the terms of the claims, rather than the description above, and is intended to include any modifications within the scope and meaning equivalent to the terms of the claims.

1 マイクロコンピュータ、100 内部バス、102 CPU、104 ROM、106 フラッシュメモリ、108 クロック発生回路、110,110A,110B 電圧検出部、120,120A,120B 比較用処理回路、122 比較切換用レジスタ、124 比較器、126 比較結果格納レジスタ、130,140,144,148,152 セレクタ、132,142,146,150,154 レジスタ、134 分周器、1081 メインクロック発振器、1082 サブクロック発振器、1083 高速クロック発振器、1084 低速クロック信号発振器、1201,1202,1205,1206,1207,1208 分圧抵抗、1203,N1,N2,N3 ノード、1204 レベル選択回路、1209 分圧レベル選択回路、1221,1222 レベル選択用レジスタ、GND グランド。   1 microcomputer, 100 internal bus, 102 CPU, 104 ROM, 106 flash memory, 108 clock generation circuit, 110, 110A, 110B voltage detection unit, 120, 120A, 120B comparison processing circuit, 122 comparison switching register, 124 comparison 126, comparison result storage register, 130, 140, 144, 148, 152 selector, 132, 142, 146, 150, 154 register, 134 frequency divider, 1081 main clock oscillator, 1082 subclock oscillator, 1083 high-speed clock oscillator, 1084 Low-speed clock signal oscillator, 1201, 1202, 1205, 1206, 1207, 1208 voltage dividing resistor, 1203, N1, N2, N3 node, 1204 level selection circuit, 1209 voltage dividing level択回 path, 1221 and 1222 level selection register, GND Ground.

Claims (5)

プロセッサと、
前記プロセッサによるアクセスが可能な不揮発性メモリと、
少なくとも前記プロセッサおよび前記不揮発性メモリを駆動するための外部電源の電圧を検出する電圧検出部とを備え、
前記プロセッサは、命令群を実行することで、前記電圧検出部によって検出された電圧に応じて、前記プロセッサおよび前記不揮発性メモリの少なくとも一方についての動作モードおよび/または動作周波数を設定する、半導体装置。
A processor;
A non-volatile memory accessible by the processor;
A voltage detection unit for detecting a voltage of an external power source for driving at least the processor and the nonvolatile memory;
The processor executes an instruction group to set an operation mode and / or an operation frequency for at least one of the processor and the non-volatile memory according to a voltage detected by the voltage detection unit. .
前記プロセッサは、電源投入後の起動時に、前記プロセッサおよび前記不揮発性メモリの少なくとも一方についての動作モードおよび/または動作周波数を設定する、請求項1に記載の半導体装置。   The semiconductor device according to claim 1, wherein the processor sets an operation mode and / or an operation frequency for at least one of the processor and the non-volatile memory at startup after power-on. 前記プロセッサは、前記不揮発性メモリへのアクセスが要求されたことに応答して、前記プロセッサおよび前記不揮発性メモリの少なくとも一方についての動作モードおよび/または動作周波数を設定する、請求項1または2に記載の半導体装置。   The processor according to claim 1 or 2, wherein the processor sets an operation mode and / or an operation frequency for at least one of the processor and the nonvolatile memory in response to a request for access to the nonvolatile memory. The semiconductor device described. 前記電圧検出部は、
前記外部電源を所定比率で分圧した電圧と予め定められた基準電圧と比較する比較回路と、
前記基準電圧の大きさを複数種類に切り替える基準電圧発生回路と、
前記比較回路における比較結果と前記基準電圧発生回路から出力される前記基準電圧とに基づいて、前記外部電源の電圧を判定する判定回路とを含む、請求項1〜3のいずれか1項に記載の半導体装置。
The voltage detector is
A comparison circuit that compares a voltage obtained by dividing the external power supply by a predetermined ratio with a predetermined reference voltage;
A reference voltage generating circuit for switching the reference voltage to a plurality of types;
The determination circuit which determines the voltage of the said external power supply based on the comparison result in the said comparison circuit, and the said reference voltage output from the said reference voltage generation circuit, The control circuit of any one of Claims 1-3 Semiconductor device.
前記電圧検出部は、
前記外部電源を分圧して複数段階の分圧電圧を出力する分圧回路と、
前記分圧回路により出力される分圧電圧を予め定められた基準電圧と比較する比較回路と、
前記分圧回路から出力される分圧電圧と前記比較回路における比較結果とに基づいて、前記外部電源の電圧を判定する判定回路とを含む、請求項1〜3のいずれか1項に記載の半導体装置。
The voltage detector is
A voltage dividing circuit that divides the external power source and outputs a divided voltage of a plurality of stages;
A comparison circuit that compares the divided voltage output by the voltage dividing circuit with a predetermined reference voltage;
The determination circuit according to claim 1, further comprising: a determination circuit that determines a voltage of the external power source based on a divided voltage output from the voltage dividing circuit and a comparison result in the comparison circuit. Semiconductor device.
JP2011244291A 2011-11-08 2011-11-08 Semiconductor device Pending JP2013101457A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2011244291A JP2013101457A (en) 2011-11-08 2011-11-08 Semiconductor device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2011244291A JP2013101457A (en) 2011-11-08 2011-11-08 Semiconductor device

Publications (1)

Publication Number Publication Date
JP2013101457A true JP2013101457A (en) 2013-05-23

Family

ID=48622033

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2011244291A Pending JP2013101457A (en) 2011-11-08 2011-11-08 Semiconductor device

Country Status (1)

Country Link
JP (1) JP2013101457A (en)

Similar Documents

Publication Publication Date Title
US20200218446A1 (en) Method and apparatus for memory management
US20210271412A1 (en) Storage device and method of operating the storage device
US7684246B2 (en) Flash memory device having pump with multiple output voltages
JP2012513652A (en) Pre-characterization of flash memory timing
KR100914265B1 (en) Nonvolatile memory device, memory system thereof, and reading method thereof
US20120236672A1 (en) High voltage generating circuit and method of operating the same
CN111399752B (en) Control device and method for different types of storage units
CN103093831A (en) Built-in self trim for non-volatile memory reference current
US8339889B2 (en) Semiconductor memory device
JP5931236B1 (en) Semiconductor device control circuit and method, and semiconductor device
US9454437B2 (en) Non-volatile logic based processing device
US10324627B2 (en) Memory system and operation method thereof
JP2013101457A (en) Semiconductor device
JP6495160B2 (en) Semiconductor integrated circuit
WO2020223849A1 (en) Memory control system with a sequence processing unit
JP5385220B2 (en) Nonvolatile memory, data processing apparatus, and microcomputer application system
US11237739B2 (en) Memory system
KR100970933B1 (en) Apparatus and method for high speed booting an operating system
US20190369906A1 (en) Semiconductor device
JP2004253031A (en) Semiconductor integrated circuit and its test method
KR20050079534A (en) Apparatus for cache program and method of cache programming