JP3669625B2 - Data processing system and method of operating data processing system - Google Patents
Data processing system and method of operating data processing system Download PDFInfo
- Publication number
- JP3669625B2 JP3669625B2 JP2001116270A JP2001116270A JP3669625B2 JP 3669625 B2 JP3669625 B2 JP 3669625B2 JP 2001116270 A JP2001116270 A JP 2001116270A JP 2001116270 A JP2001116270 A JP 2001116270A JP 3669625 B2 JP3669625 B2 JP 3669625B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- memory
- mode
- address
- program
- 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.)
- Expired - Fee Related
Links
Images
Landscapes
- Microcomputers (AREA)
- Stored Programmes (AREA)
Description
【0001】
【発明の属する技術分野】
本発明は、データ処理装置とされるシングルチップ・マイクロコンピュータに内蔵されたプログラムメモリのオンボード書込み技術に関し、例えば、一括消去型の電気的に消去可能な及びプログラム可能な不揮発性記憶装置(以下単に、フラッシュ型EEPROM、又は、フラッシュメモリとも称する。)をプログラムメモリとして備えたシングルチップ・マイクロコンピュータに適用して有効な技術に関する。
【0002】
【従来の技術】
データ処理装置としてのシングルチップ・マイクロコンピュータ(単にマイクロコンピュータとも称する)は、動作プログラムを記憶するプログラムメモリを内蔵する。シングルチップ・マイクロコンピュータは、上記内蔵プログラムメモリに記憶される動作プログラムに規定される所定のデータ処理を実行する。
【0003】
上記プログラムメモリは、マスク型不揮発性記憶装置(以下、マスク型リード・オンリ・メモリ又はマスクROMと称する)や電気的にプログラム可能な不揮発性記憶装置(以下単にEPROMと称する)で形成されてきた。しかし、近年では、一括消去型の電気的に消去可能な及びプログラム可能な不揮発性記憶装置(以下単にフラッシュ型EEPROM、又は、フラッシュメモリとも称する)がプログラムメモリに適用される様になってきた。
【0004】
フラッシュメモリは、一旦書き込んだデータを電気的に消去したり或いは電気的に書き換えたりすることが可能である。そのため、プログラムメモリとしてフラッシュメモリを内蔵するマイクロコンピュータは、例えば、以下の利点を有する。
【0005】
ユーザーの開発するソフトウェアプログラム(アプリケーションソフト)の確定は、一般的に遅れやすい傾向にある。従って、ソフトウェアプログラムの確定前に、マイクロコンピュータ応用システムのハードウェアを組立て、その後、マイクロコンピュータ内のフラッシュメモリへ開発されたソフトウェアプログラムを書込む事ができる。それによって、マイクロコンピュータ応用システムの出荷が迅速化できる。
【0006】
さらに、一度出荷した応用システムのソフトウェアに関し、仕様の変更されたソフトウェアの開発や機能の追加されたソフトウェア(アップグレード版或いはバージョンアップされたソフトウェアなど)の開発が行われたとき、一度出荷した応用システムのソフトウェアをユーザ側で上記新規に開発したソフトウェアへ書換えることができる。
【0007】
すなわち、プログラムメモリとしてフラッシュメモリを内蔵するマイクロコンピュータにおいて、マイクロコンピュータをプリント基板、実装基板又はシステム基板上へ実装した後、上記フラッシュメモリ内へ動作プログラムを書きこむための処理が可能とされる。本明細書において、フラッシュメモリを内蔵するマイクロコンピュータをプリント基板、実装基板又はシステム基板上へ実装した状態で、内蔵フラッシュメモリへデータを書き込むような処理を「オンボード書込み処理」と称し、この書き込みモードを「オンボード書込みモード」と称する。
【0008】
オンボード書込みモードには、幾つかの方式が考えられる。それらを大きく分類すると、以下の2通りに分類される。
【0009】
第1方式は、ユーザープログラムモード又はブートモードとされる。これらのモードは、マイクロコンピュータに内蔵される中央処理装置(CPU)のプログラム実行の流れを、オンボード書込み処理へ分岐し、フラッシュメモリのデータを中央処理装置で変更する方式とされる。
【0010】
第2方式は、ROMライタを利用した書き込みモードとされる。このモードは、マイクロコンピュータを停止して、外部的な手段(ROMライタ)でフラッシュメモリのデータの変更を実現する方式とされる。
【0011】
特開平6−180664号公報は、フラッシュメモリの書き換え時、異常処理プログラムを別の領域へ移し、書き換え時の異常に対応するようにしたシステムを開示している。
【0012】
【発明が解決しようとする課題】
上記第1方式において、内蔵フラッシュメモリの記憶内容自体が書換えの対象とされるため、内蔵RAM(ランダム・アクセス・メモリ)などのフラッシュメモリ以外のメモリに存在する書き込み制御プログラムを中央処理装置(CPU)で実行し、フラッシュメモリの消去又は書込みを行うようにしている。
【0013】
上記第1方式における上記フラッシュメモリの消去又は書込み状態において、マイクロコンピュータの本来の機能は失われない。そのため、マイクロコンピュータの外部から供給された信号入力に起因して、中央処理装置(CPU)に対する割込みが誤って発生したり、或いは、書き込み制御プログラムの実行中にアドレスエラーが生じたりする場合がある。また、NMI(ノンマスカブル割り込み)は、割り込み自体を禁止できないので、意図しないNMIが上記第1方式におけるフラッシュメモリの書き込み又は消去中に発生する可能性がある。NMIでなくとも、誤って割り込みを許可状態にし、同様の状態となる可能性がある。
【0014】
一般的には、割込みの発生やアドレスエラーの発生が生じた場合、割込み処理ルーチン或いは例外処理ルーチンへ中央処理装置の処理が分岐される。中央処理装置の処理を割込み処理ルーチン或いは例外処理ルーチンへ分岐させる為に利用されるのが、割込み処理ルーチン或いは例外処理ルーチンの先頭アドレスを示すベクタアドレスである。割込みの発生や例外処理の発生が起きた場合、対応する割込み処理ルーチン或いは例外処理ルーチンのベクタアドレスが中央処理装置によって取得される。そして、その取得されたベクタアドレスは中央処理装置のプログラムカウンタに書き込まれ、中央処理装置のプログラムフローがベクタアドレスの示すアドレスへジャンプすることで、対応する割込み処理或いは例外処理が実行される。
【0015】
ここで注意すべき事項は以下の事項である事が発明者の検討によって明らかとされた。
【0016】
すなわち、一般的に、複数のベクタアドレスは、プログラムメモリ内のベクタアドレス格納領域内に記憶される。フラッシュメモリがプログラムメモリとされる場合においてもそれに関しては同様であり、複数のベクタアドレスはフラッシュメモリ内のベクタアドレス格納領域内に格納される。
【0017】
ところが、フラッシュメモリがプログラムメモリとされ、かつ、上記フラッシュメモリに対してユーザープログラムモード又はブートモードでの消去又は書込みが実行されている時、割込みの発生や例外処理の発生が生じた場合、中央処理装置はフラッシュメモリ内のベクタアドレス格納領域内に格納される所望のベクタアドレスを取得できない。
【0018】
すなわち、フラッシュメモリのユーザープログラムモード又はブートモードでの消去又は書込みのための書き換え制御プログラムがフラッシュメモリ以外のメモリ(例えば、RAM)に存在するにもかかわらず、ベクタアドレスがプログラムメモリ内に存在する。そのため、プログラムメモリであるフラッシュメモリに対する消去処理又は書込み処理中においては、正しいベクタアドレスが得られない。その結果、プログラムメモリのユーザープログラムモード又はブートモード時において、割込みの発生や例外処理の発生が生じた場合、マイクロコンピュータの暴走、さらには応用システムの破損の危険がある事が解った。また、マイクロコンピュータが暴走し、フラッシュメモリの過消去・過書き込み等が発生すると、そのマイクロコンピュータ応用システムの再生が不可能になる場合もある。一方、電源電位の低下等の異常事態は、NMI等の割り込みで検出するのが一般的な手段である。
【0019】
なお、フラッシュメモリに対する消去処理又は書込み処理は、消去ベリファイ動作及び書き込みベリファイ動作を含むものとみなされる。
【0020】
フラッシュメモリをプログラムメモリとして内蔵するマイクロコンピュータにおいては、応用システムのハードウェアの組立後、ユーザ側が内蔵フラッシュメモリへソフトウェアを書込んだり、一度出荷した応用システムの内蔵フラッシュメモリのソフトウェアを書換え可能である。そのため、フラッシュメモリをマイクロコンピュータに内蔵することの利点は多い。しかし、内蔵フラッシュメモリのユーザープログラムモード又はブートモードでのオンボード書込みモード中における割込みの発生や例外処理の発生は、マイクロコンピュータの暴走や応用システムの破損の危険の原因となる事が明らかになった。
【0021】
本発明の目的は、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることにある。
【0022】
本発明の他の目的は、電気的に消去可能な及びプログラム可能な不揮発性記憶装置をプログラムメモリとして含むデータ処理装置において、上記プログラムメモリのオンボード書込み時に割込み処理或いは例外処理の要求がされた場合であっても、暴走や破損の危険を防止可能にすることにある。
【0023】
本発明のさらに他の目的は、フラッシュメモリをプログラムメモリとして含むマイクロコンピュータであって、上記プログラムメモリのオンボード書込み又は消去時に割込み処理或いは例外処理の要求がされた場合、その要求に応答可能なマイクロコンピュータのようなデータ処理装置を提供することにある。
【0024】
本発明のさらに別の目的は、フラッシュメモリをプログラムメモリとして含むシングルチップマイクロコンピュータであって、上記プログラムメモリの書込み又は消去時に割込み処理或いは例外処理の要求がされた場合、中央処理装置が対応する割込み処理或いは例外処理に関係するベクタアドレスを取得可能に構成されたシングルチップマイクロコンピュータのようなデータ処理装置を提供することにある。
【0025】
本発明の前記並びにその他の目的と新規な特徴は本明細書の記述及び添付図面から明らかになるであろう。
【0026】
【課題を解決するための手段】
本願において開示される発明のうち代表的なものの概要を簡単に説明すれば下記の通りである。
【0027】
データ処理装置は、電気的に消去又は書込みが可能なプログラムメモリ(18)と、上記プログラムメモリ(18)をアクセス可能な中央処理装置(12)と、上記プログラムメモリの消去又は書込み中の割込み発生或いは例外処理の発生に起因する誤動作を排除するための誤動作排除手段とを含む。
【0028】
上記誤動作排除手段は、以下の構成を含む事ができる。
【0029】
〔1〕図6に示されるように、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間、上記中央処理装置(12)に対する割込み要求或いは例外処理要求を排除もしくは無効化するための第1制御論理回路(G5)が上記データ処理装置に設けられる。
【0030】
したがって、ユーザープログラムモード又はブートモードで上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間において、上記第1制御論理回路(G5)は上記中央処理装置(12)に対する割込み要求或いは例外処理要求を排除もしくは無効化するので、上記中央処理装置(12)は、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間、割込み要求或いは例外処理要求に対応するベクタアドレスの取得動作を実行しない。このことが、プログラムメモリ(18)のオンボード書込みの際のシステムの安全性の向上を達成する。これによって、意図しない割り込み要求の発生を禁止できる。
【0031】
〔2〕図7に示されるように、ユーザープログラムモード又はブートモードで上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間、上記中央処理装置(12)に対する割込み要求或いは例外処理要求に応答して、上記プログラムメモリ(18)に対する消去処理又は書込み処理を中止させる為の第2制御論理回路(G6)が上記データ処理装置に設けられる。
【0032】
すなわち、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間において、上記第2制御論理回路(G6)は、上記中央処理装置(12)に対する割込み要求或いは例外処理要求に応答し、上記プログラムメモリ(18)に対する消去処理又は書込み処理を中止させる。具体的には、上記第2制御論理回路(G6)は、上記プログラムメモリ(18)に設けられた動作制御レジスタの消去制御ビット(32)、書き込み制御ビット(33)、ベリファイ制御ビット(34)等の制御ビットのデータを活性化状態から非活性化状態へ変更する。
【0033】
したがって、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間に上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した時、上記第2制御論理回路(G6)は上記プログラムメモリ(18)に対する消去処理又は書込み処理を中止させる。このような割り込みの発生は書き込み及び消去制御プログラムのプログラミングミスや停電などの非常事態の原因であることもある。そこで、上記プログラムメモリ(18)に対する消去処理又は書込み処理を中止させる事で、フラッシュメモリの過消去・過書き込みの発生が防止される。また、その後上記中央処理装置(12)は、上記プログラムメモリ(18)から上記割込み要求或いは例外処理要求に対応するベクタアドレスを取得する事ができる。以上により、プログラムメモリ(18)のオンボード書込みの際のシステムの安全性の向上が達成する。
【0034】
〔3〕図3及び図5に示されるように、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間に上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した時、上記プログラムメモリ(18)のベクタアドレス格納領域のアクセスを禁止し、上記プログラムメモリ(18)以外のメモリ、例えば、ランダムアクセスメモリ(13)の所定領域をアクセスできるように、メモリ選択動作を上記プログラムメモリ(18)から上記プログラムメモリ(18)以外のメモリへ変更させる選択メモリ変更手段(G1、G2、G4)がデータ処理装置に設けられる。なお、上記選択メモリ変更手段(G1、G2、G4)はバスコントローラ(27)に設けることができる。
【0035】
この場合、上記プログラムメモリ(18)以外のメモリの所定領域には、予め、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間において上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した時に処理すべき割り込み処理又は例外処理のためのベクタアドレスデータが格納されている。そして、上記所定記憶領域に格納されたベクタアドレスデータは、上記プログラムメモリ(18)以外のメモリの他の記憶領域に格納された所定割込み処理ルーチン或いは例外処理ルーチンの先頭アドレスを示すように設定される。
【0036】
〔3・1〕上記〔3〕において、上記選択メモリ変更手段(G1,G2)は、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間に上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した時、上記プログラムメモリ(18)のベクタアドレス格納領域のアクセスの検出に応答し、上記プログラムメモリ(18)の選択信号を不活性化する。その代わり、上記選択メモリ変更手段(G1,G2)は、上記プログラムメモリ(18)以外のメモリ(13)の選択信号を活性化する。
【0037】
〔3・2〕上記〔3〕において、上記選択メモリ変更手段(G4)は、上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間に上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した時、上記プログラムメモリ(18)のベクタアドレス格納領域のアクセスの検出に応答し、上記プログラムメモリ(18)のベクタアドレス格納領域をアクセスするためのアドレス信号を上記プログラムメモリ(18)以外のメモリ、例えば、ランダムアクセスメモリ(13)の所定記憶領域をアクセスするアドレス信号へ変換する。
【0038】
上記〔3・1〕及び上記〔3・2〕の様に構成することにより、ユーザープログラムモード又はブートモードで上記プログラムメモリ(18)の消去処理又は書込み処理が行われている期間において上記中央処理装置(12)に対する割込み要求或いは例外処理要求が発生した場合であっても、上記中央処理装置(12)は対応する割込み処理ルーチン或いは例外処理ルーチンに関するベクタアドレスを上記プログラムメモリ(18)以外のメモリの他の記憶領域をアクセスすることによって取得できる。従って、NMI割り込みを使用して、停電による電源電圧Vccの低下等の非常事態をマイクロコンピュータに通知し、上記プログラムメモリ(18)に対する消去処理又は書込み処理を中止させる事で、フラッシュメモリの過消去・過書き込みの発生が防止される。この場合、NMIに対する割り込み処理ルーチンの中で、消去処理又は書込み処理の中止状態を記録する処理を実行し、フラッシュメモリを過消去・過書き込みや中間状態等の異常状態から保護できる。このことが、プログラムメモリ(18)のオンボード書込みの際のシステムの安全性の向上を達成する。
【0039】
【発明の実施の形態】
図1は、本発明にしたがうデータ処理装置としてのシングルチップ・マイクロコンピュータ30を示している。特に制限されないが、シングルチップ・マイクロコンピュータ30は、単結晶シリコン基板などの一つの半導体基板(半導体チップ)上に形成される。
【0040】
図1に示されるように、シングルチップ・マイクロコンピュータ30は、特に制限されないが、割込み制御回路10、クロック発振器11、中央処理装置(CPU)12、内蔵ランダム・アクセス・メモリ(RAM)13、ホストインタフェース回路14、シリアル通信回路とされるシリアルコミュニケーションインタフェース回路15、10ビットのアナログ・デジィタル変換回路(A/D変換器)16、8ビットのデジィタル・アナログ変換回路(D/A変換器)17、プログラムメモリとれる内蔵リード・オンリ・メモリ(ROM)18、ウォッチドッグタイマ回路19、16ビットのフリーランニングタイマ回路20、8ビットのタイマ回路21、パルス幅変調のために利用されるPWMタイマ回路22、及び複数の信号入力、信号出力又は信号入出力に利用されるポートP1〜P9を含む。
【0041】
これらの回路モジュール(10、12〜22、P1〜P9)がアドレスバス24及びデータバス26によって結合され、中央処理装置12がアドレスバス24及びデータバス25、26を用いて回路モジュール(12〜22、P1〜P9)をアクセスできるようにされる。
【0042】
中央処理装置12が回路モジュール(12〜22、P1〜P9)の何れかをアクセスする場合、中央処理装置12はアクセスの対象とされる回路モジュールに割り当てられたアドレスを選択するためのアドレス信号を上記アドレスバス24へ発生する。この時、データリードモードであるなら、アクセスの対象とされる回路モジュールはデータバス25、26にデータを出力し、上記中央処理装置12はデータバス26を介してそのデータを取り込む。一方、データライトモードであるなら、上記中央処理装置12はデータバス25、26へ所望のデータを出力し、上記アクセスの対象とされる回路モジュールはデータバス25、26を介してそのデータを取り込む。
【0043】
次に、上記各回路ブロック(10〜22)の機能が説明される。
【0044】
クロック発振器11は、特に制限されないが、水晶振動子を利用して発振する発振器と、この発振器の出力パルスのデューティを補正するデューティ補正回路と、上記デューティ補正回路からのシステムクロック信号を分周することによって内蔵周辺モジュール(12〜22)の為の内蔵周辺モジュールクロック信号を形成するクロック分周器と、上記クロック分周器からの上記内蔵周辺モジュール用クロック信号を分周して内部クロック信号を生成するためのプリスケーラとを含む。クロック発振器11で発生された所定周波数のシステムクロックに同期して、各回路モジュール(10、12〜22)が動作される。
【0045】
CPU12は、特に制限されないが、処理すべきプログラム内に定義された命令が格納される命令レジスタ(IR)、上記命令レジスタに格納された命令をデコードする命令デコーダ(IDEC)、上記命令デコーダから出力される制御信号に従ってその動作が制御される命令実行部(IEXE)とを含む。上記命令実行部(IEXE)は、算術演算や論理演算を実行する算術論理演算器(ALU)、8ビット×16本の汎用レジスタ(R0−R15)、プログラム内の次に実行されるべき命令の命令アドレスに関するデータを格納するプログラムカウンタ(PC)等を有する。プログラムカウンタ(PC)内のデータは、命令が上記命令実行部(IEXE)によって実行される毎に、インクリメントされる。上記命令実行部(IEXE)は、クロック発振器11から出力されるシステムクロックをタイムベースとして、所定の演算処理、及び各内蔵周辺モジュール(12〜22)の動作制御を行う。なお、上記命令レジスタ(IR)、命令デコーダ(IDEC)、命令実行部(IEXE)、算術論理演算器(ALU)、汎用レジスタ(R0−R15)乃至プログラムカウンタ(PC)は、図面の簡素化のため、上記図1には描かれていない。
【0046】
上記汎用レジスタの1つは、割り込み発生時或いは例外発生時のスタックポインタとして利用される。すなわち、割り込み発生時或いは例外発生時、その時点における上記汎用レジスタに格納されていたデータを、例えば、所定の外部記憶装置へ待避させることが行われる。この場合、スタックポインタは、待避されたデータのアドレスを示すアドレスデータを格納する。割り込み処理或いは例外処理からの復帰時、上記スタックポインタに格納されるアドレスデータを利用して、その割り込み処理或いは例外処理が受け付けられた時に上記外部記憶装置へ待避されたところの汎用レジスタの内容が汎用レジスタ内に回復される。なお、上記システムクロックのある立上がりエッジから次の立上がりエッジまでの1単位が1ステートとされるとき、CPU12のメモリサイクル又はバスサイクルは、例えば、2ステート又は3ステートで構成される。言い換えると、CPU12は、システムクロックの2周期又は3周期で、上記内蔵周辺モジュール(12〜22)をアクセスすることができるように設計される。
【0047】
内蔵RAM13は、特に制限されないが、1kバイトの記憶容量を有するスタティック型RAMとされる。内蔵RAM13は、アドレスバス24及びそれぞれ8ビット幅のデータバス25,26によってCPU12へ結合される。その結果、内蔵RAM13は、バイトデータ(8ビットのデータ)、ワードデータ(16ビットのデータ)にかかわらず、2ステートのメモリアクセスサイクル一回で、バイトデータ及びワードデータの入力及び出力が可能にされている。
【0048】
ホストインタフェース回路14は、CPU12とホストシステムとの2チャンネルのパラレルインタフェース機能を有し、特に制限されないが、4バイトのデータレジスタ、高速ゲートロジックや、割込み要求回路などを含む。ホストシステムからの5つのコントロール信号、ホストシステムへの4つの出力信号、及びコマンド又はデータ入出力バスとしての8ビット幅のデータバス25を介してホストシステムとの通信が可能とされる。
【0049】
シリアルコミュニケーションインタフェース回路15は、他のLSIとの間でシリアルデータの通信を行うためのモジュールで、調歩同期式モードによる通信と、クロック同期式モードによる通信との選択が可能とされる。動作モードの指定や、データフォーマットの指定、ビットレートの設定及び送受信制御のための複数のコントロールレジスタと、送受信のコントロール回路、及びバスインタフェースなどを含む。
【0050】
A/D変換器16は、特に制限されないが、逐次変換方式により、入力アナログ信号をディジタル信号に変換するためのもので、特に制限されないが、最大8チャンネルのアナログ入力を選択することができる。
【0051】
D/A変換器17は、データバス25を介して入力されたディジタル信号をアナログ信号に変換する機能を有し、各種レジスタや、8ビットD/A変換部、及びコントロール回路を含む。
【0052】
ウォッチドッグタイマ19は、システムの監視を行うものである。システムの暴走などにより、ウォッチドッグタイマ19内のタイマカウンタの値が書換えられずにオーバーフローすると、ウォッチドッグタイマ19はCPU12に対してリセット信号又はNMI(ノンマスカブル割込み)要求を発生する。また、この機能を利用しない場合には、ウォッチドッグタイマ19内のタイマカウンタはインターバルタイマとしても使用可能である。
【0053】
16ビットフリーランニングタイマ20は、特に制限されないが、16ビットフリーランニングカウンタをベースにして2種類の独立した波形出力が可能とされ、また、入力パルスの幅や、外部クロックの周期を測定することができる。
【0054】
8ビットタイマ21は2チャンネル設けられ、それぞれタイマカウンタの他に、8ビットのタイムコンスタントレジスタが設けられる。それにより、任意のデューティ比のパルス信号の出力が可能とされる。
【0055】
PWMタイマ22は、2チャンネル設けられ、各チャンネル毎に、8ビットタイマカウンタと8ビットデューティレジスタがあり、この8ビットデューティレジスタに設定する値によって0〜100%のデューティパルスを得ることができるようになっている。
【0056】
割込み制御回路10は、外部割込み要求信号とされるNMI(ノンマスカブル割込み)やIRQ0−IRQ2、上記周辺モジュール15〜22から供給される図示されていない内部割込み要求を受け、所定の優先順位に従って処理するための機能を有し、この割込み要求処理結果に基づいて、割込み例外処理要求信号IRQSがCPU12に伝達されるようになっている。割込み制御回路10は、図1に図示されないが、アドレスバス24及びデータバス25に結合され、CPU12によって内部レジスタがアクセス可能にされる。なお、上記NMI(ノンマスカブル割込み)は、マスク不可能な割り込みとされる。従って、割込み制御回路10が上記NMI(ノンマスカブル割込み)い受けると、上記NMIに従う割り込み処理を実行する事になる。
【0057】
内蔵ROM18は、CPU12で実行されるプログラムを格納するためのプログラムメモリとされる。内蔵ROM18は、特に制限されないが、アドレスバス24及びそれぞれ8ビット幅のデータバス25,26によってCPU12に結合される。その結果、内蔵ROM18は、バイトデータ(8ビットのデータ)、ワードデータ(16ビットのデータ)にかかわらず、2ステートのメモリアクセスサイクル一回で、バイトデータ及びワードデータの出力が可能にされている。前述のように、内蔵ROM18は、一括消去型の電気的に消去可能な及びプログラム可能な不揮発性記憶装置(以下単に、フラッシュ型EEPROM、又は、フラッシュメモリとも称する)によって構成される。その内部に格納されるデータとしてのプログラムは、シングルチップマイクロコンピュータをオンボード書き込みモードに設定することによって、プログラミング可能にされる。
【0058】
本実施例のマイクロコンピュータ30の動作モードがオンボードプログラミングモードに設定されると、上記内蔵ROM18へのプログラム(データ)書込みや、消去、ベリファイを行うことができる。このオンボードプログラミングモードは、2種類の動作モード(ブートモード、ユーザプログラムモード)を含む。なお、ブートモードは第1オンボードプログラミングモードとされ、ユーザプログラムモードは第2オンボードプログラミングモードとされる。
【0059】
マイクロコンピュータ30の動作モードはモード設定回路MCによって判別され、モード設定回路MCはモード設定信号MS0−MS4のうちの1つのモード設定信号をハイレベルとする。指定された動作モードを示すハイレベルのモード設定信号は、例えば、中央処理装置CPU12やバスコントローラ27等の回路へ供給される。モード設定回路MCは、モード設定端子MD0−MD2に供給されるモード信号MDS0−MDS2の信号電圧及び高電圧供給端子Vppに供給される高電圧Vpが所定の組み合わせとされているか否かを判別し、マイクロコンピュータ30の動作モードを所望の動作モードへ設定する。それによって、マイクロコンピュータ30の動作モードは、上記ブートモードや上記ユーザプログラムモードのほか、後述されるPROMモード、シングルチップモード及び外部メモリ拡張モードを含む。シングルチップモードは、内蔵RAMや内蔵ROMのアドレス空間を利用してマイクロコンピュータシステムを構成するモードとされる。一方、外部メモリ拡張モードは、内蔵RAMや内蔵ROM以外の外部メモリをも利用してアドレス空間が拡張され、その拡張されたアドレス空間を利用してマイクロコンピュータシステムを構成するモードとされる。
【0060】
例えば、12Vの電圧がモード設定端子MD2及び高電圧供給端子Vppに供給されると、マイクロコンピュータ30の動作モードがブートモードに設定される。すなわち、モード設定信号MS0がハイレベルとされる。この場合、マイクロコンピュータ30のアドレス空間の設定モードに従って、0V又は5Vの電圧がモード設定端子MD1、MD0へそれぞれ供給される。一方、12Vの電圧が高電圧供給端子Vppに供給されると、マイクロコンピュータ30の動作モードがユーザプログラムモードに設定される。すなわち、モード設定信号MS1がハイレベルとされる。この場合、マイクロコンピュータ30のアドレス空間の設定モードに従って、0V又は5Vの電圧がモード設定端子MD0−MD2へそれぞれ供給される。特に制限されないが、モード設定信号MS2のハイレベルは上記PROMモードを示し、モード設定信号MS3のハイレベルは上記シングルチップモードモードを示し、モード設定信号MS4のハイレベルは上記外部メモリ拡張モードを示す。
【0061】
ブートモードを使用する場合、フラッシュメモリ18の書き込み及び消去用のユーザプログラム(書き換え制御プログラム)及び書き込みデータが図示されないホストシステムなどに予め用意される。ブートモードに設定されると、リセット解除後に、予めブートROMにプログラムされているブートプログラムが起動される。そして、上記ホストシステムから送信されるデータのローレベルの期間がシリアルコミュニケーションインタフェース回路15によって測定され、それによって、上記ホストシステムの送信データのビットレートが計算され、シリアルコミュニケーションインタフェース回路15のビットレートレジスタの値が決定される。次に、上記ホストシステムは上記書き換え制御プログラムを構成するデータの転送を行う。シリアルコミュニケーションインタフェース回路15によって受信された書き換え制御プログラムのデータが内蔵RAM13へ格納される。書き換え制御プログラムの書込みが終了した後、ブートプログラムの処理が内蔵RAM13に書き込まれた書き換え制御プログラムの先頭アドレスへ分岐される。それによって、内蔵RAM13に書込まれた書き換え制御プログラムがCPU12によって実行され、フラッシュメモリに対するデータの書込み動作或いはデータの消去動作が実行されることになる。なお、上記ブートROMは、マスクROM等の不揮発性記憶回路から構成され、電源電位の低下があってもその記憶内容は消去されない。
【0062】
ユーザプログラムモードにおいて、フラッシュメモリ18に対するデータの書込み動作或いはデータの消去動作がフラッシュメモリ18の書き込み及び消去用のユーザプログラム(書換え制御プログラム)により可能とされる。この場合、高電圧を供給するための高電圧供給手段及び書換えデータを供給するためのデータ供給手段が実装基板上に設けられる。そして、上記書換え制御プログラムが、例えば、フラッシュメモリ18乃至他のメモリ(外部メモリ)のプログラムエリアの一部に格納させる。ユーザプログラムモードの設定に応答して、CPU12は上記書換え制御プログラムを内蔵RAM13に格納し、上記書換え制御プログラムを実行するCPU12によってフラッシュメモリ18のオンボード書換えが行われる。
【0063】
尚、内蔵ROMとしてのフラッシュメモリ18の消去又は書込みモードとして、オンボード書込みモード以外に、PROMモードが用意されても良い。上記PROMモードは、フラッシュメモリ18へのプログラムデータの書込みを汎用PROMライタを用いて可能とするモードとされる。上記PROMモードは、例えば、モード設定端子MD0−MD2の全てに、ローレベル”0”のモード設定信号MDS0−MDS2を供給することによって設定される。
【0064】
ベクタアドレスが内蔵ROMとしてのフラッシュメモリ18内に存在する場合、ユーザープログラムモード又はブートモードにおけるフラッシュメモリ18の消去又は書込み中に、割り込み要求乃至例外処理要求が発生した時、CPU12は正しいベクタアドレスを取得できない。なぜなら、内蔵ROM18の消去又は書込み中なので、CPU12はフラッシュメモリ18のベクタアドレス格納領域をアクセスできないからである。そのため、上述のようなマイクロコンピュータの暴走の虞がある。
【0065】
そこで、本実施例では、ユーザープログラムモード又はブートモードにおけるフラッシュメモリ18の消去又は書込み中、内蔵RAM13の一部の記憶領域(アドレス領域)が、フラッシュメモリ18のベクタアドレス格納エリアへ移動されるようにする。すなわち、フラッシュメモリ18の消去又は書込み中において、フラッシュメモリ18のベクタアドレス格納エリアのアドレスが、内蔵RAM13の一部の記憶領域のアドレスへ移動される。それによって、フラッシュメモリ18の消去又は書込み中に発生したベクタアドレスをフェッチする為のアドレス信号は、内蔵RAM13の一部の記憶領域をアクセスすることになる。従って、内蔵RAM13の一部の上記記憶領域へ必要なベクタアドレスを予め格納することによって、正しいベクタアドレスを取得可能にすれば、マイクロコンピュータの暴走などを防止する事ができる。換言すれば、本実施例において、内蔵RAM13は、ユーザープログラムモードにおける内蔵ROM18の消去又は書込み時、フラッシュメモリ18に格納されたベクタアドレス格納領域を代替するために利用される。このとき、予め利用可能なベクタアドレスが内蔵RAM13の一部の記憶領域に書込まれた後、内蔵ROM18の消去又は書込みのプログラムの実行が開始される事になる。
【0066】
図2は、内蔵ROM18としてのフラッシュメモリの消去又は書込み時に利用される内蔵RAM13のベクタアドレス格納エリアB−Vを含む本発明に従うアドレスマップの第1の実施例を示す。
【0067】
CPU12によって管理されるアドレス空間、言い換えるならば、CPU12がアクセス可能なアドレス空間は、特に制限されないが、64kバイト(H’0000〜H’FFFF)とされる。すなわち、アドレスバス24のビット数は、16ビットとされる。
【0068】
内蔵ROM18に割り当てられたアドレス空間のアドレスエリアAは32kバイト(H’0000〜H’7FFF)とされる。このアドレスエリアAのうち、ベクタアドレスに関するアドレスデータが格納されるベクタアドレス格納エリアA−Vは256バイト(H’0000〜H’00FF)とされる。
【0069】
一方、内蔵RAM13に割り当てられたアドレス空間のアドレスエリアBは、1kバイト(H’FC00〜H’FFFF)とされる。このアドレスエリアBは、図示されるように、アドレスエリアB−Vを含む。このアドレスエリアB−Vは、内蔵ROM18のオンボード書込みを安全に行うために、ベクタアドレス格納エリアA−Vを代替する為のエリアとされ、例えば、256バイト(H’FC00〜H’FCFF)が設定される。従って、ベクタアドレス格納エリアB−Vは、内蔵ROM18のオンボード書き込みモード(ユーザープログラムモード)中に割り込み要求或いは例外処理要求が発生した場合に利用される1乃至複数のベクタアドレスを格納する。
【0070】
ユーザープログラムモード又はブートモードにおけるフラッシュメモリ18の消去又は書込み状態において、CPU12が割込み要求の処理時にベクタアドレス格納エリアA−Vをリードしようとする場合であっても、上記のように、ベクタアドレス格納エリアB−Vに割り当てられたアドレスH’FC00〜H’FCFFが見かけ上ベクタアドレス格納エリアA−Vへ移動されているので、ベクタアドレス格納エリアB−Vがアクセスされる。それにより、内蔵ROM18としてのフラッシュメモリの消去又は書込み中において、正しいベクタアドレスがベクタアドレス格納エリアB−Vから得られるので、フラッシュメモリ18の消去又は書込み中でも、CPU12は割り込み要求及び例外処理要求に応じて所望の割り込み処理及び例外処理を正しく行うことができる。
【0071】
上記のようなベクタアドレスエリアの代替を実現するには、CPU12からベクタアドレス信号が出力されたとき、バスコントローラ27によって、内蔵RAM13のベクタアドレス格納エリアB−Vがアクセスされて、その内容(所定のベクタアドレスデータ)がリードされるようにすればよい。
【0072】
つまり、ユーザープログラムモード又はブートモードにおいて、内蔵ROM18としてのフラッシュメモリの消去又は書込み状態で、CPU12が割込み処理時にフラッシュメモリ18のベクタアドレス格納エリアA−Vをリードする為のアドレス信号を発生したとき、バスコントローラ27が次のようにモジュール選択信号を制御すればよい。
【0073】
すなわち、バスコントローラ27が、本来活性化されるべき内蔵ROM18のモジュール選択信号を非活性化し、代わりに、内蔵RAM13のモジュール選択信号を活性化し、内蔵RAM13のベクタアドレス格納エリアB−Vがリードされるように制御する。具体的には、図3に示されるような制御回路(G1,G2,G3)を図1に示されるバスコントローラ回路27に設ければよい。
【0074】
図3は、内蔵RAM13のベクタアドレス格納エリアB−Vをフラッシュメモリ18のベクタアドレス格納エリアA−Vへアドレス変換する場合のバスコントローラ27の主要部構成例を、内蔵ROM18及び内蔵RAM13との関係で示している。
【0075】
バスコントローラ27は、内蔵ROM18を選択するための内蔵ROM選択回路29、内蔵RAM選択回路28、及び制御論理回路(誤動作排除手段)とされるゲートG1〜G3を含む。上記内蔵ROM選択回路29は、内蔵ROM18のアドレスを示すアドレス信号が上記アドレスバス24にあるとき、ハイレベル”1”の出力信号Aを出力する。内蔵RAM選択回路28は、内蔵ROM18のベクタアドレス格納エリアA−Vを示すアドレス信号が上記アドレスバス24にあるとき、ハイレベル”1”の出力信号Bを出力し、内蔵RAM13のアドレスを示すアドレス信号が上記アドレスバス24にあるとき、ハイレベル”1”の出力信号Cを出力する。ゲートG1は、内蔵ROM18がユーザープログラムモード又はブートモードにおける消去又は書込み状態で、且つ、ベクタフェッチのときハイレベルにされるコントロール信号CONTの反転信号と出力信号Aとのアンド論理をとり、内蔵ROM18が選択されるべき時、内蔵ROM18のモジュール選択信号とされるセレクト信号SEL1をローレベル”0”からハイレベル”1”にアサートする。ゲートG2は、コントロール信号CONTと上記出力信号Bとのアンド論理をとり、それらの信号が共にハイレベル”1”とされるとき、ハイレベル”1”の出力信号Dを出力する。ゲートG3は、出力信号Cおよび出力信号Dとを受け、出力信号C又は出力信号Dがハイレベル”1”とされるとき、内蔵RAM18のモジュール選択信号とされるセレクト信号SEL2をローレベル”0”からハイレベル”1”にアサートする。
【0076】
内蔵ROM(32kバイト)18のアクセスを可能とするため、内蔵ROM18には、アドレスA14〜A0(15ビット)が入力され、また、内蔵RAM(1kバイト)のアクセスを可能とするため、内蔵RAM13にはCPUからのアドレスA9〜A0(10ビット)が入力されるようになっている。
【0077】
内蔵ROM選択回路29は、アドレスバス24を介してCPU12から発生されたのアドレスA15(1ビットのみ)を入力される。このアドレスA15が、ローレベルの場合、つまり、CPU12からのアドレスA15〜A0が、
”0xxx xxxx xxxx xxxx”(0はローレベルとされ、xは論理不定、すなわち、”0”又は”1”のいずれでも可能)
の場合に、出力信号Aがハイレベルになる。すなわち、内蔵ROM18をアクセスするためのアドレス信号がアドレスバス24上に出力された場合、出力信号Aがハイレベルになる。
【0078】
内蔵RAM選択回路28は、アドレスバス24を介してCPU12からのアドレスA15〜A8を入力される。CPU12からのアドレスA15〜A0が、
”0000 0000 xxxx xxxx”
の場合に、出力信号Bがハイレベルとなる。すなわち、内蔵ROM18のベクタアドレス格納エリアA−Vをアクセスするためのアドレス信号がアドレスバス24上に出力された場合、出力信号Bがハイレベルにされる。
【0079】
一方、アドレス信号がアドレスバス24上に出力された場合、CPU12からのアドレスA15〜A10が、
”1111 1100 xxxx xxxx”
の場合に、出力信号Cがハイレベルとなる。すなわち、内蔵RAM13をアクセスするためのアドレス信号がアドレスバス24上に出力された場合、出力信号Cがハイレベルにされる。
【0080】
内蔵ROM18の消去又は書込みのために、所定の外部端子Vppを介して高電圧が供給されるようになっており、この高電圧供給が検出され、且つ、CPU12によってベクタフェッチ状態であることを示す信号がアサートされた場合に、コントロール信号CONTがハイレベルになる。つまり、内蔵ROM18が消去又は書込み状態で、且つ、ベクタフェッチのときに、コントロール信号CONTがハイレベルになる。コントロール信号CONTは、所定の外部端子Vppを介して高電圧が供給されたか否か、及びCPU12がベクタフェッチ状態であるか否かを判別可能に構成された論理回路によって生成することができる。
【0081】
内蔵ROM選択回路29の後段には、内蔵ROM選択回路29の出力信号Aと、コントロール信号CONTとのアンド論理を得るためのゲートG1が配置され、ゲートG1から出力される選択信号SEL1がハイレベルとされた場合に、内蔵ROM18が選択されるようになっている。また、内蔵RAM選択回路28の出力信号Bとコントロール信号CONTとのアンド論理を得るためのゲートG2が設けられ、ゲートG2の出力信号Dと、内蔵RAM選択回路28の出力信号Cとのオア論理を得るためのゲートG3が設けられ、ゲートG3から出力される選択信号SEL2がハイレベルとされた場合、内蔵RAM13が選択されるようになっている。したがって、アドレスH’FC00〜H’FCFFがアクセスされる場合、選択信号SEL1がローレベルとされることで内蔵ROM18の選択が禁止され、それに代えて、選択信号SEL2がハイレベルとされることによって、内蔵RAM13が選択される。つまり、内蔵RAM13によって、内蔵ROM18の消去又は書込み時に、内蔵ROM18上にあるベクタアドレスがリードされる。
【0082】
なお、この場合、内蔵ROM18のベクタアドレス格納エリアA−Vを指定するアドレスのA9−A0と内蔵RAM13のベクタアドレス格納エリアB−VのアドレスのA9−A0とが一致していることが前提とされる。したがって、内蔵ROM18のベクタアドレス格納エリアA−Vを指定するアドレスのA9−A0と内蔵RAM13のベクタアドレス格納エリアB−VのアドレスのA9−A0とが一致していない場合、アドレスバス24と内蔵RAM13との間に、アドレス変換回路を設け、出力信号Dがハイレベルとされるときに、上記アドレス変換回路のアドレス変換機能が動作するように、アドレス変換回路を設計する必要がある。このようなアドレス変換回路は、内蔵RAM13のベクタアドレス格納エリアB−Vのアドレス空間上での配置を自由にする。
【0083】
次に、本発明の別の実施例について説明する。
【0084】
図4は、別の実施例におけるアドレスマップを示している。図4に示されるように、この実施例では、ユーザープログラムモード又はブートモードにおける内蔵ROM18の消去又は書込み時にベクタアドレスエリアを、内蔵RAMエリアに移動するようにしている。
【0085】
つまり、ユーザープログラムモード又はブートモードにおけるフラッシュメモリ18の消去又は書込み時において、本来の内蔵ROM18のベクタアドレス格納エリアA−V(H’0000〜H’00FF)ではなく、内蔵RAMのベクタアドレス格納エリアB−V(H’FC00〜H’FCFF)にベクタアドレスエリアが移動される。この場合、フラッシュメモリの消去又は書込みに応答して、内蔵RAM13へ、予め利用可能な1乃至複数のベクタアドレスのデータを書込んでから、フラッシュメモリ18の消去又は書込みが開始される。
【0086】
すなわち、内蔵ROM18のベクタアドレス格納エリアA−Vをアクセスするためのアドレス信号が、内蔵RAMのベクタアドレス格納エリアB−Vをアクセスするためのアドレス信号に変換される。したがって、CPU12から内蔵ROM18のベクタアドレス格納エリアA−Vをアクセスするためのアドレス信号が出力されたときに、ベクタアドレス格納エリアA−Vをアクセスするためのアドレス信号を内蔵RAMのベクタアドレス格納エリアB−Vをアクセスするためのアドレス信号にアドレス変換するアドレス変換回路を設ければよい。
【0087】
図5は、図1のバスコントロール回路27に設けられる誤動作排除手段としてのアドレス変換回路ACCを示している。
【0088】
アドレス変換回路ACCは、CPU12から出力されるアドレス信号A15〜A10と上記コントロール信号CONTとのオア論理を得るための複数の制御論理回路(ゲート回路)G4、及びこのゲート回路G4の出力アドレス信号と、CPU12からのアドレスA9〜A0とに基づいて、内蔵ROM18、及び内蔵RAM13の選択を行うための内蔵ROM/内蔵RAM選択回路31によって実現することができる。上記ゲートG4、及び内蔵ROM/内蔵RAM選択回路31は、図1に示されるバスコントローラ27に内蔵される。尚、図5では、ゲートG4が1個のように示されるが、実際には、アドレスA15〜A10に対応して、6個設けられる。また、内蔵ROM/内蔵RAM選択回路31は、図4の内蔵ROM選択回路29と内蔵RAM選択回路28とを含み、図4の出力信号Aがモジュール選択信号SEL1とされ、図4の出力信号Cがモジュール選択信号SEL2とされる。
【0089】
上記の構成において、CPU12からベクタアドレス格納エリアA−Vをアクセスするためのアドレス信号
”0000 0000 xxxx xxxx”
がアドレスバス24へ出力された場合、それが、ベクタアドレス格納エリアB−Vをアクセスするためのアドレス信号
”1111 1100 xxxx xxxx”
へ変換されて、内蔵ROM/内蔵RAM選択回路31に入力される。それによって、内蔵RAM13のベクタアドレス格納エリアB−Vが選択されるので、内蔵ROM18の消去又は書込み状態で、CPU12のベクタフェッチが、内蔵RAM13のベクタアドレス格納エリアB−Vに対して行われる。なお、図5において、ベクタアドレス格納エリアA−Vは、アドレス”0000 0000 0000 0000”から始まる256バイトの記憶領域とされ、且つ、ベクタアドレス格納エリアB−Vは、アドレス”1111 1100 0000 0000”から始まるようにしたので、各アドレス信号のA10及びA9は”0”となっている。ベクタアドレス格納エリアB−Vの開始アドレスが、上記と異なる場合は、適切に変更すべきであることは、容易に理解されるであろう。
【0090】
このように、ユーザープログラムモード又はブートモードにおける内蔵ROM18の消去/書込み状態で行われるベクタフェッチが、内蔵ROM18のベクタアドレス格納エリアA−Vではなく、内蔵RAM13のベクタアドレス格納エリアB−Vに対して行われるため、前記実施例(図2乃至図3)の場合と同様に、内蔵ROM18としてのフラッシュメモリの消去又は書込み中において割込み要求或いは例外処理要求が発生した場合でも、内蔵RAM13のベクタアドレス格納エリアB−Vから正しいベクタアドレスが得られる。したがって、マイクロコンピュータの暴走を防止することができ、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。尚、この実施例では、ベクタアドレスのフェッチか否かによって、内蔵RAM13のアクセスと内蔵ROM18のアクセスとを切換える必要はない。
【0091】
また、NMI(ノンマスカブル割込み)を含む全割り込要求を無視するようにしても、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0092】
図6は、内蔵ROM18としてのフラッシュメモリの消去又は書込み中において、NMI(ノンマスカブル割込み)を含む全割り込を無視するためのゲートG5を含むバスコントローラ27を示している。
【0093】
図6に示されるように、バスコントローラ27は、割込み制御回路10とCPU12との間に、誤動作排除手段としての制御論理回路(ゲート回路)G5含む。上記ゲート回路G5は、フラッシュメモリ18が消去又は書込み状態の時ハイレベルとされる制御信号CONT’を受け、ハイレベルの制御信号CONT’に応答して、活性状態に制御される。一方、制御信号CONT’がローレベルの時、上記ゲート回路G5は非活性状態に制御される。
【0094】
割込み制御回路10からの割込み例外処理要求信号IRQSがハイレベルにアサートされた場合でも、フラッシュメモリ18の消去又は書込み状態を示す制御信号CONT’がハイレベルにアサートされている場合、上記割込み例外処理要求信号IRQSのアサート状態はCPU12に伝達されない事になる。したがって、CPU12は、フラッシュメモリ18が消去又は書込み状態の時、CPU12はベクタフェッチ動作を実行しないので、ベクタフェッチ動作に関係する誤動作は発生しない。
【0095】
但し、この場合、NMIは停電などの非常事態をマイクロコンピュータ30へ知らせるために有効な手段であるため、これを無視すると、停電などのハードウェア的な原因でフラッシュメモリ18の消去又は書き込みが失敗するケースを救うことができなくなる点に注意すべきである。
【0096】
図7は、ユーザープログラムモード又はブートモードにおける内蔵ROM18の消去、書込み、又はベリファイ中に割り込み要求が発生した場合に、内蔵ROM18の消去制御ビットレジスタ、書込み制御ビットレジスタ、ベリファイ制御ビットレジスタをリセットする誤動作排除手段としての制御論理回路G6を示す。
【0097】
図7に示されるように、内蔵ROM18の消去、書込み、及びベリファイは、それぞれ消去制御ビットレジスタ32、書込み制御ビットレジスタ33、ベリファイ制御ビットレジスタ34に対して制御ビットをセットすることで可能とされる。したがって、割込み制御回路10からの割込み例外処理要求信号IRQSがアサートされた場合、上記消去制御ビットレジスタ32、書込み制御ビットレジスタ33、ベリファイ制御ビットレジスタ34がリセットされるように構成してもよい。上記消去制御ビットレジスタ32、書込み制御ビットレジスタ33、ベリファイ制御ビットレジスタ34は、外部からのリセット要求RESET1や、ウォッチドッグタイマ19からのリセット要求RESET2に応じる必要がある。そのため、リセット要求RESET1及びRESET2と、上記割込み例外処理要求信号IRQSとのオア論理を得るゲートG6が設けられる。ゲートG6の出力信号は、上記消去制御ビットレジスタ32、書込み制御ビットレジスタ33、ベリファイ制御ビットレジスタ34のリセット端子へ供給される。この構成によれば、内蔵ROM18の消去、書込み、又はベリファイ中に書込み要求が発生した場合に、上記消去制御ビットレジスタ32、書込み制御ビットレジスタ33、ベリファイ制御ビットレジスタ34がリセットされるので、内蔵ROM18の消去、書込み、又はベリファイが中止される。それによって、マイクロコンピュータ30の暴走を防止することができ、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0098】
図8は、図3において説明されたコントロール信号CONT及び図5において説明されたコントロール信号CONT’の生成回路の一例を示している。
【0099】
図示されるように、高電圧検出回路81は、フラッシュメモリ18の書き込み又は消去時に12Vのような高電圧の印加される外部端子Vppに結合され、12Vのような高電圧の供給に応答して、ハイレベルの出力信号Vを発生する。このハイレベルの出力信号Vは、例えば、図5のコントロール信号CONT’として利用する事ができる。一方、ベクタアドレス格納エリアの移動を許可するか否かを制御する許可ビットVATE83が、マイクロコンピュータ30に設けられる。CPU12は、フラッシュメモリ18の書き込みモード(ユーザープログラムモード又はブートモード)の設定に応答して、所定の命令(上記許可ビットVATE83をセット状態とする為の命令)を実行する。それによって、上記許可ビットVATE83がセット状態にされる。ANDゲートG80は、上記出力信号Vと上記許可ビットVATE83の出力状態とのアンド論理をとるゲート回路とされ、その出力信号は図3のコントロール信号CONTとされる。以上のような構成によって、図3のコントロール信号CONT及び図5のコントロール信号CONT’を生成する事ができる。
【0100】
図9は、図1のマイクロコンピュータ30のフラッシュメモリ18のプログラミング方法が、上記で説明されたPROMモード及びオンボード書き込みモードとの関係で示されている。
【0101】
図9に示されるように、プログラミング方法は、PROMモードによるフラッシュメモリ18のプログラミングとオンボード書き込みモードによるフラッシュメモリ18のプログラミング方法がある。開始(1)は、PROMモードによるフラッシュメモリ18のプログラミングの開始を示しており、マイクロコンピュータ30の動作モードが前述の方法によってPROMモードに設定され、汎用PROMライタによってフラッシュメモリ18に所望のプログラムデータが書き込まれる(ステップS1)。その後、所望のプログラムデータが書き込まれたマイクロコンピュータ30は、プリントボードなどの基板に実装され、そしてその実装基板を用いて、マイクロコンピュータ応用システムが組み立てられる(ステップS2)。
【0102】
一方、開始(2)は、オンボード書き込みモードによるフラッシュメモリ18のプログラミングの開始を示しており、フラッシュメモリ18に所望のプログラムデータが書き込まれていない状態でマイクロコンピュータ30が、プリントボードなどの基板に実装され、そして、その実装基板を用いて、マイクロコンピュータ応用システムが組み立てられる(ステップS3)。その後、マイクロコンピュータ30の動作モードが前述の方法によってブートモードに設定され、ブートプログラムに従ってフラッシュメモリ18に所望のプログラムデータが書き込まれる(ステップS4)。このようにすれば、ユーザーの開発するソフトウェアプログラム(アプリケーションソフト)の確定が遅れても、ソフトウェアプログラムの確定前に、マイクロコンピュータ応用システムのハードウェアを組立て、その後、マイクロコンピュータ内のフラッシュメモリへ開発されたソフトウェアプログラムを書込む事ができる。それによって、マイクロコンピュータ応用システムの出荷が迅速化できる。
【0103】
ステップS2及びステップS4の後、マイクロコンピュータ応用システムはフラッシュメモリ18に書き込まれた所望のプログラムデータにしたがって、システム動作を実行することになる(ステップS5)。この時期に、一度出荷したマイクロコンピュータ応用システムのソフトウェアに関し、仕様の変更されたソフトウェアの開発や機能の追加されたソフトウェア(アップグレード版或いはバージョンアップされたソフトウェアなど)の開発が行われたとき、一度出荷した応用システムのソフトウェアをユーザ側で上記新規に開発したソフトウェアへ書換えが必要になる場合がある(ケース1)。あるいは、マイクロコンピュータ応用システムの利用者が、例えば、キーボードの機能を英語モードから仏語モードへ機能変更するなどの変更が必要となる場合もある(ケース2)。このようなケース1乃至ケース2のような場合が生じたとき、フラッシュメモリ18に所望のプログラムデータの書き換えが必要になる。
【0104】
そこで、ステップS6に示されるように、マイクロコンピュータ30の動作モードがブートモード或いはユーザプログラムモードに設定される。例えば、上記ケース1の場合、プログラムの全面書き換えが必要な場合もあるので、マイクロコンピュータ30の動作モードがブートモードに設定され、フラッシュメモリ18のプログラムデータが所望のプログラムデータへ書き換えられる。一方、上記ケース2の場合、プログラムデータの一部分のみの書き換えによって対応可能なので、マイクロコンピュータ30の動作モードがユーザプログラムモードに設定され、フラッシュメモリ18のプログラムデータの一部のデータが所望のデータへ書き換えられる。
【0105】
ステップS6の後、点線Xで示される様に、ステップ5に戻り、マイクロコンピュータ応用システムは書き換えられたプログラムに従ってシステム動作を実行することになる。なお、ステップS5、ステップS6は、必要に応じて、繰り返される。
【0106】
図10は、本発明のさらに詳細なアドレスマップを示し、通常モード(シングルチップモード乃至外部メモリ拡張モード)及びフラッシュメモリのオンボード書き換えモードのユーザプログラムモード又はブートモード時におけるNMI(ノンマスカブル割り込み)のベクタアドレスとそれに対するNMI処理ルーチンの格納エリアを示している。なお、図10は、図2及び図4に示されるアドレスマップの具体的な一例とされても良い。
【0107】
図10に示されるように、シングルチップモード乃至外部メモリ拡張モードの様な通常モードにおいて、NMI(ノンマスカブル割り込み)のベクタアドレスNMIAは、フラッシュメモリ18のベクタアドレス格納エリアA−Vに格納され、そのベクタアドレスNMIAに対するNMI処理ルーチンRAは、フラッシュメモリ18のアドレス空間Aの一部に格納される。つまり、ベクタアドレスNMIAは、NMI処理ルーチンRAの先頭アドレスを示している。従って、通常モードにおいて、NMI(ノンマスカブル割り込み)が発生すると、CPU12はNMI(ノンマスカブル割り込み)のベクタアドレスNMIAをベクタフェッチ動作によって取得し、ベクタアドレスNMIAによって示されるアドレス、すなわちNMI処理ルーチンRAの先頭アドレスへベクタジャンプして、その処理を実行する。
【0108】
一方、ユーザプログラムモード又はブートモードにおけるフラッシュメモリ18のオンボード書き換え時、NMI(ノンマスカブル割り込み)のベクタアドレスNMIBは、内蔵RAM13のベクタアドレス格納エリアB−Vに格納され、そのベクタアドレスNMIBに対するNMI処理ルーチンRBは、内蔵RAM13のアドレス空間Bの一部に格納される。つまり、ベクタアドレスNMIBは、NMI処理ルーチンRBの先頭アドレスを示している。ユーザプログラムモード又はブートモードにおけるフラッシュメモリ18の書き換え時、NMI(ノンマスカブル割り込み)が発生すると、CPU12はNMI(ノンマスカブル割り込み)のベクタアドレスNMIBをベクタフェッチ動作によって取得し、ベクタアドレスNMIBによって示されるアドレス、すなわちNMI処理ルーチンRBの先頭アドレスへベクタジャンプして、その処理を実行する。
【0109】
したがって、ユーザプログラムモード又はブートモードにおけるフラッシュメモリ18のオンボード書き換え時のNMI(ノンマスカブル割り込み)は、フラッシュメモリ18に格納されるベクタアドレスNMIA及びNMI処理ルーチンRAを使用せずに、内蔵RAM13に格納されたベクタアドレスNMIB及びNMI処理ルーチンRBを利用して実行される。そのため、ユーザプログラムモード又はブートモードにおけるフラッシュメモリ18のオンボード書き換え時におけるNMI(ノンマスカブル割り込み)が、確実に処理される。この場合、内蔵RAM13のベクタアドレス格納エリアB−V及びNMI処理ルーチンRB等の格納エリアは書き換え時のワーク領域としての使用を制限されることに注意する必要がある。
【0110】
なお、ベクタアドレス格納エリアA−Vとベクタアドレス格納エリアB−Vとのアドレスの移動に関しては、図3乃至図5に示された方法が利用でき、コントロール信号CONT乃至CONT’によって、ベクタアドレス格納エリアA−Vとベクタアドレス格納エリアB−Vとのアドレスが移動される。
【0111】
図11は、ユーザプログラムモード又はブートモードでのオンボード書き換え時におけるNMI(ノンマスカブル割り込み)の利用方法とその形成回路を説明するための図を示している。
【0112】
本発明に従うマイクロコンピュータ30は、電圧維持手段110及びNMI信号生成手段112とともにプリント基板120に実装される。
【0113】
上記電圧維持手段110は、Vcc電源(通常は、5V)が規定値以下、例えば4.5V以下に低下した場合、一定の時間(例えば、1ms程度)Vcc端子を4.5V以上に維持する機能を含む。さらに、マイクロコンピュータ30は、暴走して内部の状態を破壊することがないよう準備されたモード、例えば、システムクロックの発振を停止するソフトウェアスタンバイモードを設定する。この目的のため、上記電圧維持手段110は、例えば、大容量のコンデンサなどを利用して形成される。電圧維持手段110は、Vcc電源がさらに低下しても、例えば、0Vに低下しても、マイクロコンピュータ30の電源端子Vccの電位を、マイクロコンピュータ30がソフトウェアスタンバイモードを維持できる電圧(例えば、2.0V)に維持する。この目的のため、上記電圧維持手段110は、例えば、2次電池なども含ませて構成される。
【0114】
NMI信号生成手段112は、Vcc電源(通常は、5V)が規定値以下、例えば4.5V以下に低下した場合、それを検出してNMIを生成する。NMI信号生成手段112は、マイクロコンピュータ30のNMI信号入力端子へ、5Vから0Vへ変化する立下がりエッジを生成し、NMIをアサートする。
【0115】
フラッシュメモリ18のオンボード書き換えモード時(ユーザプログラムモード又はブートモード時)において、Vcc電源(通常は、5V)が規定値以下に低下した場合、フラッシュメモリ18のオンボード書き換えが実行できなくなる。そのため、上記に示されるように、Vcc電源(通常は、5V)が規定値以下に低下した事が検出され、NMIが発生されて、フラッシュメモリ18の書き換え作業が中断され、CPU12によってNMI処理ルーチンRBが実行されることになる。この場合、NMIがCPU12によって受け付けられるとき、CPU12の汎用レジスタ(R0−R15)やプログラムカウンタ(PC)等の内容は、特に制限されないが、外部メモリへスタックされる。
【0116】
したがって、NMI処理ルーチンRBからの復帰時、前述のスタックポインタ(SP)の値に基づいて、NMI受付時の状態へ、汎用レジスタ(R0−R15)やプログラムカウンタ(PC)等の内容を復帰することができる利点がある。あるいは、スタックポインタ(SP)の値に基づいて、汎用レジスタ(R0−R15)やプログラムカウンタ(PC)等の内容を格納する外部メモリをアクセスし、その内容からフラッシュメモリ18の書き換え状況が解析できる等の利点がある。
【0117】
図12は、フラッシュメモリ18のオンボード書き換えモード(ユーザープログラムモードの例)時、その開始から終了時点までに実行される書き換え処理フローを示している。
【0118】
図12に示されるように、まず最初に、開始ステップS12として、フラッシュメモリ18の書き換え開始の指令がCPU12に対して発行される。CPU12は、必要があれば、書き換え作業エリアとされるべきアドレス領域の内容を待避するなどの前処理を実行する(ステップS13)。
上記書き換え作業エリアは、例えば、内蔵RAM18のアドレス領域の一部、又は、外部メモリ拡張モードにおける外部RAMのアドレス領域の一部とされても良い。
【0119】
次のステップS14として、書き換えルーチンが、例えば、CPU12によって、上記書き換え作業エリアに書き込まれる。上記書き換えルーチンは、書き込み制御プログラムやNMI処理ルーチンRBなどを含む。また、上記書き換えルーチンは、フラッシュメモリ18内に格納されている場合、或いは、外部からマイクロコンピュータ30へ供給する場合などがある。
【0120】
次に、NMI処理ルーチンRBに対応するベクタアドレスNMIBが、例えば、CPU12によって、内蔵RAM13のベクタアドレス格納エリアB−Vへ書き込まれる(ステップS15)。そして、図8に示されたように、CPU12が、ベクタアドレス移動許可ビットVATE82をセット状態に設定する(ステップS16)。以上のような前処理が実行される。
【0121】
その後、ステップS17において、CPU12は、書き換え作業エリアに書き込まれた上記書き換えルーチンを実行し、フラッシュメモリ18のプログラムデータの書き換えを実行する。フラッシュメモリ18に書き込まれるべきプログラムデータは、マイクロコンピュータ30の外部から供給される。書き換え処理(ステップS17)の完了後、以下の後処理がCPU12によって実行される。
【0122】
すなわち、ステップS16で設定されたベクタアドレス移動許可ビットVATE82をリセット状態へ変更する(ステップS18)。すなわち、許可ビットVATE82がクリアされる。その後、CPU12は、必要があれば、書き換え作業エリアの内容を回復するなどの後処理を実行する(ステップS19)。すなわち、ステップS13で待避処理が行われた場合には、ステップS19でその回復処理が行われる。
【0123】
そして、ステップ20において、フラッシュメモリ18の書き換え完了の通知又はリセットスタートが実行され、フラッシュメモリ18の書き換え処理が完了する。
【0124】
次に内蔵フラッシュメモリ18の具体的構成が説明される。
【0125】
図13及び図14にはフラッシュメモリ18のメモリセルの原理が示される。図13に例示的に示されたメモリセルは、2層ゲート構造の絶縁ゲート型電界効果トランジスタにより構成されている。図13において、1はP型シリコン基板、14は上記シリコン基板1に形成されたP型半導体領域、13はN型半導体領域、15は低濃度のN型半導体領域である。8はフローティングゲートであり、トンネル絶縁膜としての薄い酸化膜7(例えば厚さ10nm)を介して上記P型シリコン基板1上に形成されている。11は酸化膜9を介して上記フローティングゲート8の上に形成されたコントロールゲートである。ソースは13、15によって構成され、ドレインは13、14によって構成される。このメモリセルに記憶される情報は、実質的にしきい値電圧の変化としてトランジスタに保持される。以下、特に述べないかぎり、メモリセルにおいて、情報を記憶するトランジスタ(以下、記憶トランジスタと称する)がNチャンネル型の場合について述べる。
【0126】
メモリセルへの情報の書込み動作は、例えばコントロールゲート11及びドレインに高圧を印加して、アバランシェ注入によりドレイン側からフローティングゲート8に電子を注入することで実現される。この書込み動作により記憶トランジスタは、図14に示されるように、そのコントロールゲート7からみたしきい値電圧が、書込み動作を行わなかった消去状態の記憶トランジスタに比べて高くなる。
【0127】
一方、消去動作は、例えばソースに高圧を印加して、トンネル現象によりフローティングゲート8からソース側に電子を引き抜くことによって実現される。図14に示されるように、消去動作により記憶トランジスタはそのコントロールゲート11からみたしきい値電圧が低くされる。図14では、書込み並びに消去状態の何れにおいても記憶トランジスタのしきい値は正の電圧レベルにされる。すなわちワード線からコントロールゲート11に与えられるワード線選択レベルに対して、書込み状態のしきい値電圧は高くされ、消去状態のしきい値電圧は低くされる。双方のしきい値電圧とワード線選択レベルとがそのような関係を持つことによって、選択トランジスタを採用することなく1個のトランジスタでメモリセルを構成することができる。記憶情報を電気的に消去する場合においては、フローティングゲート8に蓄積された電子をソース電極に引く抜くことにより、記憶情報の消去が行われるため、比較的長い時間、消去動作を続けると、書込み動作の際にフローティングゲート8に注入した電子の量よりも多くの電子が引く抜かれることになる。そのため、電気的消去を比較的長い時間続けるような過消去を行うと、記憶トランジスタのしきい値電圧は例えば負のレベルになって、ワード線の非選択レベルにおいても選択されるような不都合を生ずる。尚、書込みも消去と同様にトンネル電流を利用して行うこともできる。
【0128】
読み出し動作においては、上記メモリセルに対して弱い書込み、すなわち、フローティングゲート8に対して不所望なキャリアの注入が行われないように、ドレイン及びコントロールゲート11に印加される電圧が比較的低い値に制限される。例えば、1V程度の低電圧がドレイン10に印加されるとともに、コントロールゲート11に5V程度の低電圧が印加される。これらの印加電圧によって記憶トランジスタを流れるチャンネル電流の大小を検出することにより、メモリセルに記憶されている情報の“0”、“1”を判定することができる。
【0129】
図15は前記記憶トランジスタを用いたメモリセルアレイの構成原理を示す。同図には代表的に4個の記憶トランジスタ(メモリセル)Q1乃至Q4が示される。X,Y方向にマトリクス配置されたメモリセルにおいて、同じ行に配置された記憶トランジスタQ1,Q2(Q3,Q4)のコントロールゲート(メモリセルの選択ゲート)は、それぞれ対応するワード線WL1(WL2)に接続され、同じ列に配置された記憶トランジスタQ1,Q3(Q2,Q4)のドレイン領域(メモリセルの入出力ノード)は、それぞれ対応するデータ線DL1,DL2に接続されている。上記記憶トランジスタQ1,Q3(Q2,Q4)のソース領域は、ソース線SL1(SL2)に結合される。
【0130】
図16にはメモリセルに対する消去動作並びに書込み動作のための電圧条件の一例が示される。同図においてメモリ素子はメモリセルを意味し、ゲートはメモリセルの選択ゲートとしてのコントロールゲートを意味する。同図において負電圧方式の消去はコントロールゲートに例えば−10Vのような負電圧を印加することによって消去に必要な高電界を形成する。同図に例示される電圧条件から明らかなように、正電圧方式の消去にあっては少なくともソースが共通接続されたメモリセルに対して一括消去を行うことができる。したがって図15の構成において、ソース線SL1,SL2が接続されていれば、4個のメモリセルQ1乃至Q4は一括消去可能にされる。この場合、同一ソース線につながるメモリビットの数を変えることによりメモリブロックのサイズを任意に設定することができる。ソース線分割方式には図15に代表的に示されるようなデータ線を単位とする場合(共通ソース線をデータ線方向に延在させる)の他にワード線を単位とする場合(共通ソース線をワード線方向に延在させる)がある。一方、負電圧方式の消去にあっては、コントロールゲートが共通接続されたメモリセルに対して一括消去を行うことができる。
【0131】
図17には一括消去可能なメモリブロックの記憶容量を相違させたフラッシュメモリ18の一例回路ブロック図が示される。
【0132】
同図に示されるフラッシュメモリ18(以下FMRYとも記す)は、8ビットのデータ入出力端子D0〜D7を有し、各データ入出力端子毎にメモリマットARY0〜ARY7を備える。メモリマットARY0〜ARY7は、特に制限されないが、相対的に記憶容量の大きなメモリブロックLMBと相対的に記憶容量の小さなメモリブロックSMBとに2分割されている。図には代表的にメモリマットARY0の詳細が示されているが、その他のメモリマットARY1〜ARY7も同様に構成されている。各メモリブロックは、同一の記憶容量とされてもよい。
【0133】
夫々のメモリマットARY0〜ARY7には前記図13で説明した2層ゲート構造の絶縁ゲート型電界効果トランジスタによって構成されたメモリセルMCがマトリクス配置されている。同図においてWL0〜WLnは全てのメモリマットARY0〜ARY7に共通のワード線である。同一行に配置されたメモリセルのコントロールゲートは、それぞれ対応するワード線に接続される。夫々のメモリマットARY0〜ARY7において、同一列に配置されたメモリセルMCのドレイン領域は、それぞれ対応するデータ線DL0〜DL7に接続されている。メモリブロックSMBを構成するメモリセルMCのソース領域はソース線SL1に共通接続され、メモリブロックLMBを構成するメモリセルMCのソース領域はソース線SL2に共通接続されている。
【0134】
前記ソース線SL1,SL2には電圧出力回路VOUT1,VOUT2から消去に利用される高電圧Vppが供給される。電圧出力回路VOUT1,VOUT2の出力動作は、消去ブロック指定レジスタのビットB1,B2の値によって選択される。例えば消去ブロック指定レジスタのビットB1に”1”が設定されることによって各メモリマットARY0〜ARY7のメモリブロックSMBだけが一括消去可能にされる。消去ブロック指定レジスタのビットB2に”1”が設定された場合は、各メモリマットARY0〜ARY7のメモリブロックLMBだけが一括消去可能にされる。双方のビットB1,B2に”1”が設定されたときはフラッシュメモリ18の全体が一括消去可能にされる。
【0135】
前記ワード線WL0〜WLnの選択は、ロウアドレスバッファXABUFF及びロウアドレスラッチXALATを介して取り込まれるロウアドレス信号AXをロウアドレスデコーダXADECが解読することによって行われる。ワードドライバWDRVはロウアドレスデコーダXADECから出力される選択信号に基づいてワード線を駆動する。データ読出し動作においてワードドライバWDRVは電圧選択回路VSELから供給される5Vのような電圧Vccと0Vのような接地電位とを電源として動作され、選択されるべきワード線を電圧Vccによって選択レベルに駆動し、非選択とされるべきワード線を接地電位のような非選択レベルに維持させる。データの書込み動作においてワードドライバWDRVは、電圧選択回路VSELから供給される12Vのような電圧Vppと0Vのような接地電位とを電源として動作され、選択されるべきワード線を12Vのような書込み用高電圧レベルに駆動する。データの消去動作においてワードドライバWDRVの出力は0Vのような低い電圧レベルにされる。
【0136】
夫々のメモリマットARY0〜ARY7において前記データ線DL0〜DL7はカラム選択スイッチYS0〜YS7を介して共通データ線CDに共通接続される。カラム選択スイッチYS0〜YS7のスイッチ制御は、カラムアドレスバッファYABUFF及びカラムアドレスラッチYALATを介して取り込まれるカラムアドレス信号AYをカラムアドレスデコーダYADECが解読することによって行われる。カラムアドレスデコーダYADECの出力選択信号は全てのメモリマットARY0〜ARY7に共通に供給される。したがって、カラムアドレスデコーダYADECの出力選択信号のうちの何れか一つが選択レベルにされることにより、各メモリマットARY0〜ARY7において共通データ線CDには1本のデータ線が接続される。
【0137】
メモリセルMCから共通データ線CDに読出されたデータは選択スイッチRSを介してセンスアンプSAMPに与えられ、ここで増幅されて、データ出力ラッチDOLATを介してデータ出力バッファDOBUFFから外部に出力される。前記選択スイッチRSは読出し動作に同期して選択レベルにされる制御信号φrによってオン状態にされる。外部から供給される書込みデータはデータ入力バッファDIBUFFを介してデータ入力ラッチ回路DILATに保持される。データ入力ラッチ回路DILATに保持されたデータが”0”のとき、書込み回路WRITは選択スイッチWSを介して共通データ線CDに書込み用の高電圧を供給する。この書込み用高電圧はカラムアドレス信号AYによって選択されたデータ線を通して、ロウアドレス信号AXでコントロールゲートに高電圧が印加されるメモリセルのドレインに供給され、これによって当該メモリセルが書込みされる。前記選択スイッチWSは書込み動作に同期して選択レベルにされる制御信号φwによってオン状態にされる。書込み消去の各種タイミングや電圧の選択制御は書込み消去制御回路WECONTが生成する。
【0138】
図18には図1のマイクロコンピュータ30に内蔵されるフラッシュメモリ18(FMRY)の全体的なブロック図が示される。同図においてARYは前記図13で説明した2層ゲート構造の絶縁ゲート型電界効果トランジスタによって構成されたメモリセルをマトリクス配置したメモリアレイである。このメモリアレイARYは図17で説明した構成と同様に、メモリセルのコントロールゲートはそれぞれ対応するワード線に接続され、メモリセルのドレイン領域はそれぞれ対応するデータ線に接続され、メモリセルのソース領域はメモリブロック毎に共通のソース線に接続されているが、メモリブロックの分割態様は図17とは相違される。例えば、相対的にそれぞれの記憶容量が大きな7個の大メモリブロック(大ブロック)LMB0乃至LMB6と、相対的にそれぞれの記憶容量が小さな8個の小メモリブロック(小ブロック)SMB0乃至SMB7とに分割されている。大メモリブロックはプログラム格納領域又は大容量データ格納領域などに利用される。小メモリブロックは小容量データ格納領域などに利用される。
【0139】
図18において、ALATはアドレス信号PAB0乃至PAB15のラッチ回路である。第1動作モード(PROMモード以外の動作モード)においてそのアドレス信号PAB0乃至PAB15は中央処理装置CPU12の出力アドレス信号に対応され、アドレスバス24から供給される。第2動作モード(PROMモード)では、アドレス信号PAB0乃至PAB15はPROMライタの出力アドレス信号に対応される。XADECはアドレスラッチALATを介して取り込まれるロウアドレス信号を解読するロウアドレスデコーダである。WDRVはロウアドレスデコーダXADECから出力される選択信号に基づいてワード線を駆動するワードドライバである。データ読出し動作においてワードドライバWDRVは5Vのような電圧でワード線を駆動し、データの書込み動作では12Vのような高電圧でワード線を駆動する。データの消去動作においてワードドライバWDRVの全ての出力は0Vのような低い電圧レベルにされる。YADECはアドレスラッチYALATを介して取り込まれるカラムアドレス信号を解読するカラムアドレスデコーダである。YSELはカラムアドレスデコーダYADECの出力選択信号に従ってデータ線を選択するカラム選択回路である。SAMPはデータ読出し動作においてカラム選択回路YSELで選択されたデータ線からの読出し信号を増幅するセンスアンプである。DOLATはセンスアンプSAMPの出力を保持するデータ出力ラッチである。DOBUFFはデータ出力ラッチDOLATが保持するデータを外部に出力するためのデータ出力バッファである。図においてPDB0乃至PDB7は下位8ビット(1バイト)データであり、図1のデータバス26に供給される。PDB8乃至PDB15は上位8ビット(1バイト)データであり、図1のデータバス25に供給される。この例に従えば出力データは最大2バイトとされる。DIBUFFは外部から供給される書込みデータを取り込むためのデータ入力バッファである。データ入力バッファDIBUFFから取り込まれたデータはデータ入力ラッチ回路DILATに保持される。データ入力ラッチ回路DILATに保持されたデータが”0”のとき、書込み回路WRITはカラム選択回路YSELで選択されたデータ線に書込み用高電圧を供給する。この書込み用高電圧はロウアドレス信号に従ってコントロールゲートに高電圧が印加されるメモリセルのドレインに供給され、これによって当該メモリセルが書込みされる。ERASECは指定されたメモリブロックのソース線に消去用高電圧を供給してメモリブロックの一括消去を行うための消去回路である。
【0140】
FCONTは、フラッシュメモリFMRYにおけるデータ読出し動作のタイミング制御、及び書込み消去のための各種タイミングや電圧の選択制御などを行う制御回路である。この制御回路FCONTは、コントロールレジスタCREGを備える。
【0141】
図19にはコントロールレジスタCREGの一例が示される。コントロールレジスタCREGは、それぞれ8ビットのプログラム/イレーズ制御レジスタPEREGと、消去ブロック指定レジスタMBREG1及びMBREG2によって構成される。プログラム/イレーズ制御レジスタPEREGにおいて、Vppは書換え用高電圧印加に応じて”1”にされる高電圧印加フラグである。Eビットは消去動作を指示するビットとされ、EVビットは消去におけるベリファイ動作の指示ビットとされる。Pビットは書込み動作(プログラム動作)の指示ビットとされ、PVビットは書込みにおけるベリファイ動作の指示ビットとされる。消去ブロック指定レジスタMBREG1及びMBREG2は、それぞれ7分割された大ブロックと8分割された小ブロックに含まれる何れのメモリブロックを消去するかを指定するレジスタであり、それらに含まれるビットは、特に制限されないが、1対1で対応されるメモリブロックの指定用ビットとされ、例えばビット”1”は対応メモリブロックの選択を意味し、ビット”0”は対応メモリブロックの非選択を意味する。例えば、消去ブロック指定レジスタMBREG2の第7ビットが”1”のときは、小メモリブロックSMB7の消去が指定される。
【0142】
上記コントロールレジスタCREGは外部からリード・ライト可能にされている。制御回路FCONTは、そのコントロールレジスタCREGの設定内容を参照し、それにしたがって消去・書込みなどの制御を行う。外部においては、そのコントロールレジスタCREGの内容を書換えることによって、消去・書込み動作の状態を制御することができる。
【0143】
図18において、制御回路FCONTには、制御信号としてFLM,MS−FLN,MS−MISN,M2RDN,M2WRN,MRDN,MWRN,IOWORDN,及びRSTが供給され、更に、上位1バイトのデータPDB8乃至PDB15と、アドレス信号PAB0乃至PAB15の所定ビットが与えらる。
【0144】
制御信号FLMは、フラッシュメモリFMRYの動作モードを指定する信号であり、その”0”が第1動作モードを指定し、”1”が第2動作モードを指定する。この信号FLMは、例えば前記モード信号MD0乃至MD2に基づいて形成される。
【0145】
制御信号MS−FLNは、フラッシュメモリFMRYの選択信号であり、その”0”が選択を指示し、”1”が非選択を指示する。第1動作モードでは中央処理装置(CPU)12がその制御信号MS−FLNを出力し、第2動作モードにおいてその制御信号MS−FLNは、PROMライタから供給されるチップ・イネーブル信号CE*に対応される。
【0146】
制御信号MS−MISNはコントロールレジスタCREGの選択信号である。このとき、プログラム/イレーズ制御レジスタPEREGと消去ブロック指定レジスタMBREG1及びMBREG2の何れを選択するかは、アドレス信号PAB0乃至PAB15の所定ビットを参照して決定される。第1動作モードでは中央処理装置(CPU)12がその制御信号MS−MISNを出力する。第2動作モードでは、特に制限されないが、PROMライタが出力する最上位アドレスビットEA16がその制御信号MS−MISNとみなされる。
【0147】
M2RDNはメモリリードストローブ信号、M2WRNはメモリライトストローブ信号、MRDNはコントロールレジスタCREGのリード信号、MWRNはコントロールレジスタCREGのライト信号である。第1動作モードでは中央処理装置(CPU)12がそれら制御信号を出力する。第2動作モードでは、特に制限されないが、PROMライタから供給されるライトイネーブル信号WE*が前記信号M2WRN,MWRNとみなされ、PROMライタから供給されるアウトプットイネーブル信号OE*が前記信号M2RDN,MRDNとみなされる。尚、メモリライトストローブ信号M2WRNは、メモリセルに書込むべきデータをデータ入力ラッチ回路DILATに書込むためのストローブ信号とみなされる。メモリセルへの実際の書込みは前記コントロールレジスタCREGのPビットをセットすることによって開始される。
【0148】
IOWORDNはフラッシュメモリFMRYに対する8ビットリードアクセスと16ビットリードアクセスとの切換え信号とされる。第2動作モードにおいては当該制御信号IOWORDNは8ビットリードアクセスを指示する論理値に固定される。
【0149】
RSTはフラッシュメモリFMRYのリセット信号である。この信号RSTによってフラッシュメモリFMRYがリセットされることにより、或は前記プログラム/イレーズ制御レジスタPEREGのVppフラグが”0”にされることにより、前記プログラム/イレーズ制御レジスタPEREGにおけるEV,PV,E,Pの各モード設定ビットがクリアされる。したがって、図7に示されるゲートG6の出力がリセット信号RSTとされることによって、制御レジスタPEREGの各ビットがクリアできる。
【0150】
以上本発明者によってなされた発明を実施例に基づいて具体的に説明したが、本発明はそれに限定されるものではなく、その要旨を逸脱しない範囲において種々変更可能であることは言うまでもない。
【0151】
例えば、上記実施例ではフラッシュメモリの書込みはホットエレクトロンで行なわれることにしたが、トンネル効果により行うものであってもよい。また、上記実施例では内蔵ROM18としてフラッシュメモリを適用したが、EEPROMと称されるようなオンボード書込み可能とされる他の半導体メモリを適用することができる。
【0152】
以上の説明では主として本発明者によってなされた発明をその背景となった利用分野であるシングルチップ・マイクロコンピュータに適用した場合について説明したが、本発明はそれに限定されるものではなく、各種データ処理装置に広く適用することができる。本発明は、少なくとも電気的に消去又は書込みが可能なプログラムメモリを含むことを条件に適用することができる。
【0153】
【発明の効果】
本願において開示される発明のうち代表的なものによって得られる効果を簡単に説明すれば下記の通りである。
【0154】
すなわち、誤動作排除手段により、プログラムメモリに正しいデータが存在しない場合における上記プログラムメモリの消去又は書込み中の割込み発生に起因する誤動作が排除され、それによって、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0155】
プログラムメモリの消去又は書込み中の割込み要求に応じて、ランダムアクセス可能な記憶手段の一部が、プログラムメモリのベクタアドレスエリアに移動されることにより、プログラムメモリの消去又は書込み中における割込み発生に対して正しいベクタアドレスの取得が可能とされ、それにより、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0156】
プログラムメモリの消去又は書込み中の割込み要求に応じて、プログラムメモリのベクタアドレスエリアが前記記憶手段に移動されることにより、プログラムメモリの消去又は書込み中における割込み発生に対して正しいベクタアドレスの取得が可能とされ、それにより、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0157】
プログラムメモリの消去又は書込み要求に応じてプログラムメモリの消去又は書込みが行われる期間、中央処理装置に対する割込み要求が排除されることにより、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0158】
プログラムメモリの消去又は書込み要求に応じてプログラムメモリの消去又は書込みが行われる期間に、中央処理装置に対して発生された割込み要求に呼応して、プログラムメモリの消去又は書込みのための処理が中止されることにより、プログラムメモリのオンボード書込みの際のシステムの安全性の向上を図ることができる。
【0159】
したがって、フラッシュメモリのようなプログラムメモリの消去・書き込みプログラム(書き換え制御プログラム)の作成ミスや誤動作、及び外部回路の操作ミス等で誤って生じた割り込み要求に対しても、フラッシュメモリのようなプログラムメモリの消去・書き換えが自動的に中止され、割り込み処理の中でフラッシュメモリのようなプログラムメモリの消去・書き換えの中止状態を記録する処理を実行する事によって、フラッシュメモリなどの電気的に書き換え可能なプログラムメモリを過消去・過書き込み若しくはその中間状態等の異常状態から保護できる。従って、マイクロコンピュータ応用システムを破壊から保護できる。
【図面の簡単な説明】
【図1】本発明の一実施例であるシングルチップ・マイクロコンピュータの全体的な構成例ブロック図である。
【図2】上記マイクロコンピュータに含まれる内蔵RAMの一部をベクタアドレスエリアに移動する場合のアドレスマップの説明図である。
【図3】内蔵RAMのベクタアドレス格納エリア(B−V)をフラッシュメモリのベクタアドレス格納エリア(A−V)へアドレス変換する場合のバスコントローラの主要部構成例を内蔵ROM及び内蔵RAMとの関係で示す説明図である。
【図4】本発明の別の実施例におけるアドレスマップの説明図である。
【図5】図1のバスコントローラに設けられる誤動作排除手段としてのアドレス変換回路(ACC)の一例説明図である。
【図6】内蔵ROMとしてのフラッシュメモリの消去又は書込み中において、NMIを含む全割り込を無視するためのゲート(G5)を含むバスコントローラの説明図である。
【図7】内蔵ROMの消去、書込み、又はベリファイ中に書込み要求が発生した場合に、内蔵ROMの消去制御ビットレジスタ、書込み制御ビットレジスタ、ベリファイ制御ビットレジスタをリセットする誤動作排除手段としての制御論理回路(G6)を示す説明図である。
【図8】図3において説明されたコントロール信号(CONT)及び図5において説明されたコントロール信号(CONT’)の生成回路の一例を示す論理回路図である。
【図9】図1のマイクロコンピュータのフラッシュメモリのプログラミング方法をPROMモード及びオンボード書き込みモードとの関係で示す説明図である。
【図10】通常モード(シングルチップモード乃至外部メモリ拡張モード)及びフラッシュメモリのオンボード書き換えモード時のにおけるNMIのベクタアドレスとそれに対するNMI処理ルーチンの格納エリアを更に詳細に示す説明図である。
【図11】オンボード書き換えモード時におけるNMIの形成回路を説明するためのブロック図である。
【図12】フラッシュメモリのオンボード書き換えモード(ユーザープログラムモードの例)時にその開始から終了時点までに実行される書き換え処理フローを示すフローチャートである。
【図13】フラッシュメモリのメモリセルの一例断面図である。
【図14】フラッシュメモリのメモリセルの消去状態と書き込み状態の閾値を示す説明図である。
【図15】フラッシュメモリのメモリアレイの構成を示す回路図である。
【図16】フラッシュメモリのメモリセルに対する消去動作及び書き込み動作のための電圧条件の一例を示す説明図である。
【図17】フラッシュメモリの部分的なブロック図である。
【図18】フラッシュメモリの全体的なブロック図である。
【図19】フラッシュメモリのコントロールレジスタの一例を示す説明図である。
【符号の説明】
10 割込み制御回路
11 クロック発振器
12 CPU
13 内蔵RAM
14 ホストインタフェース
15 シリアルコミュニケーションインタフェース
16 A/D変換器
17 D/A変換器
18 内蔵ROM
19 ウォッチドッグタイマ
20 16ビットフリーランニングタイマ
21 8ビットタイマ
22 PWMタイマ
24 アドレスバス
25,26 データバス
27 バスコントローラ
28 内蔵RAM選択回路
29 内蔵ROM選択回路
30 シングルチップ・マイクロコンピュータ
31 内蔵ROM/内蔵RAM選択回路
32 消去制御ビットレジスタ
32 書込み制御ビットレジスタ
33 ベリファイ制御ビットレジスタ
G4,G5,G6 ゲート[0001]
BACKGROUND OF THE INVENTION
The present invention relates to an on-board programming technique for a program memory built in a single-chip microcomputer serving as a data processing apparatus. The present invention relates to a technology that is effective when applied to a single-chip microcomputer having a flash memory (also simply referred to as a flash EEPROM or flash memory) as a program memory.
[0002]
[Prior art]
A single-chip microcomputer (also simply referred to as a microcomputer) as a data processing device incorporates a program memory that stores an operation program. The single-chip microcomputer executes predetermined data processing defined in the operation program stored in the built-in program memory.
[0003]
The program memory has been formed by a mask type nonvolatile memory device (hereinafter referred to as a mask type read only memory or a mask ROM) or an electrically programmable nonvolatile memory device (hereinafter simply referred to as an EPROM). . However, in recent years, a batch erasing type electrically erasable and programmable nonvolatile memory device (hereinafter also simply referred to as flash EEPROM or flash memory) has been applied to the program memory.
[0004]
Flash memory can electrically erase or rewrite data once written. Therefore, a microcomputer incorporating a flash memory as a program memory has the following advantages, for example.
[0005]
Determination of software programs (application software) developed by users generally tends to be delayed. Therefore, the hardware of the microcomputer application system can be assembled before the software program is determined, and then the developed software program can be written to the flash memory in the microcomputer. As a result, shipment of microcomputer application systems can be speeded up.
[0006]
Furthermore, with regard to the application system software that has been shipped once, when the development of software whose specifications have been changed or the development of software with added functions (such as upgraded version or upgraded software), the application system that has been shipped once Can be rewritten to the newly developed software on the user side.
[0007]
That is, in a microcomputer incorporating a flash memory as a program memory, after the microcomputer is mounted on a printed board, a mounting board, or a system board, a process for writing an operation program into the flash memory can be performed. In this specification, a process of writing data to the built-in flash memory in a state where the microcomputer incorporating the flash memory is mounted on a printed board, a mounting board, or a system board is referred to as an “on-board writing process”. The mode is referred to as “onboard write mode”.
[0008]
There are several methods for the on-board write mode. When they are roughly classified, they are classified into the following two types.
[0009]
The first method is a user program mode or a boot mode. In these modes, the program execution flow of the central processing unit (CPU) built in the microcomputer is branched to on-board writing processing, and the data in the flash memory is changed by the central processing unit.
[0010]
The second method is a writing mode using a ROM writer. In this mode, the microcomputer is stopped and the flash memory data is changed by an external means (ROM writer).
[0011]
Japanese Laid-Open Patent Publication No. 6-180664 discloses a system in which an abnormality processing program is moved to another area at the time of rewriting a flash memory to cope with the abnormality at the time of rewriting.
[0012]
[Problems to be solved by the invention]
In the first method, since the stored contents of the built-in flash memory are subject to rewriting, a write control program existing in a memory other than the flash memory such as a built-in RAM (random access memory) is stored in the central processing unit (CPU). ), And the flash memory is erased or written.
[0013]
In the erase or write state of the flash memory in the first method, the original function of the microcomputer is not lost. Therefore, an interrupt to the central processing unit (CPU) may be erroneously generated due to a signal input supplied from the outside of the microcomputer, or an address error may occur during execution of the write control program. . In addition, since NMI (non-maskable interrupt) cannot be prohibited, an unintended NMI may occur during writing or erasing of the flash memory in the first method. Even if it is not an NMI, there is a possibility that an interrupt is erroneously enabled and a similar state is obtained.
[0014]
Generally, when an interrupt or an address error occurs, the processing of the central processing unit branches to an interrupt processing routine or an exception processing routine. A vector address indicating the start address of the interrupt processing routine or exception processing routine is used to branch the processing of the central processing unit to the interrupt processing routine or exception processing routine. When an interrupt occurs or exception handling occurs, the vector address of the corresponding interrupt handling routine or exception handling routine is acquired by the central processing unit. The acquired vector address is written to the program counter of the central processing unit, and the program flow of the central processing unit jumps to the address indicated by the vector address, whereby the corresponding interrupt processing or exception processing is executed.
[0015]
It has been made clear by the inventors that the matters to be noted here are as follows.
[0016]
That is, generally, a plurality of vector addresses are stored in a vector address storage area in the program memory. The same applies to the case where the flash memory is a program memory, and a plurality of vector addresses are stored in a vector address storage area in the flash memory.
[0017]
However, if the flash memory is a program memory and the flash memory is being erased or written in the user program mode or boot mode, if an interrupt occurs or exception handling occurs, The processing device cannot obtain a desired vector address stored in the vector address storage area in the flash memory.
[0018]
That is, the vector address exists in the program memory even though the rewrite control program for erasing or writing in the user program mode or boot mode of the flash memory exists in a memory (for example, RAM) other than the flash memory. . Therefore, a correct vector address cannot be obtained during an erase process or a write process for the flash memory as the program memory. As a result, it has been found that if an interrupt or exception occurs in the user program mode or boot mode of the program memory, there is a risk of microcomputer runaway and further damage to the application system. Further, if the microcomputer runs out of control and the flash memory is overerased or overwritten, it may be impossible to reproduce the microcomputer application system. On the other hand, it is a general means to detect an abnormal situation such as a drop in power supply potential by an interrupt such as NMI.
[0019]
Note that the erase process or the write process for the flash memory is considered to include an erase verify operation and a write verify operation.
[0020]
In microcomputers with built-in flash memory as program memory, after the hardware of the application system is assembled, the user can write software into the built-in flash memory or rewrite the software in the built-in flash memory of the application system once shipped. . Therefore, there are many advantages of incorporating the flash memory in the microcomputer. However, it has become clear that the occurrence of interrupts and exception handling during the on-board write mode in the internal flash memory user program mode or boot mode can cause the microcomputer to run out of control or damage the application system. It was.
[0021]
An object of the present invention is to improve the safety of a system when on-board writing of a program memory.
[0022]
Another object of the present invention is a data processing device including an electrically erasable and programmable non-volatile storage device as a program memory, wherein an interrupt process or an exception process is requested during on-board writing of the program memory. Even in that case, it is possible to prevent the risk of runaway and damage.
[0023]
Still another object of the present invention is a microcomputer including a flash memory as a program memory, which is capable of responding to a request for interrupt processing or exception processing during on-board writing or erasing of the program memory. The object is to provide a data processing device such as a microcomputer.
[0024]
Still another object of the present invention is a single-chip microcomputer including a flash memory as a program memory. When an interrupt process or an exception process is requested at the time of writing or erasing the program memory, the central processing unit responds. An object of the present invention is to provide a data processing device such as a single-chip microcomputer configured to be able to acquire a vector address related to interrupt processing or exception processing.
[0025]
The above and other objects and novel features of the present invention will be apparent from the description of this specification and the accompanying drawings.
[0026]
[Means for Solving the Problems]
The following is a brief description of an outline of typical inventions disclosed in the present application.
[0027]
The data processing device includes a program memory (18) that can be electrically erased or written, a central processing unit (12) that can access the program memory (18), and an interrupt that occurs during erasing or writing of the program memory. Alternatively, a malfunction elimination means for eliminating malfunction caused by occurrence of exception processing is included.
[0028]
The malfunction elimination means can include the following configuration.
[0029]
[1] As shown in FIG. 6, during the period when the program memory (18) is being erased or written, the interrupt request or exception handling request to the central processing unit (12) is eliminated or invalidated. A first control logic circuit (G5) is provided in the data processing device.
[0030]
Therefore, during the period in which the program memory (18) is erased or written in the user program mode or the boot mode, the first control logic circuit (G5) makes an interrupt request to the central processing unit (12) or Since the exception processing request is excluded or invalidated, the central processing unit (12) is in the period during which the program memory (18) is being erased or written, and the vector address corresponding to the interrupt request or exception processing request. Do not execute the acquisition operation. This achieves an improvement in system safety during on-board writing of the program memory (18). As a result, the generation of an unintended interrupt request can be prohibited.
[0031]
[2] As shown in FIG. 7, during the period when the program memory (18) is being erased or written in the user program mode or the boot mode, an interrupt request or exception process for the central processing unit (12) is performed. In response to the request, a second control logic circuit (G6) is provided in the data processing device for stopping the erase process or the write process for the program memory (18).
[0032]
That is, during the period when the program memory (18) is being erased or written, the second control logic circuit (G6) responds to an interrupt request or exception handling request to the central processing unit (12). Then, the erase process or the write process for the program memory (18) is stopped. Specifically, the second control logic circuit (G6) includes an erase control bit (32), a write control bit (33), and a verify control bit (34) of an operation control register provided in the program memory (18). The data of the control bits such as is changed from the activated state to the deactivated state.
[0033]
Therefore, when an interrupt request or exception processing request is generated for the central processing unit (12) during the period when the program memory (18) is being erased or written, the second control logic circuit (G6) The erase process or the write process for the program memory (18) is stopped. The occurrence of such an interrupt may be a cause of an emergency such as a programming error or power failure in the write / erase control program. Therefore, by canceling the erase process or the write process for the program memory (18), it is possible to prevent the flash memory from being overerased or overwritten. Thereafter, the central processing unit (12) can obtain a vector address corresponding to the interrupt request or exception processing request from the program memory (18). As described above, the improvement of the safety of the system at the time of on-board writing of the program memory (18) is achieved.
[0034]
[3] As shown in FIGS. 3 and 5, an interrupt request or an exception processing request is generated for the central processing unit (12) during the period during which the program memory (18) is erased or written. The memory selection operation is performed so that access to the vector address storage area of the program memory (18) is prohibited, and a memory other than the program memory (18), for example, a predetermined area of the random access memory (13) can be accessed. Selection data changing means (G1, G2, G4) for changing from the program memory (18) to a memory other than the program memory (18) is provided in the data processing device. The selected memory changing means (G1, G2, G4) can be provided in the bus controller (27).
[0035]
In this case, in a predetermined area of the memory other than the program memory (18), an interrupt request to the central processing unit (12) or a period during which an erase process or a write process of the program memory (18) is performed in advance. Stores vector address data for interrupt processing or exception processing to be processed when an exception processing request is generated. The vector address data stored in the predetermined storage area is set to indicate the start address of a predetermined interrupt processing routine or exception processing routine stored in another storage area other than the program memory (18). The
[0036]
[3.1] In the above [3], the selected memory changing means (G1, G2) is connected to the central processing unit (12) during a period in which the program memory (18) is being erased or written. When an interrupt request or exception handling request occurs, the selection signal of the program memory (18) is inactivated in response to detection of access to the vector address storage area of the program memory (18). Instead, the selection memory changing means (G1, G2) activates the selection signal of the memory (13) other than the program memory (18).
[0037]
[3.2] In the above [3], the selected memory changing means (G4) sends an interrupt request to the central processing unit (12) during a period in which the program memory (18) is being erased or written. Alternatively, when an exception handling request is generated, an address signal for accessing the vector address storage area of the program memory (18) is sent to the program memory in response to detection of access to the vector address storage area of the program memory (18). It converts into an address signal for accessing a predetermined storage area of a memory other than (18), for example, a random access memory (13).
[0038]
By configuring as in the above [3.1] and [3.2], the central processing is performed during the period in which the program memory (18) is erased or written in the user program mode or the boot mode. Even when an interrupt request or an exception handling request is issued to the device (12), the central processing unit (12) assigns a vector address relating to the corresponding interrupt handling routine or exception handling routine to a memory other than the program memory (18). It can be obtained by accessing another storage area. Therefore, the NMI interrupt is used to notify the microcomputer of an emergency such as a drop in the power supply voltage Vcc due to a power failure, and the erasure process or write process for the program memory (18) is stopped, thereby overerasing the flash memory・ Overwriting can be prevented. In this case, in the interrupt processing routine for the NMI, a process of recording the erasure process or the write process stop state is executed, and the flash memory can be protected from an abnormal state such as over-erasure / over-write or an intermediate state. This achieves an improvement in system safety during on-board writing of the program memory (18).
[0039]
DETAILED DESCRIPTION OF THE INVENTION
FIG. 1 shows a
[0040]
As shown in FIG. 1, the single-
[0041]
These circuit modules (10, 12 to 22, P1 to P9) are connected by an
[0042]
When the
[0043]
Next, functions of the circuit blocks (10 to 22) will be described.
[0044]
The
[0045]
The
[0046]
One of the general-purpose registers is used as a stack pointer when an interrupt occurs or an exception occurs. That is, when an interrupt occurs or an exception occurs, the data stored in the general-purpose register at that time is saved in, for example, a predetermined external storage device. In this case, the stack pointer stores address data indicating the address of the saved data. When returning from interrupt processing or exception processing, using the address data stored in the stack pointer, the contents of the general-purpose register saved to the external storage device when the interrupt processing or exception processing is accepted Recovered in general purpose registers. When one unit from a certain rising edge of the system clock to the next rising edge is set to one state, the memory cycle or bus cycle of the
[0047]
The built-in
[0048]
The
[0049]
The serial
[0050]
The A /
[0051]
The D /
[0052]
The
[0053]
The 16-bit free-running
[0054]
The 8-
[0055]
The
[0056]
The interrupt
[0057]
The built-in
[0058]
When the operation mode of the
[0059]
The operation mode of the
[0060]
For example, when a voltage of 12 V is supplied to the mode setting terminal MD2 and the high voltage supply terminal Vpp, the operation mode of the
[0061]
When the boot mode is used, a user program (rewrite control program) for writing and erasing the
[0062]
In the user program mode, data writing operation or data erasing operation with respect to the
[0063]
Incidentally, as an erasing or writing mode of the
[0064]
When the vector address exists in the
[0065]
Therefore, in the present embodiment, a part of the storage area (address area) of the
[0066]
FIG. 2 shows a first embodiment of an address map according to the present invention including the vector address storage area B-V of the
[0067]
The address space managed by the
[0068]
The address area A of the address space allocated to the built-in
[0069]
On the other hand, the address area B of the address space allocated to the built-in
[0070]
Even when the
[0071]
In order to realize the replacement of the vector address area as described above, when the vector address signal is output from the
[0072]
That is, in the user program mode or boot mode, when the
[0073]
That is, the
[0074]
FIG. 3 shows an example of the configuration of the main part of the
[0075]
The
[0076]
To enable access to the built-in ROM (32 kbytes) 18, the addresses A14 to A0 (15 bits) are input to the built-in
[0077]
The built-in
“0xxxx xxxx xxxx xxxx xxxx” (0 is low level, x is logic indefinite, ie, can be either “0” or “1”)
In this case, the output signal A becomes high level. That is, when an address signal for accessing the built-in
[0078]
The built-in
“0000 0000 xxxx xxxx”
In this case, the output signal B becomes high level. That is, when an address signal for accessing the vector address storage area AV of the built-in
[0079]
On the other hand, when the address signal is output onto the
"1111 1100 xxxx xxx"
In this case, the output signal C becomes high level. That is, when an address signal for accessing the built-in
[0080]
In order to erase or write in the
[0081]
A gate G1 for obtaining an AND logic between the output signal A of the built-in
[0082]
In this case, it is assumed that the address A9-A0 that designates the vector address storage area AV of the
[0083]
Next, another embodiment of the present invention will be described.
[0084]
FIG. 4 shows an address map in another embodiment. As shown in FIG. 4, in this embodiment, the vector address area is moved to the internal RAM area when the
[0085]
That is, when the
[0086]
That is, an address signal for accessing the vector address storage area AV of the
[0087]
FIG. 5 shows an address conversion circuit ACC as a malfunction elimination means provided in the
[0088]
The address conversion circuit ACC includes a plurality of control logic circuits (gate circuits) G4 for obtaining an OR logic between the address signals A15 to A10 output from the
[0089]
In the above configuration, an address signal for accessing the vector address storage area AV from the
“0000 0000 xxxx xxxx”
Is output to the
"1111 1100 xxxx xxx"
And is input to the internal ROM / internal
[0090]
Thus, the vector fetch performed in the erase / write state of the
[0091]
Further, even if all interrupt requests including NMI (non-maskable interrupt) are ignored, it is possible to improve the safety of the system at the on-board writing of the program memory.
[0092]
FIG. 6 shows a
[0093]
As shown in FIG. 6, the
[0094]
Even when the interrupt exception processing request signal IRQS from the interrupt
[0095]
In this case, however, the NMI is an effective means for notifying the
[0096]
7 resets the erase control bit register, the write control bit register, and the verify control bit register of the built-in
[0097]
As shown in FIG. 7, the
[0098]
FIG. 8 shows an example of a circuit for generating the control signal CONT explained in FIG. 3 and the control signal CONT ′ explained in FIG.
[0099]
As shown, the high
[0100]
FIG. 9 shows the programming method of the
[0101]
As shown in FIG. 9, there are two programming methods: programming of the
[0102]
On the other hand, the start (2) indicates the start of programming of the
[0103]
After step S2 and step S4, the microcomputer application system executes system operation according to desired program data written in the flash memory 18 (step S5). At this time, once the microcomputer application system software shipped once, the development of software whose specifications have been changed or the development of software with added functions (such as upgraded version or upgraded software) In some cases, it is necessary to rewrite the software of the shipped application system to the newly developed software on the user side (Case 1). Alternatively, the user of the microcomputer application system may need to change the function of the keyboard from English mode to French mode, for example (Case 2). When
[0104]
Therefore, as shown in step S6, the operation mode of the
[0105]
After step S6, as indicated by the dotted line X, the process returns to step 5, and the microcomputer application system executes the system operation according to the rewritten program. Steps S5 and S6 are repeated as necessary.
[0106]
FIG. 10 shows a more detailed address map according to the present invention. The NMI (non-maskable interrupt) in the normal mode (single chip mode to external memory expansion mode) and the user program mode or the boot mode in the on-board rewrite mode of the flash memory. The vector address and the NMI processing routine storage area corresponding to the vector address are shown. Note that FIG. 10 may be a specific example of the address map shown in FIGS.
[0107]
As shown in FIG. 10, in a normal mode such as a single chip mode or an external memory expansion mode, an NMI (non-maskable interrupt) vector address NMIA is stored in a vector address storage area AV of the
[0108]
On the other hand, at the time of on-board rewriting of the
[0109]
Therefore, NMI (non-maskable interrupt) at the time of on-board rewriting of the
[0110]
As for the movement of addresses between the vector address storage area AV and the vector address storage area BV, the method shown in FIGS. 3 to 5 can be used, and the vector address storage is performed by the control signals CONT to CONT ′. The addresses of area A-V and vector address storage area B-V are moved.
[0111]
FIG. 11 is a diagram for explaining a method of using an NMI (non-maskable interrupt) at the time of on-board rewriting in the user program mode or the boot mode, and a circuit for forming the same.
[0112]
The
[0113]
The voltage maintaining means 110 has a function of maintaining the Vcc terminal at 4.5 V or more for a certain period of time (for example, about 1 ms) when the Vcc power supply (usually 5 V) drops below a specified value, for example, 4.5 V or less. including. Further, the
[0114]
When the Vcc power supply (usually 5 V) drops below a specified value, for example, 4.5 V or less, the NMI signal generation means 112 detects that and generates an NMI. The NMI signal generation means 112 generates a falling edge that changes from 5V to 0V to the NMI signal input terminal of the
[0115]
In the on-board rewrite mode of the flash memory 18 (in the user program mode or boot mode), if the Vcc power supply (usually 5 V) drops below a specified value, the on-board rewrite of the
[0116]
Therefore, when returning from the NMI processing routine RB, the contents of the general-purpose registers (R0-R15) and the program counter (PC) are returned to the state at the time of NMI reception based on the value of the above-mentioned stack pointer (SP). There are advantages that can be made. Alternatively, based on the value of the stack pointer (SP), the external memory storing the contents such as the general purpose registers (R0 to R15) and the program counter (PC) is accessed, and the rewrite status of the
[0117]
FIG. 12 shows a rewrite processing flow executed from the start to the end of the
[0118]
As shown in FIG. 12, first, as a start step S12, a command to start rewriting of the
The rewriting work area may be, for example, a part of the address area of the
[0119]
As the next step S14, a rewriting routine is written in the rewriting work area by the
[0120]
Next, the vector address NMIB corresponding to the NMI processing routine RB is written into the vector address storage area B-V of the
[0121]
Thereafter, in step S17, the
[0122]
That is, the vector address movement permission bit VATE 82 set in step S16 is changed to the reset state (step S18). That is, the permission bit VATE 82 is cleared. Thereafter, if necessary, the
[0123]
Then, in
[0124]
Next, a specific configuration of the built-in
[0125]
FIG. 13 and FIG. 14 show the principle of the memory cell of the
[0126]
The operation of writing information to the memory cell is realized, for example, by applying a high voltage to the
[0127]
On the other hand, the erase operation is realized, for example, by applying a high voltage to the source and extracting electrons from the floating
[0128]
In the read operation, the voltage applied to the drain and the
[0129]
FIG. 15 shows the configuration principle of a memory cell array using the memory transistor. In the figure, typically four memory transistors (memory cells) Q1 to Q4 are shown. In memory cells arranged in a matrix in the X and Y directions, the control gates (selection gates of memory cells) of the storage transistors Q1, Q2 (Q3, Q4) arranged in the same row respectively correspond to the corresponding word lines WL1 (WL2). The drain regions (input / output nodes of the memory cells) of the storage transistors Q1, Q3 (Q2, Q4) arranged in the same column are connected to the corresponding data lines DL1, DL2, respectively. Source regions of the storage transistors Q1, Q3 (Q2, Q4) are coupled to a source line SL1 (SL2).
[0130]
FIG. 16 shows an example of voltage conditions for an erase operation and a write operation for a memory cell. In the figure, a memory element means a memory cell, and a gate means a control gate as a selection gate of the memory cell. In the figure, erasing in the negative voltage method forms a high electric field necessary for erasing by applying a negative voltage such as -10 V to the control gate. As is clear from the voltage conditions illustrated in the figure, at the time of erasing in the positive voltage system, at least batch erasing can be performed on memory cells whose sources are commonly connected. Accordingly, in the configuration of FIG. 15, if the source lines SL1 and SL2 are connected, the four memory cells Q1 to Q4 can be erased collectively. In this case, the size of the memory block can be arbitrarily set by changing the number of memory bits connected to the same source line. In the source line division method, in addition to the case where data lines are representative as shown in FIG. 15 (the common source line is extended in the direction of the data lines), the word line is the unit (common source line). Extending in the word line direction). On the other hand, in the case of erasing using the negative voltage method, it is possible to perform batch erasing on memory cells to which the control gates are commonly connected.
[0131]
FIG. 17 shows an example circuit block diagram of the
[0132]
The flash memory 18 (hereinafter also referred to as FMRY) shown in the figure has 8-bit data input / output terminals D0 to D7, and each data input / output terminal includes a memory mat ARY0 to ARY7. The memory mats ARY0 to ARY7 are not particularly limited, but are divided into two, a memory block LMB having a relatively large storage capacity and a memory block SMB having a relatively small storage capacity. In the figure, the details of the memory mat ARY0 are representatively shown, but the other memory mats ARY1 to ARY7 are similarly configured. Each memory block may have the same storage capacity.
[0133]
In each of the memory mats ARY0 to ARY7, memory cells MC constituted by the insulated gate field effect transistors having the two-layer gate structure described with reference to FIG. 13 are arranged in a matrix. In the figure, WL0 to WLn are word lines common to all the memory mats ARY0 to ARY7. The control gates of the memory cells arranged in the same row are connected to the corresponding word lines. In each of the memory mats ARY0 to ARY7, the drain regions of the memory cells MC arranged in the same column are connected to the corresponding data lines DL0 to DL7, respectively. The source regions of the memory cells MC constituting the memory block SMB are commonly connected to the source line SL1, and the source regions of the memory cells MC constituting the memory block LMB are commonly connected to the source line SL2.
[0134]
The source lines SL1 and SL2 are supplied with a high voltage Vpp used for erasing from the voltage output circuits VOUT1 and VOUT2. The output operation of the voltage output circuits VOUT1 and VOUT2 is selected by the values of the bits B1 and B2 of the erase block designation register. For example, by setting “1” to the bit B1 of the erase block designation register, only the memory blocks SMB of the memory mats ARY0 to ARY7 can be erased collectively. When “1” is set to bit B2 of the erase block designation register, only the memory blocks LMB of the memory mats ARY0 to ARY7 can be erased at once. When both bits B1 and B2 are set to "1", the
[0135]
The selection of the word lines WL0 to WLn is performed by the row address decoder XADEC decoding the row address signal AX taken in via the row address buffer XABUFF and the row address latch XALAT. The word driver WDRV drives the word line based on the selection signal output from the row address decoder XADEC. In the data read operation, the word driver WDRV is operated using a voltage Vcc such as 5 V and a ground potential such as 0 V supplied from the voltage selection circuit VSEL as power sources, and drives a word line to be selected to a selected level by the voltage Vcc. Then, the word line to be unselected is maintained at a non-selected level such as the ground potential. In the data write operation, the word driver WDRV is operated with a voltage Vpp such as 12V supplied from the voltage selection circuit VSEL and a ground potential such as 0V as power supplies, and the word line to be selected is written as 12V. Drive to high voltage level. In the data erasing operation, the output of the word driver WDRV is set to a low voltage level such as 0V.
[0136]
In each of the memory mats ARY0 to ARY7, the data lines DL0 to DL7 are commonly connected to a common data line CD via column selection switches YS0 to YS7. The column selection switches YS0 to YS7 are controlled by the column address decoder YADEC decoding the column address signal AY fetched through the column address buffer YABUFF and the column address latch YALAT. The output selection signal of the column address decoder YADEC is supplied in common to all the memory mats ARY0 to ARY7. Accordingly, when any one of the output selection signals of the column address decoder YADEC is set to the selection level, one data line is connected to the common data line CD in each of the memory mats ARY0 to ARY7.
[0137]
Data read from the memory cell MC to the common data line CD is applied to the sense amplifier SAMP via the selection switch RS, amplified there, and output to the outside from the data output buffer DOBUFF via the data output latch DOLAT. . The selection switch RS is turned on by a control signal φr that is set to a selection level in synchronization with the read operation. Write data supplied from the outside is held in the data input latch circuit DILAT via the data input buffer DIBUFF. When the data held in the data input latch circuit DILAT is “0”, the write circuit WRIT supplies a high voltage for writing to the common data line CD via the selection switch WS. The high voltage for writing is supplied to the drain of the memory cell to which the high voltage is applied to the control gate by the row address signal AX through the data line selected by the column address signal AY, and thereby the memory cell is written. The selection switch WS is turned on by a control signal φw that is set to a selection level in synchronization with the write operation. The write / erase control circuit WECONT generates various write / erase timings and voltage selection control.
[0138]
FIG. 18 is an overall block diagram of the flash memory 18 (FMRY) built in the
[0139]
In FIG. 18, ALAT is a latch circuit for address signals PAB0 to PAB15. In the first operation mode (operation mode other than the PROM mode), the address signals PAB0 to PAB15 correspond to the output address signal of the central processing unit CPU12 and are supplied from the
[0140]
The FCONT is a control circuit that performs timing control of data read operation in the flash memory FMRY, various timings for writing and erasing, and voltage selection control. The control circuit FCONT includes a control register CREG.
[0141]
FIG. 19 shows an example of the control register CREG. The control register CREG is composed of an 8-bit program / erase control register PEREG and erase block designation registers MBREG1 and MBREG2. In the program / erase control register PEREG, Vpp is a high voltage application flag that is set to “1” in response to the application of a rewrite high voltage. The E bit is a bit for instructing an erasing operation, and the EV bit is an instructing bit for a verify operation in erasing. The P bit is an instruction bit for a write operation (program operation), and the PV bit is an instruction bit for a verify operation in writing. Erase block designation registers MBREG1 and MBREG2 are registers for designating which memory blocks included in the large block divided into 7 and the small block divided into 8 are erased, and the bits included in them are particularly limited. Although not designated, it is used as a bit for designating a memory block corresponding one-to-one. For example, bit “1” means selection of the corresponding memory block, and bit “0” means non-selection of the corresponding memory block. For example, when the seventh bit of the erase block designation register MBREG2 is “1”, erase of the small memory block SMB7 is designated.
[0142]
The control register CREG can be read / written from the outside. The control circuit FCONT refers to the setting contents of the control register CREG, and performs control such as erasing / writing according to the setting contents. Externally, the state of the erase / write operation can be controlled by rewriting the contents of the control register CREG.
[0143]
In FIG. 18, the control circuit FCONT is supplied with FLM, MS-FLN, MS-MISN, M2RDN, M2WRN, MRDN, MWRN, IOWORDN, and RST as control signals, and further, upper 1 byte data PDB8 to PDB15 The predetermined bits of the address signals PAB0 to PAB15 are given.
[0144]
The control signal FLM is a signal that designates the operation mode of the flash memory FMRY, and “0” designates the first operation mode and “1” designates the second operation mode. The signal FLM is formed based on the mode signals MD0 to MD2, for example.
[0145]
The control signal MS-FLN is a selection signal for the flash memory FMRY, and “0” indicates selection and “1” indicates non-selection. In the first operation mode, the central processing unit (CPU) 12 outputs the control signal MS-FLN. In the second operation mode, the control signal MS-FLN corresponds to the chip enable signal CE * supplied from the PROM writer. Is done.
[0146]
The control signal MS-MISN is a selection signal for the control register CREG. At this time, which of the program / erase control register PEREG and the erase block designation registers MBREG1 and MBREG2 is selected is determined with reference to predetermined bits of the address signals PAB0 to PAB15. In the first operation mode, the central processing unit (CPU) 12 outputs the control signal MS-MISN. In the second operation mode, although not particularly limited, the most significant address bit EA16 output from the PROM writer is regarded as the control signal MS-MISN.
[0147]
M2RDN is a memory read strobe signal, M2WRN is a memory write strobe signal, MRDN is a read signal for the control register CREG, and MWRN is a write signal for the control register CREG. In the first operation mode, the central processing unit (CPU) 12 outputs these control signals. In the second operation mode, although not particularly limited, the write enable signal WE * supplied from the PROM writer is regarded as the signals M2WRN and MWRN, and the output enable signal OE * supplied from the PROM writer is the signals M2RDN and MRDN. Is considered. The memory write strobe signal M2WRN is regarded as a strobe signal for writing data to be written to the memory cell to the data input latch circuit DILAT. The actual writing to the memory cell is initiated by setting the P bit of the control register CREG.
[0148]
IOWORDN is a signal for switching between 8-bit read access and 16-bit read access to the flash memory FMRY. In the second operation mode, the control signal IOWORDN is fixed to a logical value instructing 8-bit read access.
[0149]
RST is a reset signal for the flash memory FMRY. When the flash memory FMRY is reset by this signal RST or the Vpp flag of the program / erase control register PEREG is set to “0”, the EV, PV, E, and E in the program / erase control register PEREG are set. Each mode setting bit of P is cleared. Therefore, each bit of the control register PEREG can be cleared by setting the output of the gate G6 shown in FIG. 7 to the reset signal RST.
[0150]
Although the invention made by the present inventor has been specifically described based on the embodiments, it is needless to say that the present invention is not limited thereto and can be variously modified without departing from the gist thereof.
[0151]
For example, in the above embodiment, writing to the flash memory is performed by hot electrons, but it may be performed by a tunnel effect. In the above embodiment, the flash memory is applied as the built-in
[0152]
In the above description, the case where the invention made mainly by the inventor is applied to the single-chip microcomputer which is the field of use behind the invention has been described. However, the present invention is not limited thereto, and various data processing is performed. Can be widely applied to the device. The present invention can be applied on condition that at least a program memory that can be electrically erased or written is included.
[0153]
【The invention's effect】
The effects obtained by the representative ones of the inventions disclosed in the present application will be briefly described as follows.
[0154]
In other words, the malfunction elimination means eliminates malfunction caused by the occurrence of an interrupt during erasure or writing of the program memory when correct data does not exist in the program memory, so that the system memory for on-board programming of the program memory can be eliminated. Safety can be improved.
[0155]
In response to an interrupt request while erasing or writing program memory, a part of the randomly accessible storage means is moved to the vector address area of program memory, so that an interrupt during program memory erasing or writing occurs. Thus, a correct vector address can be obtained, thereby improving the safety of the system at the on-board writing of the program memory.
[0156]
In response to an interrupt request during erasure or writing of the program memory, the vector address area of the program memory is moved to the storage means, so that a correct vector address can be acquired for the occurrence of an interrupt during erasure or writing of the program memory. This makes it possible to improve the safety of the system during on-board writing of the program memory.
[0157]
During the period when the program memory is erased or written in response to the program memory erase or write request, the interrupt request to the central processing unit is eliminated, thereby improving the system safety during the on-board program memory write. Can be planned.
[0158]
In response to the interrupt request generated for the central processing unit, the processing for erasing or writing the program memory is suspended during the period when the program memory is erased or written in response to the program memory erasing or writing request. As a result, it is possible to improve the safety of the system when the program memory is written on board.
[0159]
Therefore, a program such as a flash memory can be used for an interrupt request that is erroneously generated due to a mistake or malfunction of a program memory erase / write program (rewrite control program) such as a flash memory or an operation error of an external circuit. Erasing and rewriting of memory is automatically canceled, and flash memory can be electrically rewritten by executing processing to record the erasing / rewriting cancellation status of program memory such as flash memory during interrupt processing Can protect a program memory from abnormal states such as overerasing, overwriting, or intermediate states. Therefore, the microcomputer application system can be protected from destruction.
[Brief description of the drawings]
FIG. 1 is a block diagram showing an example of the overall configuration of a single chip microcomputer according to an embodiment of the present invention.
FIG. 2 is an explanatory diagram of an address map when a part of a built-in RAM included in the microcomputer is moved to a vector address area.
FIG. 3 shows a configuration example of a main part of a bus controller when address conversion is performed from a vector address storage area (B-V) of a built-in RAM to a vector address storage area (A-V) of a flash memory. It is explanatory drawing shown by relationship.
FIG. 4 is an explanatory diagram of an address map in another embodiment of the present invention.
FIG. 5 is an explanatory diagram of an example of an address conversion circuit (ACC) as a malfunction elimination unit provided in the bus controller of FIG. 1;
FIG. 6 is an explanatory diagram of a bus controller including a gate (G5) for ignoring all interrupts including NMI during erasing or writing of a flash memory as a built-in ROM.
FIG. 7 shows a control logic as a malfunction elimination means for resetting the erase control bit register, the write control bit register, and the verify control bit register of the built-in ROM when a write request occurs during the erase, write or verify of the built-in ROM. It is explanatory drawing which shows a circuit (G6).
8 is a logic circuit diagram showing an example of a generation circuit of the control signal (CONT) described in FIG. 3 and the control signal (CONT ′) described in FIG. 5;
9 is an explanatory diagram showing a programming method of the flash memory of the microcomputer of FIG. 1 in relation to a PROM mode and an on-board write mode.
FIG. 10 is an explanatory diagram showing in more detail the NMI vector address and the storage area of the NMI processing routine for it in the normal mode (single chip mode to external memory expansion mode) and the on-board rewrite mode of the flash memory.
FIG. 11 is a block diagram for explaining an NMI formation circuit in an on-board rewrite mode.
FIG. 12 is a flowchart showing a rewrite processing flow executed from the start to the end in the on-board rewrite mode (example of user program mode) of the flash memory.
FIG. 13 is a cross-sectional view of an example of a memory cell of a flash memory.
FIG. 14 is an explanatory diagram showing threshold values of the erase state and the write state of the memory cell of the flash memory.
FIG. 15 is a circuit diagram showing a configuration of a memory array of a flash memory.
FIG. 16 is an explanatory diagram showing an example of voltage conditions for an erase operation and a write operation on a memory cell of a flash memory.
FIG. 17 is a partial block diagram of a flash memory.
FIG. 18 is an overall block diagram of a flash memory.
FIG. 19 is an explanatory diagram showing an example of a control register of a flash memory.
[Explanation of symbols]
10 Interrupt control circuit
11 Clock oscillator
12 CPU
13 Built-in RAM
14 Host interface
15 Serial communication interface
16 A / D converter
17 D / A converter
18 Internal ROM
19 Watchdog timer
20 16-bit free-running timer
21 8-bit timer
22 PWM timer
24 address bus
25, 26 Data bus
27 Bus controller
28 Built-in RAM selection circuit
29 Built-in ROM selection circuit
30 Single-chip microcomputer
31 Built-in ROM / built-in RAM selection circuit
32 Erase control bit register
32 Write control bit register
33 Verify control bit register
G4, G5, G6 Gate
Claims (8)
前記第1半導体処理装置は、電気的に消去及び書込みが可能な不揮発性メモリと、前記不揮発性メモリとは別の記憶手段と、前記不揮発性メモリと前記記憶手段とにアクセス可能な中央処理装置と、割り込み端子とを有し、
前記第2半導体処理装置は前記第1半導体処理装置の割り込み端子に接続され、前記第1半導体処理装置へ割り込み信号を出力可能に構成され、
前記第1半導体処理装置は、前記中央処理装置により前記不揮発性メモリの消去及び書込みを行うオンボード書込みモードを有し、
前記第1半導体処理装置は、前記不揮発性メモリへのデータ書き込み動作開始前に、前記割り込み信号の入力に応じた処理のベクタアドレスを前記記憶手段の所定の記憶領域へ格納し、
前記オンボード書込みモードにおける前記不揮発性メモリへのデータ書込み動作途中に前記第2半導体処理装置からの割り込み信号の入力を受けた場合、前記割り込み信号の入力に応じた処理のベクタアドレス格納領域へのアクセスを前記不揮発性メモリの記憶領域から前記記憶手段の所定の記憶領域へ変更する制御部を前記第1半導体処理装置に有するデータ処理システム。A first semiconductor processing apparatus and a second semiconductor processing apparatus;
The first semiconductor processing apparatus includes an electrically erasable and erasable nonvolatile memory, a storage unit different from the nonvolatile memory, and a central processing unit accessible to the nonvolatile memory and the storage unit And an interrupt terminal,
The second semiconductor processing apparatus is connected to an interrupt terminal of the first semiconductor processing apparatus and configured to output an interrupt signal to the first semiconductor processing apparatus.
The first semiconductor processing apparatus has an on-board writing mode in which the nonvolatile memory is erased and written by the central processing unit,
The first semiconductor processing device stores a vector address of processing according to the input of the interrupt signal in a predetermined storage area of the storage means before starting a data write operation to the nonvolatile memory,
When receiving an interrupt signal from the second semiconductor processing device during the data write operation to the non-volatile memory in the on-board write mode, the processing corresponding to the input of the interrupt signal is transferred to the vector address storage area. The data processing system which has a control part which changes access from the storage area of the said non-volatile memory to the predetermined storage area of the said memory | storage means in the said 1st semiconductor processing apparatus.
前記オンボード書込みモードは、前記不揮発性メモリの全面を消去した後にデータの書込みを行うブートモードと、前記不揮発性メモリの一部を消去した後にデータの書込みを可能にするユーザブートモードとを含み、前記ブートモードと前記ユーザブートモードとを選択的に設定可能なモード設定手段を有するデータ処理システム。The data processing system of claim 1, wherein
The on-board write mode includes a boot mode for writing data after erasing the entire surface of the nonvolatile memory, and a user boot mode for enabling data writing after erasing a part of the nonvolatile memory. A data processing system comprising mode setting means capable of selectively setting the boot mode and the user boot mode.
前記ブートモードの設定に応答して実行開始されるブートプログラムの格納領域と、前記ブートプログラムの実行開始により外部から前記不揮発性メモリの消去及び書込み制御プログラムを入力するインタフェース回路と、前記インタフェース回路から入力した消去及び書込み制御プログラムを格納するRAMとを有し、前記中央処理装置は前記RAMに格納された消去及び書込み制御プログラムを実行して前記不揮発性メモリの消去及びデータの書込みを行うデータ処理システム。The data processing system according to claim 2, wherein
A storage area for a boot program to be started in response to the setting of the boot mode, an interface circuit for inputting an erase and write control program for the nonvolatile memory from the outside by the start of execution of the boot program, and the interface circuit A RAM for storing an input erase and write control program, and the central processing unit executes an erase and write control program stored in the RAM to erase the nonvolatile memory and write data system.
前記記憶手段は、前記RAMの所定の領域に割り当てられているデータ処理システム。The data processing system according to claim 3, wherein
The storage means is a data processing system assigned to a predetermined area of the RAM.
前記オンボード書込みモードにおける不揮発性メモリへのデータ書き込み動作途中に前記第2半導体処理装置から割り込み信号の入力を受けた場合、前記中央処理装置は、前記不揮発性メモリへのデータ書き込み動作を中止する制御を行うデータ処理システム。The data processing system of claim 1, wherein
When receiving an interrupt signal from the second semiconductor processing device during the data writing operation to the nonvolatile memory in the on-board writing mode, the central processing unit stops the data writing operation to the nonvolatile memory. A data processing system that performs control.
前記半導体処理装置は、電気的に消去及び書込みが可能な不揮発性メモリと、RAMと、前記不揮発性メモリにアクセス可能な中央処理装置と、制御手段と、割り込み端子とを有し、
前記第1半導体処理装置は、前記中央処理装置の制御において、前記不揮発性メモリの消去及び書込みを可能とする不揮発性メモリ書込みモードを有して成り、前記不揮発性メモリ書込みモードにおける不揮発性メモリへのデータ書き込み動作途中に前記割り込み端子を介して前記第1半導体処理装置が前記第2半導体処理装置から所定の割り込み信号の入力を受けた場合、前記中央処理装置は、前記所定の割り込み信号に応じた割り込み処理のベクタアドレスを前記RAMから取得するとともに、前記制御手段は、前記不揮発性メモリへのデータの書込みを中断する制御が可能に構成されたデータ処理システムの動作方法であって、
前記第1半導体処理装置と他の第2半導体処理装置とが前記基板に実装された後において、前記割り込み信号を前記割り込み端子に受ける前に、前記RAMに前記ベクタアドレスと、前記不揮発性メモリへの書込み制御用プログラムとを格納し、前記不揮発性メモリ書込みモードにおいて前記不揮発性メモリへ格納するプログラムデータの書込みを前記書込み制御用プログラムを用いて行い、
前記割り込み信号を前記割り込み端子に受けた場合、前記中央処理装置は前記RAMから前記割り込み信号に応じた前記ベクタアドレスを取得し、前記制御手段は前記割り込み信号に応じて前記不揮発性メモリへのデータ書き込みを中断する制御を行うデータ処理システムの動作方法。A first semiconductor processing apparatus and another second semiconductor processing apparatus are mounted on a substrate;
The semiconductor processing apparatus includes a nonvolatile memory that can be electrically erased and written, a RAM, a central processing unit that can access the nonvolatile memory, a control unit, and an interrupt terminal.
The first semiconductor processing device has a nonvolatile memory write mode that enables erasing and writing of the nonvolatile memory in the control of the central processing unit, and to the nonvolatile memory in the nonvolatile memory write mode. When the first semiconductor processing apparatus receives a predetermined interrupt signal from the second semiconductor processing apparatus via the interrupt terminal during the data write operation, the central processing unit responds to the predetermined interrupt signal. And obtaining the vector address of the interrupt processing from the RAM, and the control means is an operation method of a data processing system configured to be capable of interrupting the writing of data to the nonvolatile memory,
After the first semiconductor processing device and another second semiconductor processing device are mounted on the substrate, the RAM receives the vector address and the nonvolatile memory before receiving the interrupt signal at the interrupt terminal. And writing program data to be stored in the non-volatile memory in the non-volatile memory write mode using the write control program,
When the interrupt signal is received at the interrupt terminal, the central processing unit acquires the vector address corresponding to the interrupt signal from the RAM, and the control means sends data to the nonvolatile memory according to the interrupt signal. A method of operating a data processing system that performs control to interrupt writing.
前記不揮発性メモリ書込みモードにおいて、前記書込み制御プログラムを外部から前記RAMへ格納した後、前記中央処理装置は前記RAMから前記書込み制御プログラムをフェッチして前記不揮発性メモリの消去及びデータの書込み制御を行うデータ処理システムの動作方法。The operation method of the data processing system according to claim 6,
In the non-volatile memory write mode, after the write control program is stored in the RAM from the outside, the central processing unit fetches the write control program from the RAM to control the erasure of the non-volatile memory and data write control. How the data processing system operates.
前記半導体処理装置は更にアドレス変換手段を有し、
前記不揮発性メモリ書込みモードにおいて、前記割り込み端子に所定の信号の入力を受けた場合に、当該割り込み端子に受けた所定の信号に応じた処理へ分岐するためのアドレスを、前記アドレス変換手段を用いて前記不揮発性メモリのアドレス領域から前記RAMのアドレス領域へ変更するデータ処理システムの動作方法。The operation method of the data processing system according to claim 7,
The semiconductor processing apparatus further includes address conversion means,
In the nonvolatile memory write mode, when a predetermined signal is input to the interrupt terminal, an address for branching to a process corresponding to the predetermined signal received at the interrupt terminal is used by the address conversion unit. And a data processing system operating method for changing from the address area of the nonvolatile memory to the address area of the RAM.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2001116270A JP3669625B2 (en) | 1995-02-07 | 2001-04-16 | Data processing system and method of operating data processing system |
Applications Claiming Priority (3)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP7-42301 | 1995-02-07 | ||
JP4230195 | 1995-02-07 | ||
JP2001116270A JP3669625B2 (en) | 1995-02-07 | 2001-04-16 | Data processing system and method of operating data processing system |
Related Parent Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP35325695A Division JP3292864B2 (en) | 1995-02-07 | 1995-12-27 | Data processing device |
Publications (2)
Publication Number | Publication Date |
---|---|
JP2001350642A JP2001350642A (en) | 2001-12-21 |
JP3669625B2 true JP3669625B2 (en) | 2005-07-13 |
Family
ID=26381959
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2001116270A Expired - Fee Related JP3669625B2 (en) | 1995-02-07 | 2001-04-16 | Data processing system and method of operating data processing system |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP3669625B2 (en) |
Families Citing this family (1)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
CN108763760B (en) * | 2018-05-29 | 2022-03-22 | 西安微电子技术研究所 | System-level chip based on two-stage BOOT structure |
-
2001
- 2001-04-16 JP JP2001116270A patent/JP3669625B2/en not_active Expired - Fee Related
Also Published As
Publication number | Publication date |
---|---|
JP2001350642A (en) | 2001-12-21 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
JP3292864B2 (en) | Data processing device | |
US20070083745A1 (en) | Data processor | |
US6643725B1 (en) | Memory card having a buffer memory for storing testing instruction | |
US20020129195A1 (en) | Microcomputer with built-in programmable nonvolatile memory | |
US6189070B1 (en) | Apparatus and method for suspending operation to read code in a nonvolatile writable semiconductor memory | |
JPH1050078A (en) | Erasing method and program protecting method and device for electrically erasable and programmable read only memory | |
US7613928B2 (en) | Flash device security method utilizing a check register | |
JP2002157235A (en) | Microcontroller | |
EP0370529B1 (en) | Microcomputer having EEPROM | |
JP3152535B2 (en) | Data processing device | |
US20080034150A1 (en) | Data processing circuit | |
JP2002015584A (en) | Read/protect circuit for non-volatile memory | |
JP3669625B2 (en) | Data processing system and method of operating data processing system | |
JP2005202984A (en) | Data processor and single-chip microcomputer | |
JP2000250665A (en) | Semiconductor integrated circuit and memory card | |
EP0708446B1 (en) | Data processor having operating modes selected by at least one mask option bit and method therefor | |
JP2002132746A (en) | Data processor and single chip microcomputer | |
US5559981A (en) | Pseudo static mask option register and method therefor | |
JP3197865B2 (en) | Microcomputer | |
JP2000099346A (en) | Data processor | |
JP3028567B2 (en) | Microcomputer with built-in EEPROM | |
JP2000250661A (en) | Semiconductor integrated circuit and memory card | |
JP2000020498A (en) | Microcomputer and its restoring method | |
JP2581057B2 (en) | Evaluation microcomputer | |
JP2006221677A (en) | Memory card |
Legal Events
Date | Code | Title | Description |
---|---|---|---|
A977 | Report on retrieval |
Free format text: JAPANESE INTERMEDIATE CODE: A971007 Effective date: 20040712 |
|
A131 | Notification of reasons for refusal |
Free format text: JAPANESE INTERMEDIATE CODE: A131 Effective date: 20040803 |
|
A521 | Written amendment |
Free format text: JAPANESE INTERMEDIATE CODE: A523 Effective date: 20041001 |
|
TRDD | Decision of grant or rejection written | ||
A01 | Written decision to grant a patent or to grant a registration (utility model) |
Free format text: JAPANESE INTERMEDIATE CODE: A01 Effective date: 20050407 |
|
A61 | First payment of annual fees (during grant procedure) |
Free format text: JAPANESE INTERMEDIATE CODE: A61 Effective date: 20050408 |
|
R150 | Certificate of patent or registration of utility model |
Free format text: JAPANESE INTERMEDIATE CODE: R150 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20080422 Year of fee payment: 3 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090422 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20090422 Year of fee payment: 4 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100422 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20100422 Year of fee payment: 5 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110422 Year of fee payment: 6 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110422 Year of fee payment: 6 |
|
S111 | Request for change of ownership or part of ownership |
Free format text: JAPANESE INTERMEDIATE CODE: R313111 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20110422 Year of fee payment: 6 |
|
R350 | Written notification of registration of transfer |
Free format text: JAPANESE INTERMEDIATE CODE: R350 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120422 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20120422 Year of fee payment: 7 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20130422 Year of fee payment: 8 |
|
FPAY | Renewal fee payment (event date is renewal date of database) |
Free format text: PAYMENT UNTIL: 20140422 Year of fee payment: 9 |
|
LAPS | Cancellation because of no payment of annual fees |