JP4374416B2 - SPI memory access mode automatic discrimination method and discrimination device - Google Patents
SPI memory access mode automatic discrimination method and discrimination device Download PDFInfo
- Publication number
- JP4374416B2 JP4374416B2 JP2003056720A JP2003056720A JP4374416B2 JP 4374416 B2 JP4374416 B2 JP 4374416B2 JP 2003056720 A JP2003056720 A JP 2003056720A JP 2003056720 A JP2003056720 A JP 2003056720A JP 4374416 B2 JP4374416 B2 JP 4374416B2
- Authority
- JP
- Japan
- Prior art keywords
- data
- memory
- read
- serial memory
- access mode
- Prior art date
- Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
- Expired - Fee Related
Links
- 230000015654 memory Effects 0.000 title claims description 127
- 238000012850 discrimination method Methods 0.000 title description 3
- 238000000034 method Methods 0.000 claims description 36
- 238000010586 diagram Methods 0.000 description 6
- 230000004044 response Effects 0.000 description 5
- 230000000694 effects Effects 0.000 description 1
- 230000002093 peripheral effect Effects 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
Images
Landscapes
- Memory System (AREA)
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]
BACKGROUND OF THE INVENTION
The present invention relates to a method for automatically determining an access mode in a serial memory, in particular, 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 with the progress of semiconductor technology. As is well known, a memory having a serial interface that can easily cope with downsizing is widely used because the number of input / output ports is small.
FIG. 7 is a block diagram of a general serial memory and an access timing chart. As shown in FIG. 2A, the general
The DI port is a port for inputting a write command or a read command and a series of serial data for designating an address, and the Do port is a port for outputting serial data read from the memory.
The Cs port is a port for making the memory accessible. By setting the Cs port to a predetermined level, the memory becomes active, and 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 serial clock is input, and predetermined writing and reading are performed in synchronization with the clock signal.
[0003]
FIGS. 7B and 7C respectively show timing charts for writing and reading of the serial memory.
As shown in FIG. 4B, when data is written to the serial memory, the Cs port is once set from the Hi level to the Lo level, and the write command, write address and write data are set to the DI port. Input as data.
When the Cs port is returned 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. 5C, 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 the 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 memory differs 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 according to the memory size, it is possible to execute read / write operations on serial memories having various sizes.
And even if the size of the memory mounted on the device is unknown, the timing of the read data output from the top of the serial data input to the DI port and the Do port varies depending on the memory size. Japanese Laid-Open Patent Publication No. 2000-122921 discloses a method for automatically recognizing a memory size.
[0005]
[Problems to be solved by the invention]
However, the automatic memory size recognition method disclosed in Japanese Patent Laid-Open No. 2000-122921 has the following problems.
In other words, the memory size automatic recognition method described in the above publication is such that when a read command and a read address having a predetermined bit length are input to a DI port of a serial memory whose memory size is unknown, the head of read data output from the Do port is input. The time interval between the response bit and the head of the read command is detected, and the memory size is determined based on this time interval.
However, in this case, it is assumed that the Lo level response bit is added to the head of the read data.
Therefore, for example, there is a problem that this automatic recognition method cannot be applied to a serial memory having a generally widespread interface such as an SPI (Serial Peripheral Interface) to which no response bit is added.
The present invention has been made to solve the above problems, and provides a determination method capable of automatically determining an access mode of a serial memory having an interface conforming to an SPI to which no response bit is added. For the purpose.
[0006]
[Means for Solving the Problems]
In order to solve the above-mentioned problem, the invention of
[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 Hi level, and the initial data is a write command and one byte of 00h, 00h, 00h, 00h following the command. Yes, the read data is a read command and 1 byte of 00h, 00h, 00h, 00h respectively following the command, and the determination data is 3-byte output data read from the memory, and the read determination data The access mode of the serial memory is determined from the output pattern of 00h.
[0008]
According to a third aspect of the present invention, there is provided an apparatus for automatically determining the memory size of a serial memory compliant with SPI, comprising a pull-up resistor for setting the potential of the data output terminal of the serial memory to Hi level, and a predetermined bit. An initial data write processing unit for outputting initial write data different from the value of the data output terminal having a configuration, and determination data based on the initial write data while supplying read data having a predetermined bit configuration to the serial memory A determination data read processing unit for reading and a determination processing unit for determining an access mode of the serial memory based on the determination data are provided.
[0009]
According to a fourth aspect of the present invention, in the third aspect, the initial write data is a write command and a fixed bit string of 00h, 00h, 00h, and 00h each following the command, and the read data is a read command and This is a 1-byte standard bit string of 00h, 00h, 00h, and 00h following the 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]
DETAILED DESCRIPTION OF THE INVENTION
Hereinafter, the present invention will be described based on embodiments shown in the drawings. FIG. 1 is a connection wiring diagram for accessing a serial memory having an interface compliant with the SPI, and a flowchart for the access mode determination process.
As shown in FIG. 1 (a), the discrimination device is composed of a
The Do port is connected to a power supply circuit by a pull-
In the circuit configuration shown in FIG. 5, the
[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 for an SPI interface serial memory. This will be described by taking an 8-bit memory as an example.
2A and 2B show the data structure of an 8-bit address memory.
In the 8-bit address memory shown in FIG. 6A, addresses can be specified from 00h to FFh (hexadecimal display, hereinafter, when address, data, etc. are expressed in hexadecimal display, suffix h). , D1 to D256 (each data is in units of 1 byte), 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, and 256 bytes depending on the memory size. Here, one page is described as 4 bytes.
According to the above, assuming 4 bytes / page, the memory of 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 subsequently, write data is continuously input for a predetermined number of bytes. . Then, the write data is continuously written in the same page one byte at a time starting from the address. For example, when an address is specified as 00h in an 8-bit address memory, and subsequently 4 bytes of data are input as 00h, 01h, 02h, 03h, as shown in FIG. 2B, addresses 00h-03h Each byte of
[0014]
On the other hand, in the case of reading, an address is input together with a read command, and then dummy data having the same number as the number of bytes of data to be read is input.
Then, data is successively read out byte by byte in accordance with the input of the dummy data in the order of addresses that are continuous from the address.
In the case of reading, if dummy data is added, it is possible to read continuously regardless of the page. The dummy data may be any data as long as it is 1 byte.
[0015]
Next, the procedure of the initial data write process (f1), the determination data read process (f2), and the determination process (f3) shown in the flowchart of the present invention in FIG.
Here, the number of bytes of address data required by the memory is defined as a memory access mode, and the memory is classified according to the memory capacity as shown in the access mode classification table of FIG.
[0016]
FIG. 4 is a flowchart showing details of the initial data writing process, a standard bit string output from the CPU for initial data writing, and a recognition table for each access mode of the standard bit string.
As shown in the flow of FIG. 4A, in the initial data write process, after the Cs port is set from the Hi level to the Lo level (f11), the
[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
In the case of inputting the initial data or reading of the determination data described later, a predetermined signal is given to the Cs port and the SK port as shown in FIG. Hereinafter, description thereof is omitted.
[0018]
Of the fixed bit string composed of (1) to (5) output from the
FIG. 4C is a table showing the difference in recognition for each access mode with respect to the 4-byte zero (00h).
As shown in the figure, in the case of the
In
[0019]
In
Therefore, the initial data write process writes data from
[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 each access mode of the fixed bit string.
As shown in FIG. 5A, in the determination data reading process, first, the Cs port is set from the Lo level to the Hi level (f21), and then the fixed bit string (1) shown in FIG. ), (2), (3), (4), (5) are output.
That is, the read command (1) is output first (f22), followed by 2-byte zeros (2) and (3). (F23, f24)
[0021]
When the 2-byte zeros (2) and (3) are output, the first determination data is output from the Do port as described later. (F25)
Subsequent to the second zero (3), the third zero (4) and the fourth zero (5) are output from the CPU 2 (f26, f28). 3 is output from the Do port (f27, f29), the Cs port is set from the Hi level to the Lo level, and the determination data reading process ends (f30).
Of the fixed bit string for reading the determination data, the 4-byte zeros (2) to (5) are recognized differently depending on the memory access mode as in the case of the initial data writing process.
[0022]
FIG. 5C is a table showing a difference in recognition for each of the memory access modes with respect to the 4-byte zeros (2) to (5).
As shown in the figure, in the case of the
In the case of the
[0023]
In the case of
Therefore, the determination data read processing reads from
[0024]
FIG. 6 is a detailed flowchart of read data list and determination processing for each access mode in determination data read processing f2.
In the determination data read processing, when the first and second zeros (2) and (3) are input to the
However, if the memory is in
[0025]
In the case of the
In this way, data obtained from the Do port in exchange for the second zero is used as the first determination data.
Similarly, data read out from the Do port in exchange for the third zero (4) and the fourth zero (5) are set as second and third determination data, respectively.
[0026]
FIG. 6B is a detailed flowchart of the determination process. The determination processing is performed based on the first to third determination data. As shown in the figure, if the first determination data is zero (00h) (f31), the memory in the
If the first determination data is non-zero and the second determination data is zero (00h) (f32), the
[0027]
As described above, according to the processing steps shown in FIGS. 4, 5, and 6, the SPI-compliant serial memory has one of
[0028]
【The invention's effect】
As described above, the serial memory access mode determination method according to the present invention performs write processing on a serial memory having an unknown memory size by giving a 4-byte zero following the write command, Following the read command, a 4-byte zero is given to perform the read process.
Then, the access mode of the memory is determined based on the first, second, and third determination data obtained by the reading process.
Accordingly, the present invention can automatically determine the access mode of the memory reliably even in the case of a memory of a kind in which the response bit is not added to the read data, such as an SPI interface memory.
Therefore, the memory size discrimination method of the present invention is very effective in providing a fast processing speed discrimination method with a very simple low-cost configuration for a serial memory conforming to 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 interface conforming to an SPI according to the present invention, and FIG. 1B is an access mode determination process flowchart ;
2A is a data structure of an 8-bit address serial memory, and FIG. 2B is an explanatory diagram of a state in which data is written to the serial memory of FIG.
FIG. 3 is an access mode classification table.
4A is a detailed flowchart of initial data writing processing, FIG. 4B is a configuration diagram of a fixed bit string output from the CPU for writing initial data, and FIG. 4C is a fixed bit string of FIG. 4B. Recognition table for each access mode.
5A is a detailed flowchart of determination data read processing, FIG. 5B is a fixed bit string output from the CPU for reading determination data, and FIG. 5C is an access to the fixed bit string of FIG. 5B. 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.
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
Claims (4)
前記シリアルメモリがデータを出力しない場合は、前記シリアルメモリのデータ出力端の電位は一定の電位に保持されるように構成され、
書き込みコマンドを含む所定のビット構成をもつ初期データを前記シリアルメモリメモリに供給して、前記シリアルメモリがデータを出力しない場合のデータ出力端の値とは異なるデータ値を書込む処理を行うステップと、
前記書込み処理の後に読み出しコマンドを含む所定のビット構成をもつ読み出しデータを前記シリアルメモリに供給して、前記初期データに基づく判定データを読出す処理を行うステップと、
前記判定データに基づいて、メモリが必要とするアドレスデータのバイト数のことをメモリのアクセスモードと定義したときの前記シリアルメモリのアクセスモードを判定する処理を行うステップとを有することを特徴とするSPIインタフエースのシリアルメモリのアクセスモード自動判別方法。A method of accessing a serial memory compliant with SPI and automatically determining the memory size of the serial memory,
When the serial memory does not output data, the data output terminal of the serial memory is configured to be held at a constant potential,
Supplying initial data having a predetermined bit configuration including a write command to the serial memory , and performing a process of writing a data value different from a value at a data output terminal when the serial memory does not output 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;
And a step of 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 the memory access mode based on the determination data. SPI interface serial memory access mode automatic determination method.
前記判定データはメモリから読み出される3バイトの出力データであって、
読み出された判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする請求項1記載のSPIインタフエースを持つメモリのアクセスモード自動判別方法。The potential of the data output terminal of the serial memory is Hi level, the initial data is a write command and 1 byte of 00h, 00h, 00h and 00h following the command, respectively, and the read data is a read command and the command Are 1 byte of 00h, 00h, 00h, 00h, respectively.
The determination data is 3-byte output data read from the memory,
2. The method for automatically determining an access mode of a memory having an SPI interface 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インタフエースのシリアルメモリのアクセスモード自動判別装置。An apparatus for automatically determining the memory size of a serial memory compliant with SPI, comprising a pull-up resistor for setting the potential of the data output terminal of the serial memory to Hi level,
An initial data write processing unit that outputs initial write data different from the value of the data output terminal having a predetermined bit configuration, and based on the initial write data while supplying read data having a predetermined bit configuration to the serial memory A determination data read processing unit for reading the determination data;
An SPI interface serial memory access mode automatic determination device, comprising: a determination processing unit that determines an access mode of the serial memory based on the determination data.
読み出された判定データをもとに、前記判定処理部において判定データにおける00hの出力パターンから前記シリアルメモリのアクセスモードを判定することを特徴とする請求項3に記載のSPIインタフエースのシリアルメモリのアクセスモード自動判別装置。The initial write data is a regular bit string of 00h, 00h, 00h, 00h of 1 byte following each of the write command and the command, and the read data is 00h, 00h of 1 byte following each of the read command and the command. It is a standard bit string of 00h, 00h,
4. The SPI interface serial memory according to claim 3, wherein an access mode of the serial memory is determined from an output pattern of 00h in the determination data in the determination processing unit based on the read determination data. Automatic access mode discriminator.
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 JP2004265283A (en) | 2004-09-24 |
| JP4374416B2 true 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) |
Families Citing this family (3)
| Publication number | Priority date | Publication date | Assignee | Title |
|---|---|---|---|---|
| JP5251353B2 (en) * | 2008-08-14 | 2013-07-31 | 富士通セミコンダクター株式会社 | Information processing device |
| JP5794965B2 (en) * | 2012-10-10 | 2015-10-14 | 三菱電機株式会社 | Memory inspection apparatus, memory inspection method, and memory inspection program |
| JP7223503B2 (en) | 2018-02-28 | 2023-02-16 | ラピスセミコンダクタ株式会社 | SERIAL INTERFACE CIRCUIT, SEMICONDUCTOR DEVICE, AND SERIAL-PARALLEL CONVERSION METHOD |
-
2003
- 2003-03-04 JP JP2003056720A patent/JP4374416B2/en not_active Expired - Fee Related
Also Published As
| Publication number | Publication date |
|---|---|
| JP2004265283A (en) | 2004-09-24 |
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 | |
| US6851018B2 (en) | Exchanging operation parameters between a data storage device and a controller | |
| US7908424B2 (en) | Memory card and data rewriting method | |
| KR970071302A (en) | Programmable Read / Write Access Signals from Processors and Methods of Forming The Signals | |
| JP4374416B2 (en) | SPI memory access mode automatic discrimination method and discrimination device | |
| US5781796A (en) | System for automatic configuration of I/O base address without configuration program using readout data on common bus by responding device | |
| US7165126B2 (en) | Direct memory access device | |
| US5450366A (en) | IC memory card | |
| KR100564033B1 (en) | Semiconductor memory and semiconductor memory test method with single buffer select input terminal | |
| JP3985614B2 (en) | Automatic identification method of serial memory | |
| US7228367B2 (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 | |
| JPH1173764A (en) | D-RAM type determination method | |
| US6079623A (en) | Apparatus for mapping memory PCMCIA cards into I/O window address space to select an internal register and perform read and write operations using an index mechanism | |
| JP3186320B2 (en) | Access control circuit for storage device | |
| JP2000207889A (en) | Serial memory | |
| JP2581484B2 (en) | Data processing system | |
| JP2013175014A (en) | Address byte count determination device, address byte count determination method, program, and semiconductor device | |
| JPH08211973A (en) | PC card | |
| JPH11328089A (en) | Id information write circuit in device for pci bus interface | |
| JP2005157760A (en) | Information processing apparatus, PC card control circuit, and control method | |
| JPH0520474A (en) | One chip microcomputer | |
| CN120234838A (en) | Control chip, storage circuit and protection method | |
| JPS63129438A (en) | Memory controller | |
| JPH08180010A (en) | Circuit and method for input/output control of data for computer | |
| JPH06175910A (en) | Memory access circuit and automatic detecting method for memory access timing |
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 |