[go: up one dir, main page]

JP2004265283A - Method and apparatus for automatically determining access mode of SPI memory - Google Patents

Method and apparatus for automatically determining access mode of SPI memory Download PDF

Info

Publication number
JP2004265283A
JP2004265283A JP2003056720A JP2003056720A JP2004265283A JP 2004265283 A JP2004265283 A JP 2004265283A JP 2003056720 A JP2003056720 A JP 2003056720A JP 2003056720 A JP2003056720 A JP 2003056720A JP 2004265283 A JP2004265283 A JP 2004265283A
Authority
JP
Japan
Prior art keywords
data
memory
read
access mode
serial memory
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.)
Granted
Application number
JP2003056720A
Other languages
Japanese (ja)
Other versions
JP4374416B2 (en
Inventor
Kazushige Maeno
一茂 前野
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.)
Toyo Communication Equipment Co Ltd
Original Assignee
Toyo Communication Equipment Co Ltd
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 Toyo Communication Equipment Co Ltd filed Critical Toyo Communication Equipment Co Ltd
Priority to JP2003056720A priority Critical patent/JP4374416B2/en
Publication of JP2004265283A publication Critical patent/JP2004265283A/en
Application granted granted Critical
Publication of JP4374416B2 publication Critical patent/JP4374416B2/en
Anticipated expiration legal-status Critical
Expired - Fee Related legal-status Critical Current

Links

Images

Landscapes

  • Memory System (AREA)

Abstract

【課題】シリアスメモリのDoポートから出力される読み出しデータの先頭の応答ビットと読み出しコマンドの先頭との時間間隔を検出し、この時間間隔によってメモリサイズを判定する方法は、応答ビットが付与されていないSPI準拠のシリアルメモリには適用できない
【解決手段】メモリサイズが道のメモリ1のDIポートに、書き込みコマンドに続き4バイトのゼロ(00h)を与えて書き込み処理(ステップf1)を行い、次に、読み出しコマンドに続き4バイトのゼロ(00h)を与えて判定データの読み出し処理(ステップf2)を行う。そして、読み出し処理で読み出された判定データにおける00hの出力パターンからメモリのアクセスモードを判定する。
【選択図】図1
A method of detecting a time interval between a response bit at the head of read data output from a Do port of a serial memory and a head of a read command and determining a memory size based on the time interval is provided with a response bit. This method cannot be applied to an SPI-compliant serial memory. [MEANS FOR SOLVING PROBLEMS] A write process is performed by giving a 4-byte zero (00h) following a write command to the DI port of the memory 1 having the memory size, and performing the next step (step f1). , Four bytes of zero (00h) are given following the read command, and the determination data is read (step f2). Then, the access mode of the memory is determined from the output pattern of 00h in the determination data read in the read processing.
[Selection diagram] Fig. 1

Description

【0001】
【発明の属する技術分野】
本発明は、シリアルメモリ、特にSPI準拠のシリアルメモリにおけるアクセスモードの自動判別方法に関する。
【0002】
【従来の技術】
近年、携帯端末等の電子機器に搭載されるメモリの容量は、半導体技術の進歩とともに、ますます増大してきている。そして、入出力のポート数が少ないため小型化にも対応しやすいシリアルインタフエースを備えたメモリが広く使用されていることは周知のとおりである。
図7は、一般的なシリアルメモリのブロック図と、アクセスのタイミングチャートである。同図(a)に示すように、一般的なシリアルメモリ11は、最低限、DI(入力)、Do(出力)、Cs(チップセレクト)、SK(シリアルクロック)の4つのポートを備えている。
前記DIポートは、書き込みコマンドあるいは読み出しコマンド、並びにアドレスを指定する一連のシリアルデータを入力するためのポートであり、Doポートは、メモリから読み出したシリアルデータを出力するポートである。
また、Csポートは、メモリをアクセス可能とするためのポートであって、該Csポートを所定のレベルに設定することによって、メモリはアクティブな状態となり、テータの書き込みあるいは読み出しの動作が可能になる。
さらに、SKポートは、シリアルクロックを入力するためのポートであって、Csポートを所定のレベルに設定後、シリアルクロックを入力し、該クロック信号に同期して所定の書き込みや読み出しを行う。
【0003】
同図(b)、(c)は、前記シリアルメモリの書き込み及び読み出しのタイミングチャートをそれぞれ示したものである。
同図(b)に示すように、前記シリアルメモリにデータの書き込みを行うときには、一旦CsポートをHiレベルからLoレベルに設定して、DIポートに書き込みコマンド、書き込みアドレス及び書き込みテータを一連のシリアルデータとして入力しておく。
そして、CsポートをLoレベルからHiレベルに戻すと、シリアルクロック信号に同期してメモリに書き込みが実行される。
一方、同図(c)に示すように、メモリからデータの読み出しを行うときには、CsポートをHiレベルからLoレベルに設定し、シリアルクロック信号をSKポートに入力する。そして、DIポートに読み出しコマンド及び読み出しアドレス及び必要バイト数のダミーデータを一連のシリアルデータとして入力すると、読み出しアドレスに対応したデータが、シリアルクロック信号に同期してDoポートから出力される。
【0004】
一般的に、電子機器に搭載されるシリアルメモリには、様々なメモリサイズのものが提供されているが、該シリアルメモリは、メモリサイズによって前記読み出し、あるいは書き込みアドレスのビット長のみが異なっている。
したがって、メモリサイズによって対応するアドレスのビット長だけを変えれば、様々なサイズをもつシリアルメモリに対し読み書き動作を実行することが可能である。
そして、機器等に搭載されたメモリのサイズが未知のものであっても、DIポートに入力するシリアルデータの先頭とDoポートから出力される読み出しデータのタイミングがメモリサイズによって異なることを利用して、メモリサイズを自動認識する方法が、特開2000−122921号公報において開示されている。
【0005】
【発明が解決しようとする課題】
しかしながら、前記特開2000−122921号に開示されているメモリサイズの自動認識方式は、以下のような問題点かある。
即ち、前記公報記載のメモリサイズ自動認識方法は、メモリサイズが未知のシリアルメモリのDIポートに、所定ビット長の読み出しコマンドと読み出しアドレスを入力したときに、Doポートから出力される読み出しデータの先頭の応答ビットと前記読み出しコマンドの先頭との時間間隔を検出し、この時間間隔によってメモリサイズを判定するものである。
但し、この場合、前記読み出しデータの先頭には前記Loレベルの応答ビットが付与されているものと想定している。
このため、例えば、応答ビットが付与されていないSPI(Serial Peripheral Interface)といった一般的に広く普及しているインタフェースのシリアルメモリには、この自動認識方法を適用できないという問題があった。
本発明は、上記課題を解決するためになされたものであって、応答ビットが付与されていないSPIに準拠したインタフェースのシリアルメモリのアクセスモードを自動的に判別することができる判別方法を提供することを目的とする。
【0006】
【課題を解決するための手段】
上記課題を解決するために、請求項1の発明においては、SPIに準拠したシリアルメモリにアクセスして、該シリアルメモリのメモリサイズを自動的に判別する方法であって、書き込みコマンドを含む所定のビット構成をもつ初期データを前記シリアルメモリメモリに供給して書込む処理を行うステップと、前記書込み処理の後に読み出しコマンドを含む所定のビット構成をもつ読み出しデータを前記シリアルメモリに供給して、前記初期データに基づく判定データを読出す処理を行うステップと、前記判定データに基づいて、メモリが必要とするアドレスデータのバイト数のことをメモリのアクセスモードと定義したときの前記シリアルメモリのアクセスモードを判定する処理を行うステップとを有することを特徴とする。
【0007】
請求項2の発明は、請求項1において前記シリアルメモリのデータ出力端の電位はHiレベルであって、前記初期データが書き込みコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hであり、前記読み出しデータが読み出しコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hであり、前記判定データはメモリから読み出される3バイトの出力データであって、読み出された判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする。
【0008】
請求項3の発明は、SPIに準拠したシリアルメモリのメモリサイズを自動的に判別する装置であって、前記シリアルメモリのデータ出力端の電位をHiレベルにするプルアップ抵抗を備え、所定のビット構成をもつ初期書き込みデータを出力する初期データ書き込み処理部と、所定のビット構成をもつ読み出しデータを前記シリアルメモリに供給しながら前記初期書き込みデータに基づく判定データを読出す判定データ読み出し処理部と、前記判定データに基づいて、前記シリアルメモリのアクセスモードを判定する判定処理部とを有することを特徴とする。
【0009】
請求項4の発明は、請求項3において、前記初期書き込みデータが、書き込みコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hの定型ビット列であり、前記読み出しデータが、読み出しコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hの定型ビット列であり、読み出された判定データをもとに、前記判定処理部において判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする。
【0010】
【発明の実施の形態】
以下、本発明を図面に示した実施の形態に基づいて説明する。図1は、本発明に係わるシリアルメモリのメモリサイズ自動判別装置が、SPIに準拠したインタフェースをもつシリアルメモリへアクセスする接続配線図と、そのアクセスモード判定処理フローチャートである。
図1(a)に示すように、本判別装置はCPU2とプルアップ抵抗3で構成され、図の点線で囲まれたメモリサイズが未知のシリアルメモリ1のDo、DI、SK、Csポートは、CPU2のそれぞれ対応するI/Oピンに接続される。
そして、前記Doポートは、プルアップ抵抗3で電源回路に接続されて、常時電位がHiのレベルになっている。
同図の回路構成において、CPU2がメモリ1のメモリサイズを判定する手順は、同図(b)のフローチャートに示されるように、初期データ書き込み処理(f1)、判定データ読み出し処理(f2)、及び判定処理(f3)の手順を順に行うことで実現される。
【0011】
前記フローチャートに示される処理手順を説明する前に、SPIに準拠したインタフェースのシリアルメモリのデータ構造と、ページ書き込み及び読み出しについて説明する。
一般にSPIインタフェースのシリアルメモリにはページという概念が使われている。これについて、アドレス8ビットのメモリを例に説明する。
図2(a)、(b)は、8ビットアドレスメモリのデータ構造を示したものである。
同図(a)に示される8ビットアドレスのメモリでは、アドレスを00h〜FFh(16進表示、以下、アドレス、データ等を16進表示で表現する場合は末尾にhを添字する)まで指定でき、D1〜D256(各データは1バイト単位)の合計256バイトのデータを書き込んで記憶させることができる。
【0012】
メモリにおける各データの何バイトかのまとまりを1ページと呼んでいる。
通常、1ページは、メモリサイズによって4、8、16、32、256バイトといった4の倍数のページサイズになっているのが一般的であり、ここでは1ページ4バイトとして説明する。
上記に従って、4バイト/ページとすると、8ビットアドレスのメモリは64ページのデータ構造となる。
【0013】
メモリにデータを書き込むとき、図7(b)のタイミングチャートに示されるように、DIポートに書き込みコマンドと1バイトのアドレスを入力し、それに続いて書き込みデータを所定のバイト分連続的に入力する。すると、前記書き込みデータは前記アドレスから順番に1バイトづつ同一ページ内に連続的に書き込まれる。例えば、8ビットアドレスのメモリでアドレスを00hに指定し、それに続いて4バイト分のデータを00h、01h、02h、03hとして入力すると、図2(b)に示されるように、アドレス00h〜03hに1バイトずつのデータ00h、01h、02h、03hが連続的に書き込まれる。
【0014】
一方、読み出しの場合は、読み出しコマンドと共にアドレスを入力し、それに続いて読み出すデータのバイト数と同数のダミーデータを入力する。
すると、前記アドレスから連続したアドレス順で、前記ダミーデータの入力に応じてデータが1バイトずつ連続的に読み出される。
なお、読み出しの場合ダミーデータを付加すれば、ページに関係なく連続的に読み出しが可能である。前記ダミーデータは、1バイトであればどのようなデータであっても構わない。
【0015】
次に、図1(b)の本発明のフローチャートに示される初期データ書き込み処理(f1)、判定データ読み出し処理(f2)、及び判定処理(f3)の手順を説明する。
ここで、メモリが必要とするアドレスデータのバイト数のことをメモリのアクセスモードと定義したうえで、メモリを図3のアクセスモード分類表のように、メモリの容量に応じて分類する。
【0016】
図4は、初期データ書き込み処理の詳細のフローチャート、初期データ書き込みのためCPUより出力される定型ビット列及び前記定型ビット列のアクセスモードごとの認識表である。
図4(a)のフローに示すように、初期データ書き込み処理は、CsポートをHiレベルからLoレベルに設定(f11)した後、CPU2からDIポートに、図4(b)に示す初期データ定型ビット列(1)、(2)、(3)、(4)、(5)が出力される。即ち、先ず、書き込みコマンド(1)が出力(f12)され、続いて4バイトのゼロ(00h)(2)〜(5)が出力(f13〜f16)される。
【0017】
次に、SKポートに所定のシリアルクロック信号を入力して、CsポートをLoレベルからHiレベルに戻す(f17)と、前記4バイトのゼロ(00h)がメモリ1に入力されて、所定のアドレスに後述のようにデータが書き込まれる。
なお、前記初期データを入力する場合や、後述する判定データの読み出しの場合には、図7に示すようにCsポートやSKポートには所定の信号が与えられるが、説明を簡単にするため、以下、それらの説明は省略する。
【0018】
CPU2よりメモリ1に出力された(1)〜(5)で構成される前記定型ビット列のうち(2)〜(5)の4バイトのゼロ(00h)は、メモリ1のアクセスモードごとに異なる認識をされる。
図4(c)は、前記4バイトのゼロ(00h)に対するアクセスモードごとの認識の違いを示す表である。
同図に示すように、アクセスモード1の場合は、1番目のゼロ(2)はアドレス(アドレス0番)、2〜4番目のゼロ(3)〜(5)は1〜3番目の書込みデータ(00h)と、それぞれ認識される。
アクセスモード2の場合は、1番目のゼロ(2)は上位アドレス、2番目のゼロ(3)は下位アドレス、3、4番目のゼロ(4)、(5)は1、2番目の書込みデータ(00h)と、それぞれ認識される。
【0019】
アクセスモード3の場合は、1番目のゼロ(2)は上位アドレス、2番目のゼロ(3)は中位アドレス、3番目のゼロ(4)は下位アドレス、4番目のゼロ(5)は書込みデータ(00h)と、それぞれ認識される。
したがって、初期データ書き込み処理によって、いずれの場合もアドレス0番地から書き込まれるが、メモリのアクセスモードによって、書き込まれるバイト数が異なる。即ち、アクセスモード1、2、3の場合は、それぞれ3バイト、2バイト、1バイトのゼロ(00h)が書き込まれる。
【0020】
図5は、判定データ読み出し処理の詳細なフローチャート、判定データ読み出しのためにCPUから出力される定型ビット列及び前記定型ビット列のアクセスモードごとの認識表である。
図5(a)に示すように、判定データ読み出し処理では、先ずCsポートをLoレベルからHiレベルに設定(f21)した後、CPU2からDIポートに図5(b)に示される定型ビット列(1)、(2)、(3)、(4)、(5)が出力される。
即ち、先ず読み出しコマンド(1)が出力され(f22)、続いて2バイトのゼロ(2)、(3)が出力される。(f23、f24)
【0021】
前記2バイトのゼロ(2)、(3)が出力されると、後述のように第1の判定データがDoポートより出力される。(f25)
前記2番目のゼロ(3)に続いて、3番目のゼロ(4)及び4番目のゼロ(5)がCPU2より出力される(f26、f28)と後述のように第2の判定データ、第3の判定データがそれぞれDoポートより出力され(f27、f29)、CsポートがHiレベルからLoレベルに設定されて判定データ読み出し処理が終了する(f30)。
判定データ読み出しのための前記定型ビット列のうち、前記4バイトのゼロ(2)〜(5)は、初期データ書き込み処理の場合と同様にメモリのアクセスモードごとに異なる認識が行われる。
【0022】
図5(c)は、前記4バイトのゼロ(2)〜(5)に対するメモリのアクセスモードごとの認識の違いを示す表である。
同図に示すように、アクセスモード1の場合は必要とするアドレスデータのバイト数が1であるので、1番目のゼロ(2)はアドレス(アドレス0番)、2〜4番目の各1バイトのゼロ(3)〜(5)は出力指示のダミーデータと認識される。
アクセスモード2の場合は必要とするアドレスデータのバイト数が2であるので、1番目のゼロ(2)は上位アドレス、2番目のゼロ(3)は下位アドレス、3番目、4番目のゼロ(4)、(5)は出力指示のダミーデータと認識される。
【0023】
アクセスモード3の場合は必要とするアドレスデータのバイト数が3であるので、1番目のゼロ(2)は上位アドレス、2番目のゼロ(3)は中位アドレス、3番目のゼロ(4)は下位アドレス、4番目のゼロ(5)は出力指示のダミーデータと認識される。
したがって、前記判定データ読み出し処理によって、いずれの場合もアドレス0番地から読み出されるが、メモリのアクセスモードによって、メモリから読み出されるデータのバイト数が異なる。
【0024】
図6は、判定データ読み出し処理f2におけるアクセスモードごとの読み出しデータの一覧表及び判定処理の詳細なフローチャートである。
前記判定データ読み出し処理において、読み出しコマンド(1)に続いて1番目、2番目のゼロ(2)、(3)がメモリ1に入力されると、図6(a)に示されるように、2番目のゼロ(3)と引き換えにメモリがアクセスモード1の場合は、メモリの0番地からデータゼロ(00h)がDoポートに読み出される。
しかしながら、もし、メモリがアクセスモード2の場合は、1番目、2番目のゼロ(2)、(3)はアドレスの上位と下位を指定し、また、もし、メモリがアクセスモード3の場合は、1番目2番目のゼロ(2)、(3)はアドレスの上位及び中位を指定することになる。
【0025】
アクセスモード2、3の場合においては、必要なバイト数のアドレス(アクセスモード2では2バイト、アクセスモード3では3バイト)がメモリに入力されないうちは、Doポートより、図1(a)に示すDoポートに接続された前記プルアップ抵抗3よってHiに吊り上けられた電位により、16進表現でFFhの状態のデータが出力される。
このように、2番目のゼロと引き換えにDoポートから得られるデータを第1の判定データとする。
同様にして、3番目のゼロ(4)及び4番目のゼロ(5)と引き換えにDoポートより読み出されるデータを、それぞれ第2、第3判定データとする。
【0026】
図6(b)は、判定処理の詳細なフローチャートである。該判定処理は、前記第1〜第3判定データをもとに行われ、同図に示されるように、第1の判定データがゼロ(00h)であれば(f31)、アクセスモード1のメモリと判定される。
そして、第1の判定データがゼロ以外で第2の判定データがゼロ(00h)であれば(f32)、アクセスモード2、第2の判定データもゼロ以外で第3の判定データがゼロ(00h)であれば(f33)、アクセスモード3と判定される。第3の判定データもゼロでなければメモリの故障と判定される(f34)。
【0027】
以上のように図4、5、6にそれぞれ示す処理ステップによって、SPI準拠のシリアルメモリは、アドレスモード1、2、3のいずれか、即ちアドレスビット数が9ビット以下か、16ビット以下か、あるいは24ビット以下か判定することができる。
【0028】
【発明の効果】
以上説明したように、本発明に係るシリアルメモリのアクセスモードの判別方法は、メモリサイズが未知のシリアルメモリに対して、書き込みコマンドに続き4バイトのゼロを与えて書き込み処理を行い、次に、読み出しコマンドに続き4バイトのゼロを与えて読み出し処理を行う。
そして、読み出し処理で得られた第1、第2、第3判定データに基づいてメモリのアクセスモードを判定するようにした。
これによって、本発明は、SPIインタフェースのメモリのような、読み出しデータに応答ビットが付与されない種類でのメモリあっても、確実にメモリのアクセスモードを自動的に判別することができる。
したがって、本発明のメモリサイズ判別方法は、メモリサイズが未知のSPIに準拠したシリアルメモリに対して、極めて単純な低コストの構成で速い処理速度の判別方法を提供するうえで著効を奏する。
【図面の簡単な説明】
【図1】(a)は、本発明に係わるSPIに準拠したインタフェースをもつメモリへアクセスするための接続配線図、(b)は、アクセスモード判定処理フローチャート
【図2】(a)は、8ビットアドレスのシリアルメモリのデータ構造、(b)は、(a)のシリアルメモリにデータを書き込んだ状態の説明図。
【図3】アクセスモード分類表。
【図4】(a)は、初期データ書き込み処理の詳細なフローチャート、(b)は、初期データ書き込みのためCPUより出力される定型ビット列の構成図、(c)は、(b)の定型ビット列のアクセスモードごとの認識表。
【図5】(a)は、判定データ読み出し処理の詳細なフローチャート、(b)は、判定データ読み出しのためにCPUから出力される定型ビット列、(c)は、(b)の定型ビット列のアクセスモードごとの認識表。
【図6】(a)は、判定データ読み出し処理におけるアクセスモードごとの読み出しデータの一覧表、(b)は、判定処理の詳細なフローチャート。
【図7】(a)は、一般的なシリアルメモリのブロック図、(b)は、シリアルメモリのアクセスのタイミングチャート。
【符号の説明】
1・・SPIインターフェイスをもつサイズが未知のシリアルメモリ、
2・・CPU、 3・・プルアップ抵抗
11・・SPIインターフェイスをもつシリアルメモリ
[0001]
TECHNICAL FIELD OF THE INVENTION
The present invention relates to a method for automatically determining an access mode in a serial memory, particularly in an SPI-compliant serial memory.
[0002]
[Prior art]
In recent years, the capacity of a memory mounted on an electronic device such as a portable terminal has been increasing more and more with the progress of semiconductor technology. It is well known that a memory having a serial interface, which has a small number of input / output ports and is easy to cope with miniaturization, is widely used.
FIG. 7 is a block diagram of a general serial memory and an access timing chart. As shown in FIG. 1A, the general serial memory 11 has at least four ports of DI (input), Do (output), Cs (chip select), and SK (serial clock). .
The DI port is a port for inputting a write command or a read command and a series of serial data specifying an address, and the Do port is a port for outputting serial data read from a memory.
The Cs port is a port for making the memory accessible. When the Cs port is set to a predetermined level, the memory is in an active state, and the data can be written or read. .
Further, the SK port is a port for inputting a serial clock. After setting the Cs port to a predetermined level, the SK port inputs a serial clock and performs predetermined writing and reading in synchronization with the clock signal.
[0003]
FIGS. 2B and 2C are timing charts of writing and reading of the serial memory, respectively.
As shown in FIG. 2B, when writing data to the serial memory, the Cs port is temporarily set from Hi level to Lo level, and a write command, a write address, and a write data are serially transmitted to the DI port. Enter as data.
Then, when the Cs port returns from the Lo level to the Hi level, writing to the memory is executed in synchronization with the serial clock signal.
On the other hand, as shown in FIG. 3C, when reading data from the memory, the Cs port is set from the Hi level to the Lo level, and the serial clock signal is input to the SK port. When a read command, a read address, and dummy data of a required number of bytes are input to the DI port as a series of serial data, data corresponding to the read address is output from the Do port in synchronization with the serial clock signal.
[0004]
Generally, serial memories mounted on electronic devices are provided in various memory sizes, but the serial memories differ only in the bit length of the read or write address depending on the memory size. .
Therefore, if only the bit length of the corresponding address is changed depending on the memory size, it is possible to execute a read / write operation on serial memories having various sizes.
Then, even if the size of the memory mounted on the device or the like is unknown, the timing of the beginning of the serial data input to the DI port and the timing of the read data output from the Do port differs depending on the memory size. A method for automatically recognizing a memory size is disclosed in Japanese Patent Application Laid-Open No. 2000-122921.
[0005]
[Problems to be solved by the invention]
However, the automatic memory size recognition method disclosed in Japanese Patent Application Laid-Open No. 2000-122921 has the following problems.
That is, the memory size automatic recognition method described in the above-mentioned publication is characterized in that when a read command and a read address of a predetermined bit length are input to a DI port of a serial memory whose memory size is unknown, Is detected, and the memory size is determined based on this time interval.
However, in this case, it is assumed that the response bit at the Lo level is added to the head of the read data.
For this reason, for example, there is a problem that this automatic recognition method cannot be applied to a serial memory of a generally widespread interface such as SPI (Serial Peripheral Interface) to which no response bit is added.
The present invention has been made in order to solve the above-mentioned problem, and provides a determination method capable of automatically determining an access mode of a serial memory of an interface compliant with an SPI to which a response bit is not added. The purpose is to:
[0006]
[Means for Solving the Problems]
In order to solve the above-mentioned problem, the invention according to claim 1 is a method of accessing a serial memory conforming to an SPI and automatically determining a memory size of the serial memory, wherein a predetermined size including a write command is included. Supplying initial data having a bit configuration to the serial memory memory and writing the data; and supplying read data having a predetermined bit configuration including a read command to the serial memory after the writing process, Performing a process of reading judgment data based on initial data; and an access mode of the serial memory when the number of bytes of address data required by the memory is defined as a memory access mode based on the judgment data. And performing a process of determining.
[0007]
According to a second aspect of the present invention, in the first aspect, the potential of the data output terminal of the serial memory is at a Hi level, and the initial data is a write command and one byte of 00h, 00h, 00h, 00h following the command. The read data is a read command and one byte of 00h, 00h, 00h, 00h following the command, and the determination data is 3-byte output data read from the memory, and the read determination data is , The access mode of the serial memory is determined from the output pattern of 00h.
[0008]
The invention according to claim 3 is an apparatus for automatically determining the memory size of a serial memory conforming to the SPI, comprising a pull-up resistor for setting a potential of a data output terminal of the serial memory to a Hi level, and An initial data write processing unit that outputs initial write data having a configuration, a determination data read processing unit that reads determination data based on the initial write data while supplying read data having a predetermined bit configuration to the serial memory, A judgment processing unit for judging an access mode of the serial memory based on the judgment data.
[0009]
According to a fourth aspect of the present invention, in the third aspect, the initial write data is a fixed bit string of 00h, 00h, 00h, and 00h of 1 byte following the write command and the command, respectively, and the read data is a read command and a read command. A fixed bit string of 00h, 00h, 00h, 00h of 1 byte following each command. Based on the read determination data, the determination processing unit accesses the serial memory from the output pattern of 00h in the determination data. The mode is determined.
[0010]
BEST MODE FOR CARRYING OUT THE INVENTION
Hereinafter, the present invention will be described based on an embodiment shown in the drawings. FIG. 1 is a connection wiring diagram for accessing a serial memory having an SPI-compliant interface by a device for automatically determining a memory size of a serial memory according to the present invention, and a flowchart of an access mode determination process.
As shown in FIG. 1A, this discriminating device is composed of a CPU 2 and a pull-up resistor 3, and Do, DI, SK, and Cs ports of a serial memory 1 whose memory size is unknown and surrounded by a dotted line in FIG. It is connected to each corresponding I / O pin of CPU2.
The Do port is connected to a power supply circuit via a pull-up resistor 3, and the potential is always at Hi level.
In the circuit configuration shown in the figure, the procedure for the CPU 2 to determine the memory size of the memory 1 includes an initial data write process (f1), a determination data read process (f2), and a process shown in the flowchart of FIG. This is realized by sequentially performing the procedure of the determination process (f3).
[0011]
Before describing the processing procedure shown in the flowchart, the data structure of the serial memory of the interface conforming to the SPI, and page writing and reading will be described.
Generally, the concept of a page is used in the serial memory of the SPI interface. This will be described using an 8-bit address memory as an example.
FIGS. 2A and 2B show the data structure of an 8-bit address memory.
In the memory of the 8-bit address shown in FIG. 9A, the address can be specified from 00h to FFh (hexadecimal notation; hereinafter, when address, data, etc. are expressed in hexadecimal notation, h is added at the end). , D1 to D256 (each data is in units of 1 byte), and a total of 256 bytes of data can be written and stored.
[0012]
A group of several bytes of each data in the memory is called one page.
Normally, one page has a page size that is a multiple of 4, such as 4, 8, 16, 32, or 256 bytes, depending on the memory size.
Assuming 4 bytes / page according to the above, the memory of the 8-bit address has a data structure of 64 pages.
[0013]
When writing data to the memory, as shown in the timing chart of FIG. 7B, a write command and a 1-byte address are input to the DI port, and then write data is continuously input for a predetermined number of bytes. . Then, the write data is successively written in the same page one byte at a time starting from the address. For example, when an address is designated as 00h in an 8-bit address memory and four bytes of data are subsequently input as 00h, 01h, 02h, and 03h, addresses 00h to 03h are obtained as shown in FIG. , Data 00h, 01h, 02h, and 03h are successively written to the memory.
[0014]
On the other hand, in the case of reading, an address is input together with a read command, and subsequently, the same number of dummy data as the number of bytes of data to be read is input.
Then, data is successively read out one byte at a time in accordance with the input of the dummy data in the order of addresses continuous from the address.
In addition, in the case of reading, if dummy data is added, reading can be continuously performed regardless of the page. The dummy data may be any data as long as it is one byte.
[0015]
Next, the procedure of the initial data write processing (f1), the determination data read processing (f2), and the determination processing (f3) shown in the flowchart of the present invention in FIG. 1B will be described.
Here, the number of bytes of address data required by the memory is defined as an access mode of the memory, and the memory is classified according to the capacity of the memory as shown in the access mode classification table of FIG.
[0016]
FIG. 4 is a flowchart of the details of the initial data writing process, a fixed bit string output from the CPU for writing the initial data, and a recognition table for each access mode of the fixed bit string.
As shown in the flow of FIG. 4A, in the initial data write processing, after setting the Cs port from the Hi level to the Lo level (f11), the CPU 2 sets the initial data fixed form shown in FIG. Bit strings (1), (2), (3), (4), and (5) are output. That is, first, the write command (1) is output (f12), and subsequently, 4-byte zeros (00h) (2) to (5) are output (f13 to f16).
[0017]
Next, when a predetermined serial clock signal is input to the SK port and the Cs port is returned from the Lo level to the Hi level (f17), the 4-byte zero (00h) is input to the memory 1, and the predetermined address is input. Is written as described later.
When inputting the initial data or reading out the determination data described later, a predetermined signal is given to the Cs port and the SK port as shown in FIG. 7, but for simplicity of description, Hereinafter, the description thereof will be omitted.
[0018]
The four-byte zero (00h) of (2) to (5) in the fixed bit string composed of (1) to (5) output from the CPU 2 to the memory 1 differs depending on the access mode of the memory 1. Will be.
FIG. 4C is a table showing a difference in recognition of the 4-byte zero (00h) for each access mode.
As shown in the figure, in the case of the access mode 1, the first zero (2) is an address (address 0), and the second to fourth zeros (3) to (5) are the first to third write data. (00h).
In the case of access mode 2, the first zero (2) is the upper address, the second zero (3) is the lower address, the third zero (4), and (5) are the first and second write data. (00h).
[0019]
In the case of access mode 3, the first zero (2) is the upper address, the second zero (3) is the middle address, the third zero (4) is the lower address, and the fourth zero (5) is the write. Data (00h) is recognized.
Therefore, in any case, the data is written from the address 0 by the initial data writing process, but the number of bytes to be written differs depending on the access mode of the memory. That is, in the case of the access modes 1, 2, and 3, three bytes, two bytes, and one byte of zero (00h) are written.
[0020]
FIG. 5 is a detailed flowchart of the determination data reading process, a fixed bit string output from the CPU for reading the determination data, and a recognition table for the fixed bit string for each access mode.
As shown in FIG. 5A, in the determination data read processing, first, the Cs port is set from the Lo level to the Hi level (f21), and then the CPU 2 sets the fixed bit string (1) shown in FIG. ), (2), (3), (4), and (5) are output.
That is, first, the read command (1) is output (f22), and then two bytes of zeros (2) and (3) are output. (F23, f24)
[0021]
When the two bytes of zeros (2) and (3) are output, the first determination data is output from the Do port as described later. (F25)
After the second zero (3), the third zero (4) and the fourth zero (5) are output from the CPU 2 (f26, f28), the second determination data, 3 are output from the Do ports (f27, f29), the Cs port is set from the Hi level to the Lo level, and the determination data reading process ends (f30).
The four bytes of zeros (2) to (5) of the fixed bit sequence for reading the determination data are recognized differently for each memory access mode, as in the case of the initial data writing process.
[0022]
FIG. 5C is a table showing a difference in recognition of the 4-byte zeros (2) to (5) for each memory access mode.
As shown in the figure, in the case of the access mode 1, the required number of bytes of the address data is 1, so the first zero (2) is the address (address 0), and the second to fourth 1 byte each Are recognized as dummy data of the output instruction.
In the case of the access mode 2, since the number of bytes of the required address data is 2, the first zero (2) is the upper address, the second zero (3) is the lower address, the third zero, the fourth zero ( 4) and (5) are recognized as dummy data of the output instruction.
[0023]
In the case of the access mode 3, since the number of bytes of the required address data is 3, the first zero (2) is the upper address, the second zero (3) is the middle address, and the third zero (4). Is the lower address, and the fourth zero (5) is recognized as dummy data for output instruction.
Therefore, in any case, data is read from the address 0 by the determination data read processing, but the number of bytes of data read from the memory differs depending on the access mode of the memory.
[0024]
FIG. 6 is a detailed flowchart of the list of read data and the determination process for each access mode in the determination data read process f2.
In the determination data read process, when the first and second zeros (2) and (3) are input to the memory 1 following the read command (1), as shown in FIG. When the memory is in the access mode 1 in exchange for the zero (3), data zero (00h) is read from the address 0 of the memory to the Do port.
However, if the memory is in access mode 2, the first and second zeros (2), (3) specify the upper and lower addresses, and if the memory is in access mode 3, The first and second zeros (2) and (3) specify the upper and middle addresses, respectively.
[0025]
In the case of the access modes 2 and 3, as long as the required number of bytes of the address (2 bytes in the access mode 2 and 3 bytes in the access mode 3) are not input to the memory, the port shown in FIG. The data in the state of FFh is output in hexadecimal notation by the potential suspended at Hi by the pull-up resistor 3 connected to the Do port.
Thus, data obtained from the Do port in exchange for the second zero is used as first determination data.
Similarly, the data read from the Do port in exchange for the third zero (4) and the fourth zero (5) are referred to as second and third determination data, respectively.
[0026]
FIG. 6B is a detailed flowchart of the determination process. The determination process is performed based on the first to third determination data. As shown in FIG. 3, if the first determination data is zero (00h) (f31), the memory in the access mode 1 is used. Is determined.
If the first determination data is other than zero and the second determination data is zero (00h) (f32), the access mode 2 and the second determination data are also other than zero and the third determination data is zero (00h). ), The access mode 3 is determined (f33). If the third determination data is not zero, it is determined that the memory has failed (f34).
[0027]
As described above, by the processing steps shown in FIGS. 4, 5, and 6, the SPI-compliant serial memory can be used in any one of the address modes 1, 2, and 3, that is, whether the number of address bits is 9 bits or less or 16 bits or less. Alternatively, it can be determined whether it is 24 bits or less.
[0028]
【The invention's effect】
As described above, the method for determining the access mode of a serial memory according to the present invention performs a write process on a serial memory having an unknown memory size by giving a 4-byte zero following a write command. A read process is performed by giving 4 bytes of zero following the read command.
Then, the access mode of the memory is determined based on the first, second, and third determination data obtained in the read processing.
As a result, the present invention can reliably and automatically determine the access mode of a memory even if the memory is of a type in which a response bit is not added to read data, such as an SPI interface memory.
Therefore, the memory size determination method of the present invention is extremely effective in providing a method for determining a high processing speed with a very simple low-cost configuration for a serial memory compliant with an SPI whose memory size is unknown.
[Brief description of the drawings]
FIG. 1A is a connection wiring diagram for accessing a memory having an SPI-compliant interface according to the present invention, and FIG. 1B is a flowchart of an access mode determination process .
2A is a diagram illustrating a data structure of an 8-bit address serial memory, and FIG. 2B is a diagram illustrating a state where data is written to the serial memory of FIG. 2A.
FIG. 3 is an access mode classification table.
4A is a detailed flowchart of an initial data writing process, FIG. 4B is a configuration diagram of a fixed bit sequence output from a CPU for writing initial data, and FIG. 4C is a fixed bit sequence of FIG. Recognition table for each access mode.
5A is a detailed flowchart of a determination data reading process, FIG. 5B is a fixed bit sequence output from the CPU for reading the determination data, and FIG. 5C is access to the fixed bit sequence of FIG. Recognition table for each mode.
6A is a list of read data for each access mode in a determination data read process, and FIG. 6B is a detailed flowchart of the determination process.
FIG. 7A is a block diagram of a general serial memory, and FIG. 7B is a timing chart of serial memory access.
[Explanation of symbols]
1. Serial memory of unknown size with SPI interface
2. CPU, 3. Pull-up resistor 11, Serial memory with SPI interface

Claims (4)

SPIに準拠したシリアルメモリにアクセスして、該シリアルメモリのメモリサイズを自動的に判別する方法であって、
書き込みコマンドを含む所定のビット構成をもつ初期データを前記シリアルメモリメモリに供給して書込む処理を行うステップと、
前記書込み処理の後に読み出しコマンドを含む所定のビット構成をもつ読み出しデータを前記シリアルメモリに供給して、前記初期データに基づく判定データを読出す処理を行うステップと、
前記判定データに基づいて、メモリが必要とするアドレスデータのバイト数のことをメモリのアクセスモードと定義したときの前記シリアルメモリのアクセスモードを判定する処理を行うステップとを有することを特徴とするSPIインタフエースのシリアルメモリのアクセスモード自動判別方法。
A method of accessing a serial memory conforming to the SPI and automatically determining the memory size of the serial memory,
Performing a process of supplying initial data having a predetermined bit configuration including a write command to the serial memory memory and writing the data;
Supplying read data having a predetermined bit configuration including a read command to the serial memory after the write process, and performing a process of reading determination data based on the initial data;
Performing a process of determining the access mode of the serial memory when the number of bytes of address data required by the memory is defined as an access mode of the memory based on the determination data. A method for automatically determining the access mode of a serial memory of an SPI interface.
前記シリアルメモリのデータ出力端の電位はHiレベルであって、前記初期データが書き込みコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hであり、前記読み出しデータが読み出しコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hであり、
前記判定データはメモリから読み出される3バイトの出力データであって、
読み出された判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする請求項1記載のSPIインタフエースを持つメモリのアクセスモード自動判別方法。
The potential at the data output terminal of the serial memory is at the Hi level, the initial data is a write command and one byte of 00h, 00h, 00h, 00h following the command, and the read data is a read command and the command. Followed by 1 byte 00h, 00h, 00h, 00h, respectively.
The determination data is 3-byte output data read from a memory,
2. The method according to claim 1, wherein an access mode of the serial memory is determined from an output pattern of 00h in the read determination data.
SPIに準拠したシリアルメモリのメモリサイズを自動的に判別する装置であって、前記シリアルメモリのデータ出力端の電位をHiレベルにするプルアップ抵抗を備え、
所定のビット構成をもつ初期書き込みデータを出力する初期データ書き込み処理部と、所定のビット構成をもつ読み出しデータを前記シリアルメモリに供給しながら前記初期書き込みデータに基づく判定データを読出す判定データ読み出し処理部と、
前記判定データに基づいて、前記シリアルメモリのアクセスモードを判定する判定処理部とを有することを特徴とするSPIインタフエースのシリアルメモリのアクセスモード自動判別装置。
An apparatus for automatically determining a memory size of a serial memory conforming to an SPI, comprising a pull-up resistor for setting a potential of a data output terminal of the serial memory to a Hi level,
An initial data write processing unit that outputs initial write data having a predetermined bit configuration; and a determination data read process that reads determination data based on the initial write data while supplying read data having a predetermined bit configuration to the serial memory. Department and
A determination processing unit for determining an access mode of the serial memory based on the determination data, wherein a serial memory access mode automatic determination device for an SPI interface is provided.
前記初期書き込みデータが、書き込みコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hの定型ビット列であり、前記読み出しデータが、読み出しコマンドと該コマンドに続くそれぞれ1バイトの00h、00h、00h、00hの定型ビット列であり、
読み出された判定データをもとに、前記判定処理部において判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする請求項3に記載のSPIインタフエースのシリアルメモリのアクセスモード自動判別装置。
The initial write data is a fixed bit string of 00h, 00h, 00h, 00h of 1 byte following the write command and the command, respectively, and the read data is 00h, 00h, 1 byte of 1 byte following the read command and the command, respectively. 00h, 00h is a fixed bit string,
4. The SPI interface serial memory according to claim 3, wherein, based on the read determination data, the determination processing unit determines an access mode of the serial memory from an output pattern of 00h in the determination data. Access mode automatic discrimination device.
JP2003056720A 2003-03-04 2003-03-04 SPI memory access mode automatic discrimination method and discrimination device Expired - Fee Related JP4374416B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2003056720A JP4374416B2 (en) 2003-03-04 2003-03-04 SPI memory access mode automatic discrimination method and discrimination device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2003056720A JP4374416B2 (en) 2003-03-04 2003-03-04 SPI memory access mode automatic discrimination method and discrimination device

Publications (2)

Publication Number Publication Date
JP2004265283A true JP2004265283A (en) 2004-09-24
JP4374416B2 JP4374416B2 (en) 2009-12-02

Family

ID=33120320

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2003056720A Expired - Fee Related JP4374416B2 (en) 2003-03-04 2003-03-04 SPI memory access mode automatic discrimination method and discrimination device

Country Status (1)

Country Link
JP (1) JP4374416B2 (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010044638A (en) * 2008-08-14 2010-02-25 Fujitsu Microelectronics Ltd Information processing apparatus
JP2014078296A (en) * 2012-10-10 2014-05-01 Mitsubishi Electric Corp Memory inspection device, memory inspection method and memory inspection program
JP2019149070A (en) * 2018-02-28 2019-09-05 ラピスセミコンダクタ株式会社 Serial interface circuit, semiconductor device, and serial-parallel conversion method

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2010044638A (en) * 2008-08-14 2010-02-25 Fujitsu Microelectronics Ltd Information processing apparatus
JP2014078296A (en) * 2012-10-10 2014-05-01 Mitsubishi Electric Corp Memory inspection device, memory inspection method and memory inspection program
JP2019149070A (en) * 2018-02-28 2019-09-05 ラピスセミコンダクタ株式会社 Serial interface circuit, semiconductor device, and serial-parallel conversion method
US10991434B2 (en) 2018-02-28 2021-04-27 Lapis Semiconductor Co., Ltd. Serial interface circuit, semiconductor device and serial-parallel conversion method
JP7223503B2 (en) 2018-02-28 2023-02-16 ラピスセミコンダクタ株式会社 SERIAL INTERFACE CIRCUIT, SEMICONDUCTOR DEVICE, AND SERIAL-PARALLEL CONVERSION METHOD

Also Published As

Publication number Publication date
JP4374416B2 (en) 2009-12-02

Similar Documents

Publication Publication Date Title
US11550478B2 (en) Method for transferring data on a memory card in synchonism with a rise edge and a fall edge of a clock signal
TWI486776B (en) Apparatus and method for producing device identifiers for serially interconnected devices of mixed type
US8195839B2 (en) Apparatus and method for producing identifiers regardless of mixed device type in a serial interconnection
US8230129B2 (en) Apparatus and method for identifying device types of series-connected devices of mixed type
JPS635839B2 (en)
US4975872A (en) Dual port memory device with tag bit marking
KR970071302A (en) Programmable Read / Write Access Signals from Processors and Methods of Forming The Signals
CN101697283A (en) Method and system for enhancing reading efficiency of serial peripheral interface
US5781796A (en) System for automatic configuration of I/O base address without configuration program using readout data on common bus by responding device
JP4374416B2 (en) SPI memory access mode automatic discrimination method and discrimination device
US7165126B2 (en) Direct memory access device
KR100564033B1 (en) Semiconductor memory and semiconductor memory test method with single buffer select input terminal
US6118682A (en) Method and apparatus for reading multiple matched addresses
JP3985614B2 (en) Automatic identification method of serial memory
JP2003525511A (en) Memory with callout function
US20020188771A1 (en) Direct memory access controller for carrying out data transfer by determining whether or not burst access can be utilized in an external bus and access control method thereof
JP2581484B2 (en) Data processing system
JP2013175014A (en) Address byte count determination device, address byte count determination method, program, and semiconductor device
JPS63129438A (en) Memory controller
JP3180539B2 (en) Failure analysis memory for fast fail search
CN117851280A (en) Semiconductor device, data search system and data search method
JPH06175910A (en) Memory access circuit and automatic detecting method for memory access timing
JPH0748309B2 (en) Symbol string matching memory and its cascade connection method
JPS622317A (en) Multilevel comparison and coincidence detecting circuit
JPH04168700A (en) Integrated circuit device

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20060215

RD03 Notification of appointment of power of attorney

Free format text: JAPANESE INTERMEDIATE CODE: A7423

Effective date: 20060215

A711 Notification of change in applicant

Free format text: JAPANESE INTERMEDIATE CODE: A711

Effective date: 20070905

A977 Report on retrieval

Free format text: JAPANESE INTERMEDIATE CODE: A971007

Effective date: 20090319

A131 Notification of reasons for refusal

Free format text: JAPANESE INTERMEDIATE CODE: A131

Effective date: 20090331

A521 Written amendment

Free format text: JAPANESE INTERMEDIATE CODE: A523

Effective date: 20090601

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: 20090721

A01 Written decision to grant a patent or to grant a registration (utility model)

Free format text: JAPANESE INTERMEDIATE CODE: A01

A61 First payment of annual fees (during grant procedure)

Free format text: JAPANESE INTERMEDIATE CODE: A61

Effective date: 20090805

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: 20120918

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20120918

Year of fee payment: 3

FPAY Renewal fee payment (event date is renewal date of database)

Free format text: PAYMENT UNTIL: 20130918

Year of fee payment: 4

S531 Written request for registration of change of domicile

Free format text: JAPANESE INTERMEDIATE CODE: R313531

R350 Written notification of registration of transfer

Free format text: JAPANESE INTERMEDIATE CODE: R350

R250 Receipt of annual fees

Free format text: JAPANESE INTERMEDIATE CODE: R250

LAPS Cancellation because of no payment of annual fees