JP2006172331A - Microcontroller - Google Patents

Microcontroller Download PDF

Info

Publication number
JP2006172331A
JP2006172331A JP2004366971A JP2004366971A JP2006172331A JP 2006172331 A JP2006172331 A JP 2006172331A JP 2004366971 A JP2004366971 A JP 2004366971A JP 2004366971 A JP2004366971 A JP 2004366971A JP 2006172331 A JP2006172331 A JP 2006172331A
Authority
JP
Japan
Prior art keywords
diagnostic
register
peripheral module
data
peripheral
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Pending
Application number
JP2004366971A
Other languages
Japanese (ja)
Inventor
Hiromichi Yamada
弘道 山田
Yasuhiro Nakatsuka
康弘 中塚
Teruaki Sakata
輝昭 酒田
Kunihiko Tsunetomi
邦彦 恒冨
Takeshi Kataoka
健 片岡
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Renesas Technology Corp
Original Assignee
Renesas Technology Corp
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Renesas Technology Corp filed Critical Renesas Technology Corp
Priority to JP2004366971A priority Critical patent/JP2006172331A/en
Publication of JP2006172331A publication Critical patent/JP2006172331A/en
Pending legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To provide a microcontroller capable of diagnosing a peripheral module without applying a load to a CPU. <P>SOLUTION: In the microcontroler having the CPU 10, a ROM 20 and a RAM 21 which store an instruction executed by the CPU and data, peripheral modules 60, 61, 62, a CPU bus 70 to which the CPU, the ROM and the RAM are connected, a peripheral bus to which the peripheral modules are connected and a bus bridge 30 which connects the CPU bus with the peripheral bus, it has a RAM 50 connected to the peripheral bus and a diagnostic module 40 which reads a diagnostic program stored in the RAM and performs processing, the diagnostic module 40 reads a register of the peripheral module whose address is specified by the diagnostic program, compares comparison data to be specified by the diagnostic program with a value of the register of the peripheral module based on comparison conditions to be specified by the diagnostic program and outputs a signal indicating whether or not the comparison conditions are established. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、マイクロコントローラに係わり、特に高い信頼性を必要とする制御機器において使用されるマイクロコントローラに適用して有効な技術に関する。   The present invention relates to a microcontroller, and more particularly to a technique effective when applied to a microcontroller used in a control device that requires high reliability.

例えば、マイクロコントローラ(以下「マイコン」という)は、家電製品、AV機器、携帯電話、自動車、産業機械等の機器に組み込まれ、メモリに記憶されているプログラムにしたがって処理を行うことで、それぞれの機器の制御を行う装置である。   For example, a microcontroller (hereinafter referred to as a “microcomputer”) is incorporated in a device such as a home appliance, an AV device, a mobile phone, an automobile, or an industrial machine, and performs processing according to a program stored in a memory. It is a device that controls equipment.

このマイコンは、機器に組み込まれて利用されるというその性質上、機器の制御を行うために必要な性能を備え、かつ、安価であることが要求される。さらに、動作保証される使用条件の下で、正常に動作するという信頼性に対する要求も強い。   This microcomputer is required to have a performance necessary for controlling the device and to be inexpensive because of its nature of being incorporated in the device and used. Furthermore, there is a strong demand for reliability to operate normally under operating conditions where operation is guaranteed.

また、マイコンには、CPU、メモリの他に、タイマー、A/D変換、通信など、様々な種類の周辺モジュールが多数搭載されている。従来から用いられている高信頼化技術として、ECCやパリティチェック、ソフトウエア自己診断がある。ECC、パリティチェックはメモリ等の記憶素子に冗長なビットを付加しておくことにより、記憶素子に記憶されるデータが壊れた場合に、これを読み出し時に訂正、またはエラーを検出するものである。ソフトウエア自己診断とは、CPUのプログラム実行によって、CPU自身、メモリ、周辺モジュールが正しく機能するかを調べるものである。ソフトウエア自己診断は、診断のためのプログラムがあれば良いため、幅広く適用されている。ECCやパリティチェックは、自動車エンジン制御用など使用される環境が過酷で、特に信頼性が要求される分野において適用されている。   In addition to the CPU and memory, the microcomputer is equipped with a large number of various types of peripheral modules such as a timer, A / D conversion, and communication. Conventionally used high reliability technologies include ECC, parity check, and software self-diagnosis. In the ECC and parity check, redundant bits are added to a storage element such as a memory so that when data stored in the storage element is broken, this is corrected at the time of reading or an error is detected. The software self-diagnosis is to check whether the CPU itself, the memory, and the peripheral modules function correctly by executing the program of the CPU. Software self-diagnosis is widely applied because it only needs a program for diagnosis. ECC and parity check are applied in fields where the environment used for automobile engine control is severe and reliability is particularly required.

ところで、従来の診断技術のうち、ソフトウエア自己診断は、プログラムのみで実現でき、特別なハードウエアを必要としない。しかしながら、CPUのプログラム実行でこれを行うため、本来の機器制御に割り当てられる処理能力が低下することになる。言い換えると、機器制御の処理能力を落とさなくするには、ソフトウエア自己診断に必要な性能分を加算した、高性能なマイコンが必要ということになり、コストが高くなるという問題がある。あるいは、コストを優先して、使用するマイコンの処理能力で足りる範囲内に診断プログラムの処理を抑える必要がある。   By the way, among the conventional diagnostic techniques, software self-diagnosis can be realized only by a program, and no special hardware is required. However, since this is done by executing the program of the CPU, the processing capability assigned to the original device control is reduced. In other words, in order not to reduce the processing capability of device control, a high-performance microcomputer that adds the performance necessary for software self-diagnosis is necessary, which increases the cost. Or it is necessary to give priority to cost and to suppress the processing of the diagnostic program within a range that the processing capability of the microcomputer to be used is sufficient.

また、ECCやパリティチェックは、専用の論理回路でエラー訂正、エラー検出を行うため、CPUの処理に負荷をかけない。しかしながら、診断の対象が記憶素子に限定される。また、エラー訂正、エラー検出を行う論理回路が必要である。   In addition, since ECC and parity check perform error correction and error detection with a dedicated logic circuit, no load is imposed on the processing of the CPU. However, the object of diagnosis is limited to the memory element. In addition, a logic circuit that performs error correction and error detection is required.

このように、従来技術を用いて周辺モジュールの診断を行う場合、ソフトウエア自己診断による方法では、CPUの処理負荷が高くなるという問題がある。ECCやパリティチェックによる方法では、専用の論理回路が必要であり、これらの回路を必要としないマイコン用に設計済みの周辺モジュールを再利用できない。また、診断の対象が記憶素子に限定されるという制限がある。   As described above, when the peripheral module is diagnosed using the conventional technique, the method based on the software self-diagnosis has a problem that the processing load of the CPU increases. In the method based on ECC or parity check, a dedicated logic circuit is required, and peripheral modules designed for a microcomputer that does not require these circuits cannot be reused. In addition, there is a limitation that the object of diagnosis is limited to the memory element.

そこで、本発明の目的は、上記課題を解決し、CPUに処理負荷をかけずに、周辺モジュールの診断を行うための技術を提供することにある。   Therefore, an object of the present invention is to solve the above-described problems and provide a technique for diagnosing peripheral modules without applying a processing load to a CPU.

本発明の前記ならびにその他の目的と新規な特徴は、本明細書の記述および添付図面から明らかになるであろう。   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.

本願において開示される発明のうち、代表的なものの概要を簡単に説明すれば、次のとおりである。   Of the inventions disclosed in the present application, the outline of typical ones will be briefly described as follows.

上記目的を達成するため、本発明は、CPUと、CPUが実行する命令およびデータを記憶する第1のメモリと、タイマー、A/D変換、通信などの機能を有する周辺モジュールと、CPUと第1のメモリが接続されるCPUバスと、周辺モジュールが接続される周辺バスと、CPUが周辺モジュールをアクセスする場合に、CPUバスと周辺バスを接続するバスブリッジとを有する構成において、さらに、周辺バスに接続される第2のメモリと、第2のメモリに記憶された診断プログラムを読み出して処理を行う診断モジュールとを有する。この構成により、診断モジュールは、診断プログラムでアドレス指定される周辺モジュールのレジスタを読み出して、診断プログラムで指定される比較条件に基づき、診断プログラムで指定される比較データと周辺モジュールのレジスタの値とを比較し、この比較条件が成立したか否かを示す信号を出力する。このように、診断モジュールが診断プログラムに定義される条件に一致するか否かを判定することで、周辺モジュールの診断をCPUに負荷をかけずに行うことができる。   To achieve the above object, the present invention provides a CPU, a first memory for storing instructions and data executed by the CPU, a peripheral module having functions such as a timer, A / D conversion, and communication, a CPU, In a configuration having a CPU bus to which one memory is connected, a peripheral bus to which a peripheral module is connected, and a bus bridge for connecting the CPU bus and the peripheral bus when the CPU accesses the peripheral module, A second memory connected to the bus; and a diagnostic module for reading and processing a diagnostic program stored in the second memory. With this configuration, the diagnostic module reads the register of the peripheral module addressed by the diagnostic program, and based on the comparison condition specified by the diagnostic program, the comparison data specified by the diagnostic program and the register value of the peripheral module And a signal indicating whether or not this comparison condition is satisfied is output. As described above, by determining whether or not the diagnostic module matches the condition defined in the diagnostic program, the peripheral module can be diagnosed without imposing a load on the CPU.

また、本発明は、さらに、割込み要求をCPUに通知する割込みコントローラを有する構成により、診断モジュールが診断プログラムに定義される条件に一致するか否かを判定し、比較条件が不成立の場合には、割込みコントローラに診断エラー割込み要求を出力し、割込みコントローラが診断モジュールからの診断エラー割込みをCPUに通知し、CPUが診断エラー割込みに対応するプログラム処理を実行することができる。   Further, the present invention further determines whether or not the diagnostic module matches a condition defined in the diagnostic program by a configuration having an interrupt controller that notifies the CPU of an interrupt request, and if the comparison condition is not satisfied The diagnostic error interrupt request is output to the interrupt controller, the interrupt controller notifies the CPU of the diagnostic error interrupt from the diagnostic module, and the CPU can execute the program processing corresponding to the diagnostic error interrupt.

本願において開示される発明のうち、代表的なものによって得られる効果を簡単に説明すれば以下のとおりである。   Among the inventions disclosed in the present application, effects obtained by typical ones will be briefly described as follows.

本発明によれば、CPUに負荷をかけることなく、周辺モジュールの診断を行うことができる。   According to the present invention, it is possible to diagnose peripheral modules without imposing a load on the CPU.

以下、本発明の実施の形態を図面に基づいて詳細に説明する。なお、実施の形態を説明するための全図において、同一の部材には原則として同一の符号を付し、その繰り返しの説明は省略する。   Hereinafter, embodiments of the present invention will be described in detail with reference to the drawings. Note that components having the same function are denoted by the same reference symbols throughout the drawings for describing the embodiment, and the repetitive description thereof will be omitted.

本発明の概念は、プログラム(命令)に従って処理を行うマイコンに適用され、プログラムを処理するCPUと、プログラムとデータを記憶する第1のメモリと、CPUがプログラムを読み出し、データを読み書きするためのCPUバスとからなるCPUバス接続系と、タイマー、A/D変換、通信などの機能を有する周辺モジュールと、周辺モジュールへのデータの読み書きを行うための周辺バスとからなる周辺バス接続系と、CPUが周辺モジュールをアクセスする場合に、CPUバスと周辺バスを接続するバスブリッジとを有する構成において、周辺バスに接続され、周辺モジュールの診断プログラムを記憶する第2のメモリと、周辺バスに接続され、診断プログラムを読み出して解読し、周辺モジュールのレジスタを読み出して、診断プログラムに定義される条件に一致するか否かを判定し、結果を出力する機能を有する診断モジュールとを有するものである。さらに、割込み要求をCPUに通知する割込みコントローラを有し、診断モジュールが診断プログラムに定義される条件に一致するか否かを判定し、比較条件が不成立の場合には、割込みコントローラに診断エラー割込み要求を出力し、割込みコントローラが診断モジュールからの診断エラー割込みをCPUに通知し、CPUが診断エラー割込みに対応するプログラム処理を実行するものである。以下に詳細に説明する。   The concept of the present invention is applied to a microcomputer that performs processing in accordance with a program (instruction), a CPU that processes the program, a first memory that stores the program and data, and a CPU that reads the program and reads and writes data. A CPU bus connection system comprising a CPU bus, a peripheral bus connection system comprising a peripheral module having functions such as a timer, A / D conversion, communication, etc., and a peripheral bus for reading and writing data to and from the peripheral module; In a configuration having a CPU bus and a bus bridge for connecting the peripheral bus when the CPU accesses the peripheral module, the second memory is connected to the peripheral bus and stores the diagnostic program of the peripheral module, and connected to the peripheral bus The diagnostic program is read and decoded, and the peripheral module registers are read and diagnosed. It determines whether to match the conditions programmed defined, and has a diagnostic module having a function of outputting a result. In addition, it has an interrupt controller that notifies the CPU of an interrupt request, and determines whether or not the diagnostic module matches the conditions defined in the diagnostic program. A request is output, the interrupt controller notifies the CPU of a diagnostic error interrupt from the diagnostic module, and the CPU executes a program process corresponding to the diagnostic error interrupt. This will be described in detail below.

図1は、本発明を適用した一実施の形態のマイコンを説明するためのブロック図である。   FIG. 1 is a block diagram for explaining a microcomputer according to an embodiment to which the present invention is applied.

本実施の形態のマイコン1は、プログラムを実行するCPU10と、プログラムおよびデータを記憶する第1のメモリとして機能するROM20およびRAM(1)21と、CPU10とROM20およびRAM21が接続されるCPUバス70と、タイマー、A/D変換、通信などの機能を有する周辺モジュール(1)60,(2)61,(N)62と、周辺モジュール60,61,62の診断プログラムを記憶する第2のメモリとして機能するRAM(2)50と、RAM50に記憶された診断プログラムを読み出して処理を行う診断モジュール40と、周辺モジュール60,61,62とRAM50および診断モジュール40が接続される周辺バス80と、CPUバス70と周辺バス80を接続するバスブリッジ30と、周辺バス80とCPU10および診断モジュール40に接続され、割込み要求をCPU10に通知する割込みコントローラ90と、周辺バス80に接続され、外部とのデータの入出力を行う外部バスコントローラ91などを備えて構成される。   The microcomputer 1 of the present embodiment includes a CPU 10 that executes a program, a ROM 20 and a RAM (1) 21 that function as a first memory that stores programs and data, and a CPU bus 70 to which the CPU 10, the ROM 20, and the RAM 21 are connected. And peripheral modules (1) 60, (2) 61, (N) 62 having functions such as a timer, A / D conversion, and communication, and a second memory for storing diagnostic programs for the peripheral modules 60, 61, 62 A RAM (2) 50 that functions as: a diagnostic module 40 that reads and processes a diagnostic program stored in the RAM 50; a peripheral bus 60 to which the peripheral modules 60, 61, 62 and the RAM 50 and the diagnostic module 40 are connected; A bus bridge 30 connecting the CPU bus 70 and the peripheral bus 80, and a peripheral bus 80 Is connected to the CPU 10 and the diagnostic module 40, the interrupt controller 90 notifies the interrupt request to the CPU 10, is connected to the peripheral bus 80, and includes a like external bus controller 91 for inputting and outputting data with the outside.

このマイコン1は、外部バスコントローラ91を通じて外部バス2に接続され、また、周辺モジュール62が通信端子を通じてネットワーク3に接続され、さらに、周辺モジュール61がアナログ入力端子を通じてセンサー4に接続されている。   The microcomputer 1 is connected to the external bus 2 through the external bus controller 91, the peripheral module 62 is connected to the network 3 through a communication terminal, and the peripheral module 61 is connected to the sensor 4 through an analog input terminal.

CPUバス70は、CPU10がプログラムの読み出し、データの入出力のためのアクセスを行うために使用する信号線の束で、アクセスの種類を示すコマンド、アドレス、データの情報を含む。   The CPU bus 70 is a bundle of signal lines used by the CPU 10 to perform access for program reading and data input / output, and includes information on commands, addresses, and data indicating access types.

周辺バス80は、RAM50の読み出しと書き込み、周辺モジュール60,61,62に含まれるレジスタの読み出しおよび書き込みのためのアクセスを行うために使用する信号線の束である。   The peripheral bus 80 is a bundle of signal lines used for reading and writing to the RAM 50 and accessing for reading and writing of registers included in the peripheral modules 60, 61 and 62.

バスブリッジ30は、CPU10が診断モジュール40、RAM50、周辺モジュール60,61,62をアクセスする場合に、CPUバス70と周辺バス80を接続して、コマンド、アドレス、データを転送する機能を有する。   The bus bridge 30 has a function of connecting the CPU bus 70 and the peripheral bus 80 and transferring commands, addresses, and data when the CPU 10 accesses the diagnostic module 40, the RAM 50, and the peripheral modules 60, 61, and 62.

診断モジュール40は、RAM50に記憶された診断プログラムを読み出し、解読し、周辺モジュール60,61,62に含まれるレジスタを読み出して、診断プログラムに定義される条件に一致するか否かを判定し、結果を出力する。診断モジュールの判定結果は、例えば割込みコントローラ90に入力され、判定結果が不一致の場合には、周辺モジュールのレジスタの値が不正であるとみなし、CPU10に割り込み処理を実行させるという使用方法が考えられる。   The diagnostic module 40 reads and decodes the diagnostic program stored in the RAM 50, reads the registers included in the peripheral modules 60, 61, and 62, determines whether or not the conditions defined in the diagnostic program are met, Output the result. The determination result of the diagnostic module is input to, for example, the interrupt controller 90. If the determination results do not match, it is considered that the register value of the peripheral module is invalid and the CPU 10 executes interrupt processing. .

図2は、図1における診断モジュール40の主要な機能を説明するためのブロック図である。   FIG. 2 is a block diagram for explaining the main functions of the diagnostic module 40 in FIG.

制御状態レジスタ400は、診断モジュール40の動作を制御するとともに、状態を知るためのレジスタである。診断プログラムアドレスレジスタ401は、診断プログラムのアドレスを保持するレジスタである。診断対象アドレスレジスタ402は、診断対象となる周辺モジュールレジスタのアドレスを保持するレジスタである。診断対象データレジスタ403は、診断対象となる周辺モジュールレジスタのデータを保持するレジスタである。比較データレジスタ404は、診断対象データレジスタ403と比較するデータを保持するレジスタである。マスクデータレジスタ405は、診断対象データレジスタ403と比較データレジスタ404の比較を行うビットを指定するレジスタである。比較条件レジスタ406は、診断対象データレジスタ403と比較データレジスタ404の比較条件を保持するレジスタである。   The control status register 400 is a register for controlling the operation of the diagnostic module 40 and knowing the status. The diagnostic program address register 401 is a register that holds the address of the diagnostic program. The diagnosis target address register 402 is a register that holds the addresses of peripheral module registers to be diagnosed. The diagnosis target data register 403 is a register that holds data of peripheral module registers to be diagnosed. The comparison data register 404 is a register that holds data to be compared with the diagnosis target data register 403. The mask data register 405 is a register that designates a bit to be compared between the diagnosis target data register 403 and the comparison data register 404. The comparison condition register 406 is a register that holds comparison conditions of the diagnosis target data register 403 and the comparison data register 404.

これらのレジスタは、図1における周辺バス80を使ってアクセスされる。8003は、周辺バス80のデータバスであり、診断モジュール40のレジスタの書き込み端子に接続される。診断プログラムアドレスレジスタ401は、周辺バス80からの書き込みの他、診断モジュール40が生成する診断プログラムアドレスの書き込みが行われる。411は診断プログラムアドレス生成回路であり、診断プログラムアドレスレジスタ401のデータ4010を入力して、次の診断プログラムアドレス4110を生成する。410は、診断プログラムアドレス書き込みデータの選択回路で、その出力データ4100が診断プログラムアドレスレジスタ401への書き込みデータとなる。診断モジュール出力データ選択回路413は、制御状態4000、診断プログラムアドレス4010、診断対象アドレス4020、診断対象データ4030、比較データ4040、マスクデータ4050、比較条件4060からデータを選択し、診断モジュール読み出しデータ4130を出力する。診断モジュール読み出しデータ4130は、バッファ422を介して、周辺バスデータ8003に出力される。   These registers are accessed using the peripheral bus 80 in FIG. Reference numeral 8003 denotes a data bus of the peripheral bus 80, which is connected to a register write terminal of the diagnostic module 40. In the diagnostic program address register 401, in addition to writing from the peripheral bus 80, the diagnostic program address generated by the diagnostic module 40 is written. Reference numeral 411 denotes a diagnostic program address generation circuit which inputs data 4010 in the diagnostic program address register 401 and generates the next diagnostic program address 4110. Reference numeral 410 denotes a diagnostic program address write data selection circuit, and the output data 4100 serves as write data to the diagnostic program address register 401. The diagnosis module output data selection circuit 413 selects data from the control state 4000, the diagnosis program address 4010, the diagnosis object address 4020, the diagnosis object data 4030, the comparison data 4040, the mask data 4050, and the comparison condition 4060, and the diagnosis module read data 4130. Is output. The diagnostic module read data 4130 is output to the peripheral bus data 8003 via the buffer 422.

比較回路432は、診断対象データ4030とマスクデータ4050をマスク回路430で演算した結果4300と、比較データ4040とマスクデータ4050をマスク回路431で演算した結果4310を、比較条件4060に基づき比較し、比較結果4320を出力する。マスク回路430と431におけるマスク演算は、入力データの論理積で行うことができる。   The comparison circuit 432 compares the result 4300 obtained by calculating the diagnosis target data 4030 and the mask data 4050 by the mask circuit 430 and the result 4310 obtained by calculating the comparison data 4040 and the mask data 4050 by the mask circuit 431 based on the comparison condition 4060. The comparison result 4320 is output. Mask operations in the mask circuits 430 and 431 can be performed by logical product of input data.

制御論理440は、周辺バス80から診断モジュール40のレジスタのアクセスに対してのデータ読み出しと書き込みの制御と、診断プログラム実行の制御を行う。周辺バス80からのアクセスにおいては、周辺バスコマンド8001を入力し、アクセス無し、読み出し、書き込みの操作の解読を行う。また、周辺バスアドレス8002を入力し、アクセス対象となるレジスタの判定を行う。診断プログラムの実行時には、診断モジュール40が周辺バス80のアクセスを行う。周辺バス要求信号4401を出力し、周辺バスの使用許可を示す周辺バス要求応答信号8000が返ると、周辺バスアクセスを開始する。制御論理440が生成した周辺バスコマンド4400を、バスドライバ420を通じて、周辺制御バス8001に出力する。また、診断プログラム読み出し時には、診断プログラムアドレス4010を選択回路412で選択し、選択された信号4120をバスドライバ421を通じて周辺アドレスバス8002に出力する。診断対象の周辺モジュールレジスタ読み出し時には、診断対象アドレス4020を選択回路412で選択し、選択された信号4120をバスドライバ421を通じて周辺アドレスバス8002に出力する。診断プログラムの実行において、診断終了を示すプログラムを実行した場合、診断終了割込み信号4402を出力することができる。また、比較結果4320が不一致を示した場合、診断エラー割り込み信号4403を出力することができる。   The control logic 440 controls data reading and writing for the access of the register of the diagnostic module 40 from the peripheral bus 80, and controls the execution of the diagnostic program. In accessing from the peripheral bus 80, the peripheral bus command 8001 is input, and the operations of no access, read and write are decoded. In addition, the peripheral bus address 8002 is input to determine the register to be accessed. When executing the diagnostic program, the diagnostic module 40 accesses the peripheral bus 80. When the peripheral bus request signal 4401 is output and the peripheral bus request response signal 8000 indicating permission of use of the peripheral bus is returned, the peripheral bus access is started. The peripheral bus command 4400 generated by the control logic 440 is output to the peripheral control bus 8001 through the bus driver 420. When reading the diagnostic program, the diagnostic program address 4010 is selected by the selection circuit 412, and the selected signal 4120 is output to the peripheral address bus 8002 through the bus driver 421. When reading the peripheral module register to be diagnosed, the diagnosis target address 4020 is selected by the selection circuit 412, and the selected signal 4120 is output to the peripheral address bus 8002 through the bus driver 421. In the execution of the diagnosis program, when a program indicating the end of diagnosis is executed, a diagnosis end interrupt signal 4402 can be output. If the comparison result 4320 indicates a mismatch, a diagnostic error interrupt signal 4403 can be output.

図3は、診断プログラムの形式を示す図である。(1)は、次に読み出す診断プログラムのアドレスを指定する形式である。すなわち、診断プログラムのアドレスを設定するための形式であり、8ビットのコマンド部分と32ビットの診断プログラムアドレス部分からなる。(2)は、読み出す周辺モジュールレジスタのアドレスと、周辺モジュールレジスタの値と比較するデータとを指定する形式である。すなわち、周辺モジュールレジスタの比較の方法を設定するための形式であり、8ビットのコマンド部分と32ビットの診断対象アドレス部分とDビットの比較データ部分からなる。(3)は、読み出す周辺モジュールレジスタのアドレスと、周辺モジュールレジスタの値と比較するデータと、周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式である。すなわち、周辺モジュールレジスタのマスク付き比較の方法を設定するための形式であり、8ビットのコマンド部分と32ビットの診断対象アドレス部分とDビットの比較データ部分とDビットのマスクデータ部分からなる。(4)は、診断モジュールの処理を終了させることを指定する形式である。すなわち、診断プログラム実行の終了を設定するための形式であり、8ビットのコマンド部分からなる。   FIG. 3 is a diagram showing the format of the diagnostic program. (1) is a format for designating the address of the diagnostic program to be read next. That is, it is a format for setting the address of the diagnostic program, and consists of an 8-bit command portion and a 32-bit diagnostic program address portion. (2) is a format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register. That is, it is a format for setting a method for comparing peripheral module registers, and consists of an 8-bit command portion, a 32-bit diagnosis target address portion, and a D-bit comparison data portion. (3) is a format for designating the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for designating the bit to be compared with the peripheral module register. That is, it is a format for setting a comparison method with a mask of a peripheral module register, and consists of an 8-bit command portion, a 32-bit diagnosis target address portion, a D-bit comparison data portion, and a D-bit mask data portion. (4) is a format for designating the termination of the diagnostic module processing. That is, it is a format for setting the end of the diagnostic program execution, and consists of an 8-bit command part.

図4は、図3における診断プログラムのコマンドの形式を示す図である。図4において、2ビットのTP1、TP0は、図3における(1)〜(4)のいずれの形式であるかを識別するための情報である。すなわち、コマンドのタイプを表すフィールドであり、その値と意味を図5に示す。値が00の場合、診断プログラムの形式は、図3における(1)の診断プログラムアドレス設定形式である。値が01の場合、診断プログラムの形式は、図3における(4)の診断終了形式である。値が10の場合、診断プログラムの形式は、図3における(2)の比較形式である。値が11の場合、診断プログラムの形式は、図3における(3)のマスク付き比較形式である。   FIG. 4 is a diagram illustrating a command format of the diagnostic program in FIG. In FIG. 4, 2-bit TP1 and TP0 are information for identifying which of the formats (1) to (4) in FIG. That is, it is a field representing the command type, and its value and meaning are shown in FIG. When the value is 00, the format of the diagnostic program is the diagnostic program address setting format (1) in FIG. When the value is 01, the format of the diagnosis program is the diagnosis end format (4) in FIG. When the value is 10, the format of the diagnostic program is the comparison format (2) in FIG. When the value is 11, the format of the diagnostic program is a comparison format with a mask (3) in FIG.

図4において、2ビットのSZ1、SZ0は、図3における(2),(3)のいずれかの形式の場合に、読み出す周辺モジュールレジスタのビット長を示す情報である。すなわち、診断対象データのサイズを表すフィールドであり、図3における(2)の比較形式の比較データのビットサイズDを指定し、(3)のマスク付き比較形式の比較データとマスクデータのビットサイズDを指定する。SZ1、SZ0の値と意味を図6に示す。値が00の場合、データサイズは8ビットであることを示す。値が01の場合、データサイズは16ビットであることを示す。値が11の場合、データサイズは32ビットであることを示す。値が10の場合、データサイズは未定義である。図3において比較データを参照する(2)および(3)の形式の診断プログラムの場合、SZ1、SZ0は、00、01、11のいずれかの値でなくてはならない。(1)および(4)の形式の診断プログラムの場合、SZ1、SZ0は意味を持たないため、いかなる値であっても良い。   In FIG. 4, 2-bit SZ1 and SZ0 are information indicating the bit length of the peripheral module register to be read in the case of any of the formats (2) and (3) in FIG. That is, it is a field that represents the size of the diagnosis target data, specifies the bit size D of the comparison data in the comparison format (2) in FIG. Specify D. The values and meanings of SZ1 and SZ0 are shown in FIG. A value of 00 indicates that the data size is 8 bits. A value of 01 indicates that the data size is 16 bits. A value of 11 indicates that the data size is 32 bits. When the value is 10, the data size is undefined. In the case of the diagnostic programs of the formats (2) and (3) that refer to the comparison data in FIG. 3, SZ1 and SZ0 must be one of 00, 01, and 11 values. In the case of the diagnostic programs of the formats (1) and (4), SZ1 and SZ0 have no meaning and may be any value.

図4において、2ビットのCM1、CM0は、図3における(2),(3)のいずれかの形式の場合に、周辺モジュールレジスタと比較データの比較条件として、一致、不一致、大きい、小さいを指定する情報である。すなわち、診断対象データの比較条件を表すフィールドであり、その値と意味を図7に示す。値が00の場合、比較条件は「診断対象データと比較データが一致」となる。値が01の場合、比較条件は「診断対象データと比較データが不一致」となる。値が10の場合、比較条件は「診断対象データが比較データより大きい」となる。値が11の場合、比較条件は「診断対象データが比較データより小さい」となる。図3において比較を行わない(1)および(4)の形式の診断プログラムの場合、CM1、CM0は意味を持たないため、いかなる値であっても良い。   In FIG. 4, 2-bit CM1 and CM0 are matched, mismatched, large or small as comparison conditions for the peripheral module register and the comparison data in the case of any of the formats (2) and (3) in FIG. Information to be specified. That is, it is a field that represents a comparison condition of diagnosis target data, and its value and meaning are shown in FIG. When the value is 00, the comparison condition is “the diagnosis target data matches the comparison data”. When the value is 01, the comparison condition is “the diagnosis target data does not match the comparison data”. When the value is 10, the comparison condition is “the diagnosis target data is larger than the comparison data”. When the value is 11, the comparison condition is “the diagnosis target data is smaller than the comparison data”. In the case of the diagnostic programs of the types (1) and (4) that do not perform comparison in FIG. 3, CM1 and CM0 have no meaning and may be any value.

図4において、1ビットのUPTは、図3における(2),(3)のいずれかの形式の場合に、診断モジュール40が診断プログラムの実行後に、読み出した周辺モジュールのレジスタに、診断プログラムで指定した比較データの値を書き込むか否かを指定する情報である。すなわち、診断プログラムの実行後に診断対象レジスタを比較データの値に更新するか否かを表すビットであり、その値と意味を図8に示す。値が0の場合、更新を行わないことを示し、値が1の場合、比較データで上書きすることを示す。図3において比較を行わない(1)および(4)の形式の診断プログラムの場合、UPTは意味を持たないため、いかなる値であっても良い。   In FIG. 4, 1-bit UPT is stored in the register of the peripheral module read out by the diagnostic module 40 after the diagnostic program is executed in the case of any of the formats (2) and (3) in FIG. This is information specifying whether or not to write the value of the specified comparison data. That is, it is a bit indicating whether or not the diagnosis target register is updated to the value of the comparison data after execution of the diagnostic program, and its value and meaning are shown in FIG. When the value is 0, it indicates that the update is not performed, and when the value is 1, it indicates that the comparison data is overwritten. In the case of the diagnostic programs of the types (1) and (4) that do not perform comparison in FIG. 3, UPT has no meaning and may be any value.

図4において、1ビットのUPEは、図3における(2),(3)のいずれかの形式の場合に、診断モジュール40が診断プログラムの実行後に、RAM50中の診断プログラムで指定した比較データに、読み出した周辺モジュールのレジスタの値を書き込むか否かを指定する情報である。すなわち、診断プログラムの実行後に診断プログラム中の比較データ部分を診断対象データの値に更新するか否かを表すビットであり、その値と意味を図9に示す。値が0の場合、更新を行わないことを示し、値が1の場合、診断対象データで上書きすることを示す。図3において比較を行わない(1)および(4)の形式の診断プログラムの場合、UPEは意味を持たないため、いかなる値であっても良い。   In FIG. 4, the 1-bit UPE is compared with the comparison data designated by the diagnostic program in the RAM 50 after the diagnostic module 40 executes the diagnostic program in the case of any of the formats (2) and (3) in FIG. This is information for designating whether or not to write the value of the read peripheral module register. That is, it is a bit indicating whether or not the comparison data part in the diagnostic program is updated to the value of the diagnosis target data after execution of the diagnostic program, and its value and meaning are shown in FIG. When the value is 0, it indicates that updating is not performed, and when the value is 1, it indicates that the diagnosis target data is overwritten. In the case of the diagnostic programs of the types (1) and (4) that do not perform comparison in FIG. 3, UPE has no meaning and may be any value.

図10は、図2における制御状態レジスタ400の詳細を示す図である。ビット15〜8のEX、IED、IER、WCYは診断モジュール40の動作を設定するための制御ビットであり、CPU10によって書き込みを行う。   FIG. 10 is a diagram showing details of the control state register 400 in FIG. EX, IED, IER, and WCY of bits 15 to 8 are control bits for setting the operation of the diagnostic module 40 and are written by the CPU 10.

EXは、診断イネーブルビットと呼び、RAM50に記憶されたプログラムを読み出して処理を実行することを指定するためのレジスタに格納され、CPU10から診断実行可および診断実行不可のいずれの値にも設定可能である。診断モジュール40に診断プログラムを実行させたい場合に1を書き込む。EXビットを1から0に書き換えると、現在実行中の診断プログラムが終了した後、停止状態になる。   EX is called a diagnostic enable bit, and is stored in a register for designating execution of processing by reading a program stored in the RAM 50, and can be set to any value from the CPU 10 where diagnosis can be executed and where diagnosis cannot be executed. It is. 1 is written when the diagnostic module 40 wants to execute the diagnostic program. When the EX bit is rewritten from 1 to 0, the currently running diagnostic program is terminated and then the stopped state is entered.

IEDは、診断終了割込みイネーブルビットと呼び、RAM50に記憶された診断モジュール40の処理を終了させることを指定する形式のプログラムを読み出した場合に、診断が終了したことを外部に出力するか否かを指定するためのレジスタに格納され、CPU10から読み出しおよび書き込み可能である。図3における(4)の診断終了形式のプログラムを実行した後に、割込み信号を発生させたい場合に1を書き込む。   The IED is called a diagnosis end interrupt enable bit, and whether or not to output the fact that the diagnosis has ended when a program of a format that specifies the end of the processing of the diagnosis module 40 stored in the RAM 50 is read. Can be read from and written to by the CPU 10. 1 is written when an interrupt signal is to be generated after executing the program of the diagnosis end format (4) in FIG.

IERは、診断エラー割込みイネーブルビットと呼び、RAM50に記憶された図3における(2),(3)のいずれかの形式のプログラムを実行し、プログラムで指定した診断条件が不成立の場合に、診断エラー割込み信号を出力するか否かを指定するためのレジスタに格納され、CPU10から読み出しおよび書き込み可能である。図3における(2)および(3)の形式の診断プログラムを実行し、比較結果が不一致となった場合に割込みを発生させたい場合に1を書き込む。   The IER is called a diagnostic error interrupt enable bit and executes a program in the format (2) or (3) in FIG. 3 stored in the RAM 50, and diagnoses when the diagnostic conditions specified by the program are not satisfied. It is stored in a register for designating whether or not to output an error interrupt signal, and can be read and written from the CPU 10. The diagnostic program in the format (2) and (3) in FIG. 3 is executed, and 1 is written when it is desired to generate an interrupt when the comparison results do not match.

WCYは、ウエイトサイクル数フィールドと呼び、診断プログラムの実行後に次の診断プログラムを読み出すまでのウエイトサイクル数を設定するレジスタに格納され、CPU10から読み出しおよび書き込み可能である。診断プログラム間に発生させるウエイトサイクル数を指定する。WCYの値とウエイトサイクル数の関係は、本発明を適用するマイコンにおいて適宜決定すれば良いが、例えばウエイトサイクル数は2のWCY乗とするなどが考えられる。   WCY is called a wait cycle number field, is stored in a register for setting the number of wait cycles until the next diagnostic program is read after execution of the diagnostic program, and can be read and written from the CPU 10. Specifies the number of wait cycles that occur between diagnostic programs. The relationship between the value of WCY and the number of wait cycles may be determined as appropriate in the microcomputer to which the present invention is applied. For example, the number of wait cycles may be 2 to the power of WCY.

ビット3〜1のFEX、FED、FERは、診断モジュール40の状態を表すビットである。   Bits 3 to 1 of FEX, FED, and FER are bits representing the state of the diagnostic module 40.

FEXは、診断実行中フラグと呼び、RAM50に記憶されたプログラムを読み出して処理を実行中であるか否かを示すためのレジスタに格納され、CPU10から読み出し可能である。診断モジュール40が診断プログラムを実行中である場合には1、停止状態にある場合には0が読み出される。   The FEX is called a diagnostic execution flag, and is stored in a register for indicating whether or not processing is being executed by reading a program stored in the RAM 50, and can be read from the CPU 10. 1 is read when the diagnostic module 40 is executing the diagnostic program, and 0 is read when the diagnostic module 40 is in the stopped state.

FEDは、診断終了フラグと呼び、診断が終了したか否かを示すためのレジスタに格納され、CPU10から読み出し可能である。診断モジュール40が図3における(4)の診断終了形式のプログラムを実行した後に値が1にセットされる。   The FED is called a diagnosis end flag, is stored in a register for indicating whether or not the diagnosis is completed, and can be read from the CPU 10. The value is set to 1 after the diagnosis module 40 executes the program of the diagnosis end type (4) in FIG.

FERは、診断エラーフラグと呼び、診断エラーが発生したか否かを示すためのレジスタに格納され、CPU10から読み出しおよび書き込み可能である。図3における(2)および(3)の形式の診断プログラムを実行し、結果が不一致となった場合に1にセットされる。   The FER is called a diagnostic error flag, is stored in a register for indicating whether or not a diagnostic error has occurred, and can be read and written from the CPU 10. This is set to 1 when the diagnostic programs of the formats (2) and (3) in FIG. 3 are executed and the results do not match.

ビット7〜4とビット0のRSVは予約ビットである。   Bits 7 to 4 and bit 0 RSV are reserved bits.

図11は、診断モジュール40の処理を示すフローチャートである。まず、診断可能か否かの判定を行う(S1)。この診断可能か否かの判定は、図10の制御状態レジスタ400を使って行う。EX=1かつFED=0かつFER=0の場合に、診断可能となる。すなわち、EX=1により診断プログラムの実行が許可されており、FED=0により診断が終了しておらず、FER=0により診断エラーが発生していない場合に、診断プログラムの実行が可能となる。上記以外の条件では、診断モジュール40は待機状態となる。   FIG. 11 is a flowchart showing the processing of the diagnostic module 40. First, it is determined whether or not diagnosis is possible (S1). Whether or not diagnosis is possible is determined using the control status register 400 of FIG. Diagnosis is possible when EX = 1, FED = 0, and FER = 0. That is, if the diagnosis program execution is permitted by EX = 1, the diagnosis is not completed by FED = 0, and no diagnosis error has occurred by FER = 0, the diagnosis program can be executed. . Under conditions other than the above, the diagnostic module 40 is in a standby state.

診断可能状態(Y)になると、診断モジュール40はRAM50に記憶された診断プログラムを読み出す(S2)。診断プログラムのコマンドを解析し(S3)、その形式が比較またはマスク付き比較の場合、アドレス設定の場合、診断終了の場合で、それぞれの処理を行う。   When the diagnosis is possible (Y), the diagnosis module 40 reads the diagnosis program stored in the RAM 50 (S2). The diagnostic program command is analyzed (S3), and each process is performed when the format is comparison or comparison with mask, address setting, or diagnosis end.

比較またはマスク付き比較の場合、コマンドに続く診断対象アドレス、比較データ、マスクデータを読み出し(S4)、続いて周辺モジュールレジスタを読み出し(S5)、比較データとの比較を行う(S6)。一致の場合は次のウエイト処理(S10)へ進み、不一致の場合は制御状態レジスタのFERを1にセットして(S7)、ウエイト処理(S10)へ進む。この時、制御状態レジスタのIERが1に設定されている場合は、診断エラー割込みを発生させる。   In the case of comparison or comparison with mask, the diagnosis target address, comparison data, and mask data following the command are read (S4), then the peripheral module register is read (S5), and compared with the comparison data (S6). If they match, the process proceeds to the next wait process (S10). If they do not match, the FER of the control status register is set to 1 (S7), and the process proceeds to the wait process (S10). At this time, if IER of the control status register is set to 1, a diagnostic error interrupt is generated.

コマンドがアドレス設定の場合、コマンドに続く診断プログラムアドレスを読み出し、図2における診断プログラムアドレスレジスタ401に設定して(S8)、次のウエイト処理(S10)に進む。   When the command is an address setting, the diagnostic program address following the command is read out, set in the diagnostic program address register 401 in FIG. 2 (S8), and the process proceeds to the next wait process (S10).

コマンドが診断終了の場合、制御状態レジスタのFEDを1にセットして(S9)、次のウエイト処理(S10)に進む。   If the command is a diagnosis end, the FED of the control status register is set to 1 (S9), and the process proceeds to the next wait process (S10).

ウエイト処理(S10)では、図10の制御状態レジスタ400のWCYで決まるサイクル数の間ウエイト状態となり、診断可能か否かの判定処理(S1)に戻る。   In the wait process (S10), a wait state is established for the number of cycles determined by WCY in the control state register 400 of FIG. 10, and the process returns to the determination process (S1) as to whether diagnosis is possible.

図12は、診断プログラム実行時の周辺バス80の動作を表したタイムチャートである。診断モジュール40は診断可能状態になると、周辺バス80のバスマスタであるバスブリッジ30に周辺バス要求を出力する。バスブリッジ30は周辺バス80のバス権を渡せるタイミングで周辺バス要求応答を返す。これを受けて診断モジュール40は周辺バス80のアクセスを開始する。診断プログラムiは、図3における(2)の比較形式であり、RAM50からコマンドPiR1、診断対象アドレスPiR2、比較データPiR3を読み出し、続いて診断対象アドレスが示す周辺モジュールレジスタから診断対象データDiR1を読み出す。診断プログラムiの実行が終わるとウエイト処理に入り、次の診断プログラムjの実行に移る。   FIG. 12 is a time chart showing the operation of the peripheral bus 80 when the diagnostic program is executed. When the diagnosis module 40 is ready for diagnosis, the diagnosis module 40 outputs a peripheral bus request to the bus bridge 30 which is the bus master of the peripheral bus 80. The bus bridge 30 returns a peripheral bus request response at a timing when the bus right of the peripheral bus 80 can be passed. In response to this, the diagnosis module 40 starts accessing the peripheral bus 80. The diagnostic program i has the comparison form (2) in FIG. 3, and reads the command PiR1, the diagnostic target address PiR2, and the comparison data PiR3 from the RAM 50, and then reads the diagnostic target data DiR1 from the peripheral module register indicated by the diagnostic target address. . When the execution of the diagnostic program i is finished, the process enters a wait process, and the next diagnostic program j is executed.

図13は、診断プログラムの実行で、比較結果が不一致となり診断エラー割込みが発生する場合を表したタイムチャートである。診断プログラムkは、図3における(3)のマスク付き比較形式であり、RAM50からコマンドPkR1、診断対象アドレスPkR2、比較データPkR3、マスクデータPkR4を読み出し、続いて診断対象アドレスが示す周辺モジュールレジスタから診断対象データDkR1を読み出す。マスク付き比較の結果が不一致となったため、診断エラー割込みが出力される。   FIG. 13 is a time chart showing the case where the comparison result is inconsistent and a diagnostic error interrupt occurs when the diagnostic program is executed. The diagnostic program k is a comparison format with a mask (3) in FIG. 3, and reads the command PkR1, the diagnostic target address PkR2, the comparative data PkR3, and the mask data PkR4 from the RAM 50, and then from the peripheral module register indicated by the diagnostic target address. The diagnosis target data DkR1 is read out. A diagnostic error interrupt is output because the result of the masked comparison did not match.

図14は、図3における(1)の診断プログラムアドレス設定の形式を実行した場合を表したタイムチャートである。診断プログラムnは、図3における(1)の診断プログラムアドレス設定形式であり、RAM50からコマンドPnR1、診断プログラムアドレスPnR2を読み出す。PnR2は図2における診断プログラムアドレスレジスタ401に設定される。診断プログラムnの実行後、ウエイト処理に入り、PnR2をアドレスとして診断プログラム1のコマンドP1R1を読み出す。   FIG. 14 is a time chart showing the case where the diagnostic program address setting format (1) in FIG. 3 is executed. The diagnostic program n has the diagnostic program address setting format (1) in FIG. 3, and reads the command PnR1 and the diagnostic program address PnR2 from the RAM 50. PnR2 is set in the diagnostic program address register 401 in FIG. After execution of the diagnostic program n, a wait process is started, and the command P1R1 of the diagnostic program 1 is read using PnR2 as an address.

図15は、図1におけるRAM50に記憶される診断プログラムの例を示す図である。図15において、1列のデータは1バイトである。診断プログラム1は、マスク付き比較形式であり、1バイトのコマンド1、4バイトの診断対象アドレス1、1バイトの比較データ1、1バイトの比較マスクデータ1からなる。診断プログラム2もマスク付き比較形式であるが、比較データと比較マスクデータのサイズが2バイトの例を示す。診断プログラムnは、診断対象アドレス設定形式であり、1バイトのコマンドn、4バイトの診断対象アドレスnからなる。診断対象アドレスnの値は、診断プログラム1のコマンド1のアドレスとすれば、診断プログラム1から診断プログラムnまでを無限に実行できる。   FIG. 15 is a diagram showing an example of a diagnostic program stored in the RAM 50 in FIG. In FIG. 15, one column of data is 1 byte. The diagnostic program 1 is a comparison format with a mask, and includes a 1-byte command 1, a 4-byte diagnosis target address 1, a 1-byte comparison data 1, and a 1-byte comparison mask data 1. Although the diagnostic program 2 is also a comparison format with a mask, the size of the comparison data and the comparison mask data is 2 bytes. The diagnosis program n has a diagnosis target address setting format, and includes a 1-byte command n and a 4-byte diagnosis target address n. If the value of the diagnosis target address n is the address of the command 1 of the diagnosis program 1, the diagnosis program 1 to the diagnosis program n can be executed infinitely.

図16は、本発明を適用した別の実施の形態のマイコンを説明するためのブロック図である。   FIG. 16 is a block diagram for explaining a microcomputer according to another embodiment to which the present invention is applied.

本実施の形態のマイコン1は、図1におけるROM20がマイコン1に内蔵されない代わりに、外部バス2に外部のROM5が接続されて構成される。他の構成は、図1と同様である。   The microcomputer 1 of this embodiment is configured by connecting an external ROM 5 to the external bus 2 instead of the ROM 20 in FIG. Other configurations are the same as those in FIG.

CPU10は、外部バス2を介してROM5から命令およびデータを読み出すことによってプログラムを実行する。ROM5には診断モジュール40が実行するプログラムも記憶されている。診断モジュール40はROM5から診断プログラムを読み出して実行することもできるし、例えばマイコン1をリセットした後にROM5からRAM50に診断プログラムを転送しておくことにより、RAM50から読み出して実行することも可能である。   The CPU 10 executes the program by reading instructions and data from the ROM 5 via the external bus 2. The ROM 5 also stores a program executed by the diagnostic module 40. The diagnostic module 40 can read and execute a diagnostic program from the ROM 5, or can read and execute the diagnostic program from the RAM 50 by transferring the diagnostic program from the ROM 5 to the RAM 50 after resetting the microcomputer 1, for example. .

以上のように、前記各実施の形態(図1、図16)のマイコン1によれば、CPU10が接続されたCPUバス70とは別の周辺バス80に接続され、周辺モジュール60,61,62の診断プログラムを記憶するRAM50と、このRAM50に記憶された診断プログラムを読み出して処理を行う診断モジュール40とを有することにより、診断モジュール40が、RAM50から診断プログラムを読み出して解読し、周辺モジュール60,61,62のレジスタを読み出して、診断プログラムに定義される条件に一致するか否かの判定による診断を行うことができるので、CPU10に負荷をかけることなく、周辺モジュール60,61,62の診断を行うことができる。   As described above, according to the microcomputer 1 of each of the above-described embodiments (FIGS. 1 and 16), the peripheral module 60, 61, 62 is connected to the peripheral bus 80 different from the CPU bus 70 to which the CPU 10 is connected. The diagnostic module 40 reads out and decodes the diagnostic program from the RAM 50, and reads the diagnostic program stored in the RAM 50. The peripheral module 60 reads out the diagnostic program from the RAM 50. , 61, 62 can be read out and diagnosis can be performed by determining whether or not the conditions defined in the diagnostic program are met, so that the peripheral modules 60, 61, and 62 can be controlled without imposing a load on the CPU 10. Diagnosis can be made.

本実施の形態に対して、例えば診断モジュールを持たない従来技術(図17)のマイコン1では、周辺バス80に接続されたRAM50および診断モジュール40がなかった。そのため、周辺モジュール60,61,62のレジスタをCPU10がソフトウエア処理で診断する場合には、RAM21にその診断用のプログラムを用意し、CPU10が診断プログラムおよび周辺モジュールレジスタを読み出して比較を行うことで実現できる。ただし、CPUバス70に比べて周辺バス80は低速クロックで動作させるため、CPU10が周辺モジュールをアクセスする場合には、多くのウエイトサイクルが入る。また、周辺モジュール診断を割込みによって起動させる場合には、割込み処理のオーバヘッドが加わる。このような課題が従来技術にはあったが、本実施の形態においては、上記のようにこれらの課題を解決することができる。   In contrast to the present embodiment, for example, in the microcomputer 1 of the prior art (FIG. 17) that does not have a diagnostic module, there is no RAM 50 and diagnostic module 40 connected to the peripheral bus 80. Therefore, when the CPU 10 diagnoses the registers of the peripheral modules 60, 61, and 62 by software processing, the diagnostic program is prepared in the RAM 21, and the CPU 10 reads the comparison program and the peripheral module registers for comparison. Can be realized. However, since the peripheral bus 80 is operated with a low-speed clock as compared with the CPU bus 70, many wait cycles are entered when the CPU 10 accesses the peripheral module. Further, when the peripheral module diagnosis is started by an interrupt, an overhead of interrupt processing is added. Although there existed such a subject in the prior art, in this Embodiment, these subjects can be solved as mentioned above.

さらに、本実施の形態によれば、割込み要求をCPU10に通知する割込みコントローラ90を有することにより、診断モジュール40が診断プログラムに定義される条件に一致するか否かを判定し、比較条件が不成立の場合には、割込みコントローラ90に診断エラー割込み要求を出力し、割込みコントローラ90が診断モジュール40からの診断エラー割込みをCPU10に通知し、CPU10が診断エラー割込みに対応するプログラム処理を実行することができる。   Furthermore, according to the present embodiment, by having the interrupt controller 90 that notifies the CPU 10 of an interrupt request, it is determined whether or not the diagnostic module 40 matches the conditions defined in the diagnostic program, and the comparison condition is not satisfied. In this case, a diagnostic error interrupt request is output to the interrupt controller 90, the interrupt controller 90 notifies the diagnostic error interrupt from the diagnostic module 40 to the CPU 10, and the CPU 10 executes a program process corresponding to the diagnostic error interrupt. it can.

以上、本発明者によってなされた発明を実施の形態に基づき具体的に説明したが、本発明は前記実施の形態に限定されるものではなく、その要旨を逸脱しない範囲で種々変更可能であることはいうまでもない。   As mentioned above, the invention made by the present inventor has been specifically described based on the embodiment. However, the present invention is not limited to the embodiment, and various modifications can be made without departing from the scope of the invention. Needless to say.

本発明は、マイコンに係わり、特に高い信頼性を必要とする制御機器において使用されるマイコンに適用して有効である。   The present invention relates to a microcomputer, and is particularly effective when applied to a microcomputer used in a control device that requires high reliability.

本発明を適用した一実施の形態のマイコンを説明するためのブロック図である。It is a block diagram for demonstrating the microcomputer of one Embodiment to which this invention is applied. 本発明を適用した一実施の形態において、図1における診断モジュールの主要な機能を説明するためのブロック図である。FIG. 2 is a block diagram for explaining main functions of a diagnostic module in FIG. 1 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、診断プログラムの形式を示す図である。In one Embodiment to which this invention is applied, it is a figure which shows the format of a diagnostic program. 本発明を適用した一実施の形態において、図3における診断プログラムのコマンドの形式を示す図である。FIG. 4 is a diagram showing a command format of the diagnostic program in FIG. 3 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図4においてコマンドの形式を表すTP1、TP0フィールドの値と意味を示す図である。FIG. 5 is a diagram showing values and meanings of TP1 and TP0 fields representing command formats in FIG. 4 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図4において診断対象データのサイズを表すSZ1、SZ0フィールドの値と意味を示す図である。In one Embodiment to which this invention is applied, it is a figure which shows the value and meaning of the SZ1, SZ0 field showing the size of diagnostic object data in FIG. 本発明を適用した一実施の形態において、図4において診断対象データの比較条件を表すCM1、CM0フィールドの値と意味を示す図である。FIG. 5 is a diagram showing values and meanings of CM1 and CM0 fields representing comparison conditions of diagnosis target data in FIG. 4 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図4において診断プログラムの実行後に診断対象レジスタを比較データの値に更新するか否かを表すUPTビットの値と意味を示す図である。FIG. 5 is a diagram illustrating the value and meaning of a UPT bit indicating whether or not a diagnosis target register is updated to a value of comparison data after execution of a diagnosis program in FIG. 4 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図4において診断プログラムの実行後に診断プログラム中の比較データ部分を診断対象データの値に更新するか否かを表すUPEビットの値と意味を示す図である。FIG. 5 is a diagram showing the value and meaning of a UPE bit indicating whether or not the comparison data portion in the diagnostic program is updated to the value of the diagnosis target data after execution of the diagnostic program in FIG. 4 according to an embodiment to which the present invention is applied. is there. 本発明を適用した一実施の形態において、図2における制御状態レジスタの詳細を示す図である。FIG. 3 is a diagram showing details of a control state register in FIG. 2 in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、診断モジュールの処理を示すフローチャートである。In one embodiment to which the present invention is applied, it is a flow chart which shows processing of a diagnostic module. 本発明を適用した一実施の形態において、診断プログラム実行時の周辺バスの動作を示すタイムチャートである。In one embodiment to which the present invention is applied, it is a time chart which shows operation of a peripheral bus at the time of execution of a diagnostic program. 本発明を適用した一実施の形態において、診断プログラムの実行で、比較結果が不一致となり診断エラー割込みが発生する場合を示すタイムチャートである。7 is a time chart showing a case where a comparison result is inconsistent and a diagnostic error interrupt occurs when a diagnostic program is executed in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図3における(1)の診断プログラムアドレス設定の形式を実行した場合を示すタイムチャートである。FIG. 4 is a time chart showing a case where a diagnostic program address setting format (1) in FIG. 3 is executed in an embodiment to which the present invention is applied. 本発明を適用した一実施の形態において、図1におけるRAMに記憶される診断プログラムの例を示す図である。FIG. 2 is a diagram illustrating an example of a diagnostic program stored in a RAM in FIG. 1 in an embodiment to which the present invention is applied. 本発明を適用した別の実施の形態のマイコンを説明するためのブロック図である。It is a block diagram for demonstrating the microcomputer of another embodiment to which this invention is applied. 本発明に対して、診断モジュールを持たない従来技術のマイコンを説明するためのブロック図である。It is a block diagram for demonstrating the microcomputer of a prior art which does not have a diagnostic module with respect to this invention.

符号の説明Explanation of symbols

1…マイコン、2…外部バス、3…ネットワーク、4…センサー、5…ROM、10…CPU、20…ROM、21…RAM、30…バスブリッジ、40…診断モジュール、50…RAM、60,61,62…周辺モジュール、70…CPUバス、80…周辺バス、90…割込みコントローラ、91…外部バスコントローラ、400…制御状態レジスタ、401…診断プログラムアドレスレジスタ、402…診断対象アドレスレジスタ、403…診断対象データレジスタ、404…比較データレジスタ、405…マスクデータレジスタ、406…比較条件レジスタ、410…選択回路、411…診断プログラムアドレス生成回路、412…選択回路、413…診断モジュール出力データ選択回路、420,421…バスドライバ、422…バッファ、430,431…マスク回路、432…比較回路、440…制御論理。   DESCRIPTION OF SYMBOLS 1 ... Microcomputer, 2 ... External bus, 3 ... Network, 4 ... Sensor, 5 ... ROM, 10 ... CPU, 20 ... ROM, 21 ... RAM, 30 ... Bus bridge, 40 ... Diagnostic module, 50 ... RAM, 60, 61 62 ... Peripheral module, 70 ... CPU bus, 80 ... Peripheral bus, 90 ... Interrupt controller, 91 ... External bus controller, 400 ... Control status register, 401 ... Diagnostic program address register, 402 ... Diagnosis target address register, 403 ... Diagnosis Target data register 404 ... Comparison data register 405 ... Mask data register 406 ... Comparison condition register 410 ... Selection circuit 411 ... Diagnostic program address generation circuit 412 ... Selection circuit 413 ... Diagnostic module output data selection circuit 420 421 Bus driver 422 Bar Fa, 430, 431 ... masking circuit, 432 ... comparison circuit 440 ... control logic.

Claims (21)

CPUと、前記CPUが実行する命令およびデータを記憶する第1のメモリと、周辺モジュールと、前記CPUと前記第1のメモリが接続されるCPUバスと、前記周辺モジュールが接続される周辺バスと、前記CPUが前記周辺モジュールをアクセスする場合に、前記CPUバスと前記周辺バスを接続するバスブリッジとを有するマイクロコントローラであって、
前記周辺バスに接続される第2のメモリと、前記第2のメモリに記憶された診断プログラムを読み出して処理を行う診断モジュールとを有し、
前記診断モジュールは、前記診断プログラムでアドレス指定される前記周辺モジュールのレジスタを読み出して、前記診断プログラムで指定される比較条件に基づき、前記診断プログラムで指定される比較データと前記周辺モジュールのレジスタの値とを比較し、この比較条件が成立したか否かを示す信号を出力することを特徴とするマイクロコントローラ。
A CPU, a first memory for storing instructions and data executed by the CPU, a peripheral module, a CPU bus to which the CPU and the first memory are connected, and a peripheral bus to which the peripheral module is connected A microcontroller having a bus bridge for connecting the CPU bus and the peripheral bus when the CPU accesses the peripheral module;
A second memory connected to the peripheral bus; and a diagnostic module for reading and processing a diagnostic program stored in the second memory;
The diagnostic module reads the register of the peripheral module addressed by the diagnostic program, and compares the comparison data specified by the diagnostic program and the register of the peripheral module based on the comparison condition specified by the diagnostic program. A microcontroller that compares a value and outputs a signal indicating whether or not the comparison condition is satisfied.
CPUと、前記CPUが実行する命令およびデータを記憶する第1のメモリと、周辺モジュールと、割込み要求を前記CPUに通知する割込みコントローラと、前記CPUと前記第1のメモリが接続されるCPUバスと、前記周辺モジュールが接続される周辺バスと、前記CPUが前記周辺モジュールをアクセスする場合に、前記CPUバスと前記周辺バスを接続するバスブリッジとを有するマイクロコントローラであって、
前記周辺バスに接続される第2のメモリと、前記第2のメモリに記憶された診断プログラムを読み出して処理を行う診断モジュールとを有し、
前記診断モジュールは、前記診断プログラムでアドレス指定される前記周辺モジュールのレジスタを読み出して、前記診断プログラムで指定される比較条件に基づき、前記診断プログラムで指定される比較データと前記周辺モジュールのレジスタの値とを比較し、この比較条件が成立したか否かを判定し、比較条件が不成立の場合には、前記割込みコントローラに診断エラー割込み要求を出力し、
前記割込みコントローラは、前記診断モジュールからの診断エラー割込みを前記CPUに通知し、
前記CPUは、前記診断エラー割込みに対応するプログラム処理を実行することを特徴とするマイクロコントローラ。
A CPU, a first memory for storing instructions and data executed by the CPU, a peripheral module, an interrupt controller for notifying the CPU of an interrupt request, and a CPU bus to which the CPU and the first memory are connected And a peripheral bus to which the peripheral module is connected, and a bus bridge that connects the CPU bus and the peripheral bus when the CPU accesses the peripheral module,
A second memory connected to the peripheral bus; and a diagnostic module for reading and processing a diagnostic program stored in the second memory;
The diagnostic module reads the register of the peripheral module addressed by the diagnostic program, and compares the comparison data specified by the diagnostic program and the register of the peripheral module based on the comparison condition specified by the diagnostic program. Value is compared to determine whether this comparison condition is satisfied, and if the comparison condition is not satisfied, a diagnostic error interrupt request is output to the interrupt controller,
The interrupt controller notifies the CPU of a diagnostic error interrupt from the diagnostic module;
The microcontroller executes a program process corresponding to the diagnostic error interrupt.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式を含むことを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The microcontroller includes a format for specifying an address of a peripheral module register to be read and data to be compared with a value of the peripheral module register.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式を含むことを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes a format for designating an address of a peripheral module register to be read, data to be compared with a value of the peripheral module register, and mask data for designating a bit to be compared with the peripheral module register. Microcontroller.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、次に読み出す診断プログラムのアドレスを指定する形式を含むことを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The microcontroller includes a format for designating an address of a diagnostic program to be read next.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、前記診断モジュールの処理を終了させることを指定する形式を含むことを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The microcontroller characterized in that the diagnostic program includes a format for designating the termination of the processing of the diagnostic module.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、
次に読み出す診断プログラムのアドレスを指定する形式と、
診断モジュールの処理を終了させることを指定する形式と、のいずれの形式であるかを識別するための情報を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes:
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
A format for designating an address of a peripheral module register to be read, data to be compared with the value of the peripheral module register, and mask data for designating a bit to be compared with the peripheral module register;
The format to specify the address of the diagnostic program to be read next,
A microcontroller having information for identifying which format is designated to end the processing of the diagnostic module, and which format is designated.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記読み出す周辺モジュールレジスタのビット長を示す情報を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes:
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, A microcontroller having information indicating a bit length of a peripheral module register to be read.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記周辺モジュールレジスタと比較データの比較条件として、一致、不一致、大きい、小さいを指定する情報を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes:
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, A microcontroller having information specifying match, mismatch, large, or small as a comparison condition between a peripheral module register and comparison data.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記診断プログラムが、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記診断プログラムの実行後に、読み出した周辺モジュールのレジスタに、前記診断プログラムで指定した比較データの値を書き込む機能を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module includes the diagnostic program,
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, A microcontroller having a function of writing a value of comparison data designated by the diagnostic program into a register of a read peripheral module after the diagnostic program is executed.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記診断モジュールが診断プログラムの実行後に、読み出した周辺モジュールのレジスタに、前記診断プログラムで指定した比較データの値を書き込むか否かを指定する情報を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes:
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, A microcontroller comprising: information specifying whether or not to write a value of comparison data specified by the diagnostic program into a register of a peripheral module that has been read after the diagnostic module has executed the diagnostic program.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記診断プログラムが、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記診断プログラムの実行後に、前記第2のメモリ中の前記診断プログラムで指定した比較データに、読み出した周辺モジュールのレジスタの値を書き込む機能を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module includes the diagnostic program,
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, A microcontroller having a function of writing a read register value of a peripheral module into comparison data designated by the diagnostic program in the second memory after execution of the diagnostic program.
請求項1または2記載のマイクロコントローラにおいて、
前記診断プログラムは、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式の場合に、前記診断モジュールが診断プログラムの実行後に、前記第2のメモリ中の前記診断プログラムで指定した比較データに、読み出した周辺モジュールのレジスタの値を書き込むか否かを指定する情報を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic program includes:
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
In the case of any one of the formats for specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data for specifying the bit to be compared with the peripheral module register, The diagnostic module has information for designating whether or not to write the value of the register of the read peripheral module into the comparison data designated by the diagnostic program in the second memory after the diagnostic program is executed. Microcontroller.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記第2のメモリに記憶されたプログラムを読み出して処理を実行することを指定するための診断イネーブルレジスタを有し、前記診断イネーブルレジスタは、前記CPUから診断実行可および診断実行不可のいずれの値にも設定可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module includes a diagnostic enable register for designating that the program stored in the second memory is read and the process is executed, and the diagnostic enable register can perform diagnostic execution from the CPU and perform diagnostic execution. A microcontroller that can be set to any of the impossible values.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記第2のメモリに記憶されたプログラムを読み出して処理を実行中であるか否かを示すための診断実行中状態レジスタを有し、前記診断実行中状態レジスタは、前記CPUから読み出し可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module includes a diagnostic execution status register for indicating whether the program stored in the second memory is read and processing is being executed, and the diagnostic execution status register is the CPU A microcontroller which can be read from
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記第2のメモリに記憶された、前記診断モジュールの処理を終了させることを指定する形式のプログラムを読み出した場合に、診断が終了したことを外部に出力する信号を有することを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module has a signal for outputting to the outside that the diagnosis has been completed when a program stored in the second memory is designated so that the process of the diagnostic module is to be terminated. A microcontroller characterized by
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記第2のメモリに記憶された、前記診断モジュールの処理を終了させることを指定する形式のプログラムを読み出した場合に、診断が終了したことを外部に出力するか否かを指定するための診断終了割込みイネーブルレジスタを有し、前記診断終了割込みイネーブルレジスタは、前記CPUから読み出しおよび書き込み可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
Whether or not to output the fact that the diagnosis has been completed to the outside when the diagnostic module reads out a program stored in the second memory that specifies the termination of the processing of the diagnostic module A microcontroller comprising a diagnostic end interrupt enable register for designating, wherein the diagnostic end interrupt enable register is readable and writable from the CPU.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、診断が終了したか否かを示すための診断終了状態レジスタを有し、前記診断終了状態レジスタは、前記CPUから読み出し可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
2. The microcontroller according to claim 1, wherein the diagnostic module includes a diagnostic end status register for indicating whether or not the diagnosis is completed, and the diagnostic end status register can be read from the CPU.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、前記第2のメモリに記憶された、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータとを指定する形式と、
読み出す周辺モジュールレジスタのアドレスと、前記周辺モジュールレジスタの値と比較するデータと、前記周辺モジュールレジスタの比較するビットを指定するマスクデータとを指定する形式と、のいずれかの形式のプログラムを実行し、前記プログラムで指定した診断条件が不成立の場合に、診断エラー割込み信号を出力するか否かを指定するための診断エラー割込みイネーブルレジスタを有し、前記診断エラー割込みイネーブルレジスタは、前記CPUから読み出しおよび書き込み可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module is stored in the second memory,
A format for designating the address of the peripheral module register to be read and the data to be compared with the value of the peripheral module register;
Execute a program in one of the formats: specifying the address of the peripheral module register to be read, the data to be compared with the value of the peripheral module register, and the mask data specifying the bit to be compared in the peripheral module register A diagnostic error interrupt enable register for designating whether or not to output a diagnostic error interrupt signal when a diagnostic condition designated by the program is not satisfied, and the diagnostic error interrupt enable register is read from the CPU And a writable microcontroller.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、診断エラーが発生したか否かを示すための診断エラー状態レジスタを有し、前記診断エラー状態レジスタは、前記CPUから読み出しおよび書き込み可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The microcontroller, wherein the diagnostic module has a diagnostic error status register for indicating whether or not a diagnostic error has occurred, and the diagnostic error status register is readable and writable from the CPU.
請求項1または2記載のマイクロコントローラにおいて、
前記診断モジュールは、診断プログラムの実行後に次の診断プログラムを読み出すまでのウエイトサイクル数を設定するウエイトサイクルレジスタを有し、前記ウエイトサイクルレジスタは、前記CPUから読み出しおよび書き込み可能であることを特徴とするマイクロコントローラ。
The microcontroller according to claim 1 or 2,
The diagnostic module has a wait cycle register for setting the number of wait cycles until the next diagnostic program is read after execution of the diagnostic program, and the wait cycle register is readable and writable from the CPU. A microcontroller to do.
JP2004366971A 2004-12-20 2004-12-20 Microcontroller Pending JP2006172331A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2004366971A JP2006172331A (en) 2004-12-20 2004-12-20 Microcontroller

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2004366971A JP2006172331A (en) 2004-12-20 2004-12-20 Microcontroller

Publications (1)

Publication Number Publication Date
JP2006172331A true JP2006172331A (en) 2006-06-29

Family

ID=36672994

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2004366971A Pending JP2006172331A (en) 2004-12-20 2004-12-20 Microcontroller

Country Status (1)

Country Link
JP (1) JP2006172331A (en)

Similar Documents

Publication Publication Date Title
US5717851A (en) Breakpoint detection circuit in a data processor and method therefor
JP3563768B2 (en) ROM program change device
JPH1078889A (en) Microcomputer
JP3432734B2 (en) DMA control device and DMA control method
JPS5938677B2 (en) Control word transfer control device
JP2006172331A (en) Microcontroller
CN110609705B (en) Method for improving MCU bus efficiency, intelligent terminal, storage medium and chip
EP0827080A2 (en) Mircrocomputer with selfdiagnostic unit
JP2004013289A (en) On-chip debugging method of microcontroller
JPH04280334A (en) One chip microcomputer
JP3433824B2 (en) Failure detection device for pulse input / output circuit
JP2004185060A (en) Microcomputer
JPH10312307A (en) Emulator for computer system
JPS63165931A (en) Storing system for information on discontinuous instruction fetch address
CN116361233A (en) Micro controller
JPH0782447B2 (en) DMA data transfer control device
JPS62269237A (en) Data processor
JPH0652333A (en) Single chip microcomputer
JPH11212945A (en) Microcomputer and it memory
JP2007206909A (en) Data processor and data processing method
JPS60201437A (en) Microprocessor
JPH0333939A (en) Microprocessor
JPH0535499A (en) Data processing device and method
JP2002150795A (en) Semiconductor integrated circuit
JPH04367902A (en) Programmable controller

Legal Events

Date Code Title Description
A621 Written request for application examination

Effective date: 20070205

Free format text: JAPANESE INTERMEDIATE CODE: A621

A977 Report on retrieval

Effective date: 20081119

Free format text: JAPANESE INTERMEDIATE CODE: A971007

A131 Notification of reasons for refusal

Effective date: 20090203

Free format text: JAPANESE INTERMEDIATE CODE: A131

A02 Decision of refusal

Effective date: 20090707

Free format text: JAPANESE INTERMEDIATE CODE: A02