ENGLISH 简体中文 日本語 한국어  



   
 
キーワードまたは型番を入力    




アプリケーションノート 2965

1-Wire®マスタデバイスの構成

要約:各1-Wireデバイスにレーザ書込みされたROM番号に埋め込まれている「ファミリコード」は、特定のデバイスタイプを表しています。各デバイスタイプは、異なる機能とコマンドを備えているため、1-Wireマスタは、この「ファミリコード」を正しいコマンドに変換する方法を知ることが必須となります。このアプリケーションノートでは、1-Wireマスタを動的に構成して、1-WireマスタにXML構成ファイルを提供することによって、これまで未知であった1-Wireデバイスタイプと正しく通信する方法を示しています。このアプリケーションノートは、元は、IEEE® 1451.4 A Smart Transducer Interface for Sensors and Actuators—Mixed-Mode Communication Protocols and Transducer Electronic Data Sheet (TEDS) Formats標準化委員会をサポートするために作成されたものです。

はじめに

各1-Wireデバイスにレーザ書込みされたROM番号に埋め込まれている「ファミリコード」は、特定のデバイスタイプを表しています。各デバイスタイプは、異なる機能とコマンドを備えているため、1-Wireマスタは、この「ファミリコード」を正しいコマンドに変換する方法を知ることが必須となります。残念なことに、「ファミリコード」はわずか8ビットの値であるため、すべての機能とコマンドをその中に符号化することは不可能です。その代わりとして、1-Wireマスタは別の手段によってその関連性を作成する必要があります。1つの方法は、その関連性を1-Wireマスタのソースコードにハードコードするというものです。新しいデバイスに対応することができるようにソースコードを書き換えることによって更新が可能となります。この方法は高価であり、また一部のケースでは不可能であるため、特定の1-Wireマスタは従来のデバイスしか取り扱えなくなります。

このアプリケーションノートでは、1-Wireマスタに構成ファイルを提供することにより、1-Wireマスタを動的に構成してこれまで未知であった1-Wireデバイスタイプと正しく通信する方法を示しています。1-Wireマスタは、新しい構成ファイルを提供することによって最新の1-Wireデバイスに更新することができるようになります。このアプリケーションノートでは、XMLを使用するこのような1つの構成ファイルのフォーマットを説明しています。このアプリケーションノートは、元は、IEEE 1451.4 A Smart Transducer Interface for Sensors and Actuators—Mixed-Mode Communication Protocols and Transducer Electronic Data Sheet (TEDS) Formats標準化委員会をサポートするために作成されたものです。

付録では、デバイス上の読取り専用の構成メモリページを用いて、一般的なファミリコード(たとえばFD hex)を区別することができる方法を提案しています。現時点では、この方法を実装しているデバイスはありません。

コマンドの表記

1-Wireの各マスタには、1-Wireデバイスを探して、各デバイスに関連付けられた一意のROM番号を読み取る機能が備わっているものと想定します。このROM番号から、8ビットのファミリコードを抽出することができます。次に1-Wireマスタは、「ファミリコード」に基づいて、この構成ファイルで定義された1-Wireの動作を実行します。1-Wireデバイスのすべての動作を調べることによって、最小セットのコマンドが得られます。各コマンドを、推奨する表記とともに表1に示します。表2は、コマンドシーケンスに検証を追加する追加コマンドを示しています。

表1. 1-Wireのコアコマンド
表記 コマンドの説明
XX 次の16進バイトの値を1-Wireバスに送る。この16進バイトがCRCブロック内である場合は、1-Wire動作の結果に基づいてCRCを計算する(検証コマンド参照)。
{L, delay} 「L」ミリ秒の遅延
{M} 1-Wireリセット、Match ROMコマンド、およびデバイスROMでデバイスを選択
{P} 1-Wire電力供給(ストロングプルアップ)を準備、または次の1-Wireバイト後に発生
{N} 通常のプルアップに復帰させる
{U} 12ボルトのパルスを発行(EPROMのプログラミングで使用)
{Ax} メモリアドレスを提供し、「x」はLSB~MSBを表す数字の0、1…。例えば、「{A0}{A1}」は最下位バイトが先で最上位バイトが続く16ビットアドレスを特定。
{Dx} メモリデバイスに書き込むデータで、「x」はデータのLSB~MSBを表す数字の0、1…。例えば、「{D0}{D1}{D2}」は書き込みデータの3バイト。これらのコマンドを処理するマスタはコマンドフローに実際のデータを配置することに注意してください。
{R} メモリバイトをメモリの最後まで読み込む。すべての読み込まれた値は有効なデータですが、検証は行われません。


表2. 検証コマンド
表記 コマンドの説明
{dx} 読み込むデータ。このデータは、メモリ1-Wireデバイスに書き込まれるデータの検証、または温度変換などの結果データである場合があります。{Dx}コマンドと同じフォーマットで、「x」は{d0}を持つバイト数がLSBを意味する数であることに注意してください。
{T} 0xAAまたは0x55などのトグリングビットの読込みに成功
{00} 0x00などすべてのビットが0の読込みに成功
{FF} 0xFFなどすべてのビットが1の読込みに成功
{CRC16,start,seed} まずCRC16を16進表記で表される提供済みの「シード」に設定し、CRC16の計算を開始。続くすべてのコマンドバイトは、「チェック」コマンドが見つかるまでこの計算に含む。
{CRC16,check,value} 計算されたCRC16の値が、提供済みの16進の「値」に等しいことを確認。等しくない場合は失敗。この確認後にCRC16の計算は停止できます。
{CRC8,start,seed} まずCRC8を16進表記で表される提供済みの「シード」に設定し、CRC8の計算を開始。続くすべてのコマンドバイトは、「チェック」コマンドが見つかるまでこの計算に含む。
{CRC16,check,value} 計算されたCRC8の値が、提供済みの16進の「値」に等しいことを確認。等しくない場合は失敗。この確認後にCRC8の計算は停止できます。


DS18B20のスクラッチパッドを読み取るコマンドシーケンス例については、図1を参照してください。


図1. DS18B20の温度読取りコマンドシーケンスと1-Wireマスタ変換

デバイスタイプ

このアプリケーションノートで取り上げた1-Wireデバイスの一般的タイプはメモリ、スイッチ、および温度です。
メモリデバイスには、ある種のデータ記憶メモリ領域があります。これは追記型でかまいませんが、複数の読取りをサポートする必要があります。データ記憶メモリ領域はほとんどの場合、ページ単位で配置されており、通常、一度に1ページを書き込みます。メモリデバイスは、属性の異なる複数バンクのメモリであってもかまいません。

スイッチデバイスはラッチを制御することができます。ラッチは出力をグランド(ローサイド)に接続することもできれば、通信チャネル(ハイサイド)に接続することもできます。一部のスイッチデバイスは電圧を検知することもできます。1つのスイッチデバイスは複数のチャネルを持つことが可能です。

温度デバイスは、温度の値を摂氏で返します。結果は符号付きの値で、温度の単位を表しています。摂氏への単位変換が提供されます。

各デバイスタイプには1つまたは複数の標準動作が含まれています。たとえば、各温度デバイスには「読取り」動作が備わっています。表3は、各デバイスタイプの標準動作と属性を示しています。

表3. デバイスの動作と属性(タイプ別)
DEVICE TYPE OPERATIONS ATTRIBUTES
Memory Read
Write
Read/Write/ReadOnly/WriteOnce
Starting physical address
Number of pages
Page length in bytes
Switch Read Latch
Enable Latch
Disable Latch
Read Level (optional)
HIghSIde/LowSide
Temperature Read Min Temperature
Max Temperature
Step (unit of Celsius returned from Read)


「Setup」動作は、任意のデバイスタイプの説明に記載されています。「Setup」は、デバイスが動作可能なように準備させるコマンドシーケンスです。いずれの「読取り」動作についても2つの属性、すなわち「AndMask」および「Polarity」があります。「AndMask」は、コマンドシーケンスに記述される{d0}の結果データとビット単位でANDをとる16進値です。「Polarity」は、「AndMask」の結果の値に一致すれば動作が「TRUE」であることを示します。たとえば、DS2406チャネルAのラッチ状態を読み取るとき(Read Latch)、AndMask = 「0x01」でPolarity = 「0x00」の場合、コマンドシーケンスで読み取った値と0x01とをビット単位でANDをとって、結果が0であれば、ラッチはONになります。

構成フォーマット

構成ファイル例のフォーマットとしてXML構文を選択しました。XMLは非常に「拡張性」があるため、デバイスのタイプ、動作、属性、および実際のコマンドシーケンスを人間が読み取れるフォーマットとして組み込むことは簡単でした。これらの記述をグループに分ける全体「タグ」は、<DeviceDescriptions>でした。個々のデバイスの記述は、このグループ内に、指定したファミリコードの属性(たとえば、<Device FamilyCode="0x23">)とともに存在します。各デバイスグループには、<MemoryBank>、<SwitchChannel>、または<TemperatureChannel>のグループを含めることができます(すでに記述したデバイスタイプに一致するグループです)。デバイスの中には、複数のチャネルとグループを持つデバイスもあります。たとえば、DS2406にはメモリとスイッチの両方のグループがあります。DS2406にはこれらの機能の両方が組み込まれているからです。XMLファイル例については、付録の図2を参照してください。このファイルは6種類の1-Wireデバイスを示しています。これらのデバイスの2つはメモリ、2つはスイッチ、および2つは温度デバイスです。

<?xml version="1.0" encoding="UTF-8"?>
<!-- The device description file follows the schema defined in ??? and
defines devices DS2433, DS2430, DS2406,DS2409,DS18S20,DS1920 and DS18B20.-->
<DeviceDescriptions xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="\Device Schema\Device Schema.xsd">
<DeviceDescriptions>
<Device FamilyCode="0x23">
<Description>
DS2433, 4kbit EEPROM
</Description>
<MemoryBank attributes="ReadWrite">
<Description>
Main Memory
</Description>
<StartAddress> 0x0000 </StartAddress>
<Pages> 16 </Pages>
<PageLength> 32 </PageLength>
<Write>
<WriteScratchPad>
{M} {CRC16,start,0}
0F {A0} {A1}
{D0} {D1} {D2} {D3} {D4} {D5} {D6} {D7}
{D8} {D9} {D10} {D11} {D12} {D13} {D14} {D15}
{D16} {D17} {D18} {D19} {D20} {D21} {D22} {D23}
{D24} {D25} {D26} {D27} {D28} {D29} {D30} {D31}
FF FF {CRC16,check,0xB001}
</WriteScratchPad>
<CopyScratchPad>
{M} 55 {A0} {A1} {P} 1F {L,10} {N} {T}
</CopyScratchPad>
</Write>
<Read>
<ReadMemory>
{M} F0 {A0} {A1} {R}
</ReadMemory>
</Read>
</MemoryBank>
</Device>
<Device FamilyCode="0x14">
<Description>
DS2430A, 32-byte EEPROM with locking register
</Description>
<MemoryBank attributes="ReadWrite">
<Description>
Main Memory
</Description>
<StartAddress> 0x0000 </StartAddress>
<Pages> 1 </Pages>
<PageLength> 32 </PageLength>
<Write>
<WriteScratchPad>
{M} 0F {A0}
{D0} {D1} {D2} {D3} {D4} {D5} {D6} {D7}
{D8} {D9} {D10} {D11} {D12} {D13} {D14} {D15}
{D16} {D17} {D18} {D19} {D20} {D21} {D22} {D23}
{D24} {D25} {D26} {D27} {D28} {D29} {D30} {D31}
</WriteScratchPad>
<ReadScratchPad>
{M} AA {A0}
{d0} {d1} {d2} {d3} {d4} {d5} {d6} {d7}
{d8} {d9} {d10} {d11} {d12} {d13} {d14} {d15}
{d16} {d17} {d18} {d19} {d20} {d21} {d22} {d23}
{d24} {d25} {d26} {d27} {d28} {d29} {d30} {d31}
</ReadScratchPad>
<CopyScratchPad>
{M} 55 {P} A5 {L,20} {N}
</CopyScratchPad>
</Write>
<Read>
<ReadMemory>
{M} F0 {A0} {R}
</ReadMemory>
</Read>
</MemoryBank>
<MemoryBank attributes="WriteOnce">
<Description>
Application Register
</Description>
<StartAddress> 0x0000 </StartAddress>
<Pages> 1 </Pages>
<PageLength> 8 </PageLength>
<Write>
<WriteAppReg>
{M} 99 {A0}
{D0} {D1} {D2} {D3} {D4} {D5} {D6} {D7}
</WriteAppReg>
<ReadAppReg>
{M} C3 {A0}
{d0} {d1} {d2} {d3} {d4} {d5} {d6} {d7}
</ReadAppReg>
<CopyAndLock>
{M} 5A {P} A5 {L,20} {N}
</CopyAndLock>
</Write>
<Read>
<ReadAppReg>
{M} C3 {A0} {R}
</ReadAppReg>
</Read>
</MemoryBank>
</Device>
<Device FamilyCode="0x12">
<Description>
DS2406, dual channel switch with 1kbit EPROM
</Description>
<MemoryBank attributes="WriteOnce">
<Description>
Main Memory
</Description>
<StartAddress> 0x0000 </StartAddress>
<Pages> 4 </Pages>
<PageLength> 32 </PageLength>
<Write>
<WriteScratchPad>
{M} {CRC16,start,0}
0F {A0} {A1} {D0}
FF FF {CRC16,check,0xB001}
</WriteScratchPad>
<Program>
{U}
</Program>
<ReadVerify>
{d0}
</ReadVerify>
</Write>
<Read>
<ReadMemory>
{M} F0 {A0} {A1} {R}
</ReadMemory>
</Read>
</MemoryBank>
<SwitchChannel attributes="LowSide">
<Description>
PIO-A
</Description>
<ReadLatch AndMask="0x01" Polarity="0x00">
{M} {CRC16,start,0}
F5 55 FF {d0}
FF FF {CRC16,check,0xB001}
</ReadLatch>
<ReadLevel AndMask="0x04" Polarity="0x04">
{M} {CRC16,start,0}
F5 55 FF {d0}
FF FF {CRC16,check,0xB001}
</ReadLevel>
<EnableLatch>
{M} {CRC16,start,0}
F5 05 FF 00
FF FF {CRC16,check,0xB001}
</EnableLatch>
<DisableLatch>
{M} {CRC16,start,0}
F5 05 FF FF
FF FF {CRC16,check,0xB001}
</DisableLatch>
</SwitchChannel>
<SwitchChannel attributes="LowSide">
<Description>
PIO-B
</Description>
<ReadLatch AndMask="0x02" Polarity="0x00">
{M} {CRC16,start,0}
F5 55 FF {d0}
FF FF {CRC16,check,0xB001}
</ReadLatch>
<ReadLevel AndMask="0x08" Polarity="0x08">
{M} {CRC16,start,0}
F5 55 FF {d0}
FF FF {CRC16,check,0xB001}
</ReadLevel>
<EnableLatch>
{M} {CRC16,start,0}
F5 09 FF 00
FF FF {CRC16,check,0xB001}
</EnableLatch>
<DisableLatch>
{M} {CRC16,start,0}
F5 09 FF FF
FF FF {CRC16,check,0xB001}
</DisableLatch>
</SwitchChannel>
</Device>
<Device FamilyCode="0x1F">
<Description>
DS2409, 1-Wire Coupler
</Description>
<SwitchChannel attributes="HighSide">
<Description>
Main
</Description>
<ReadLatch AndMask="0x01" Polarity="0x00">
{M} 5A 18 {d0}
</ReadLatch>
<ReadLevel AndMask="0x02" Polarity="0x02">
{M} 5A 18 {d0}
</ReadLevel>
<ReadActivity AndMask="0x10" Polarity="0x10">
{M} 5A 18 {d0}
</ReadActivity>
<EnableLatch>
{M} A5 FF
</EnableLatch>
<DisableLatch>
{M} 66 FF
</DisableLatch>
</SwitchChannel>
<SwitchChannel attributes="HighSide">
<Description>
Auxilary
</Description>
<ReadLatch AndMask="0x04" Polarity="0x00">
{M} 5A 18 {d0}
</ReadLatch>
<ReadLevel AndMask="0x08" Polarity="0x08">
{M} 5A 18 {d0}
</ReadLevel>
<EnableLatch>
{M} 33 FF FF FF
</EnableLatch>
<DisableLatch>
{M} 66 FF
</DisableLatch>
</SwitchChannel>
</Device>
<Device FamilyCode="0x10">
<Description>
DS18S20/DS1920, fixed resolution temperature
</Description>
<TemperatureChannel min="-55" max="125" step="0.5">
<Read>
<Recall>
{M} B8
</Recall>
<Conversion>
{M} {P} 44 {L,750} {N} {FF}
</Conversion>
<Result>
{M} BE {CRC8,start,0} {d0} {d1}
FF FF FF FF FF FF FF {CRC8,check,0x00}
</Result>
</Read>
</TemperatureChannel>
</Device>
<Device FamilyCode="0x28">
<Description>
DS18B20, high-resolution temperature
</Description>
<TemperatureChannel min="-55" max="125" step="0.0625">
<Setup>
<WriteScatchPad>
{M} 00 00 7F
</WriteScatchPad>
<CopyScatchPad>
{M} {P} 48 {L,10} {N}
</CopyScatchPad>
</Setup>
<Read>
<Recall>
{M} B8
</Recall>
<Conversion>
{M} {P} 44 {L,750} {N} {FF}
</Conversion>
<Result>
{M} BE {CRC8,start,0} {d0} {d1}
FF FF FF FF FF FF FF {CRC8,check,0x00}
</Result>
</Read>
</TemperatureChannel>
</Device></DeviceDescriptions>
図2. 6つの1-Wireデバイスに対するXML構成ファイルの例

XMLのデバイス記述スキーマ

デバイス記述スキーマは、新しいデバイスのサポートをシステムに追加するテンプレートを提供します。スキーマは、メモリ、スイッチング、および温度の読取りをサポートするデバイスを定義します。

<?xml version="1.0" encoding="UTF-8"?>
<!-- The IEEE 1451.4 XML device description schema provides a template for manufacturers and
users of the IEEE14514 to add support for new devices to their systems. The schema defines
devices that support memory, switching and temperature reading. -->
<xs:schema xmlns:xs="http://www.w3.org/2001/XMLSchema" elementFormDefault="qualified">
<xs:element name="Conversion" type="xs:string"/>
<xs:element name="CopyAndLock" type="xs:string"/>
<xs:element name="CopyScatchPad" type="xs:string"/>
<xs:element name="CopyScratchPad" type="xs:string"/>
<xs:element name="Description" type="xs:string"/>
<xs:complexType name="IEEE1451_Dot4DeviceType">
<xs:sequence>
<xs:element ref="Description"/>
<xs:element name="MemoryBank" type="MemoryBankType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="SwitchChannel" type="SwitchChannelType" minOccurs="0"
maxOccurs="unbounded"/>
<xs:element name="TemperatureChannel" type="TemperatureChannelType"
minOccurs="0"/>
</xs:sequence>
<xs:attribute name="FamilyCode" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="0x10"/>
<xs:enumeration value="0x12"/>
<xs:enumeration value="0x14"/>
<xs:enumeration value="0x1F"/>
<xs:enumeration value="0x23"/>
<xs:enumeration value="0x28"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="DeviceDescriptions">
<xs:complexType>
<xs:sequence>
<xs:element name="Device" type="IEEE1451_Dot4DeviceType"
maxOccurs="unbounded"/>
</xs:sequence>
</xs:complexType>
</xs:element>
<xs:element name="DisableLatch" type="xs:string"/>
<xs:element name="EnableLatch" type="xs:string"/>
<xs:complexType name="MemoryBankType">
<xs:sequence>
<xs:element ref="Description"/>
<xs:element ref="StartAddress"/>
<xs:element ref="Pages"/>
<xs:element ref="PageLength"/>
<xs:element name="Write" type="WriteType"/>
<xs:element name="Read" type="ReadType"/>
<xs:element name="CRCInformation" minOccurs="0">
<xs:complexType>
<xs:sequence maxOccurs="unbounded">
<xs:element name="CRCStartBitPageLocation"
type="xs:unsignedLong"/>
<xs:element name="CRCBitLength"
type="xs:unsignedLong"/>
</xs:sequence>
</xs:complexType>
</xs:element>
</xs:sequence>
<xs:attribute name="attributes" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="ReadWrite"/>
<xs:enumeration value="WriteOnce"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:element name="PageLength" type="xs:unsignedLong"/>
<xs:element name="Pages" type="xs:unsignedLong"/>
<xs:element name="Program" type="xs:string"/>
<xs:complexType name="ReadType">
<xs:sequence>
<xs:element ref="ReadMemory" minOccurs="0"/>
<xs:element ref="ReadAppReg" minOccurs="0"/>
<xs:element ref="Recall" minOccurs="0"/>
<xs:element ref="Conversion" minOccurs="0"/>
<xs:element ref="Result" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:complexType name="ReadActivityType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="AndMask" type="xs:string" use="required"/>
<xs:attribute name="Polarity" type="xs:string" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ReadAppReg" type="xs:string"/>
<xs:complexType name="ReadLatchType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="AndMask" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="0x01"/>
<xs:enumeration value="0x02"/>
<xs:enumeration value="0x04"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Polarity" type="xs:decimal" use="required"/>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:complexType name="ReadLevelType">
<xs:simpleContent>
<xs:extension base="xs:string">
<xs:attribute name="AndMask" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="0x02"/>
<xs:enumeration value="0x04"/>
<xs:enumeration value="0x08"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
<xs:attribute name="Polarity" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="0x02"/>
<xs:enumeration value="0x04"/>
<xs:enumeration value="0x08"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:extension>
</xs:simpleContent>
</xs:complexType>
<xs:element name="ReadMemory" type="xs:string"/>
<xs:element name="ReadScratchPad" type="xs:string"/>
<xs:element name="ReadVerify" type="xs:string"/>
<xs:element name="Recall" type="xs:string"/>
<xs:element name="Result" type="xs:string"/>
<xs:complexType name="SetupType">
<xs:sequence>
<xs:element ref="WriteScatchPad"/>
<xs:element ref="CopyScatchPad"/>
</xs:sequence>
</xs:complexType>
<xs:element name="StartAddress" type="xs:string"/>
<xs:complexType name="SwitchChannelType">
<xs:sequence>
<xs:element ref="Description"/>
<xs:element name="ReadLatch" type="ReadLatchType"/>
<xs:element name="ReadLevel" type="ReadLevelType"/>
<xs:element name="ReadActivity" type="ReadActivityType" minOccurs="0"/>
<xs:element ref="EnableLatch"/>
<xs:element ref="DisableLatch"/>
</xs:sequence>
<xs:attribute name="attributes" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="HighSide"/>
<xs:enumeration value="LowSide"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="TemperatureChannelType">
<xs:sequence>
<xs:element name="Setup" type="SetupType" minOccurs="0"/>
<xs:element name="Read" type="ReadType"/>
</xs:sequence>
<xs:attribute name="min" type="xs:byte" use="required"/>
<xs:attribute name="max" type="xs:byte" use="required"/>
<xs:attribute name="step" use="required">
<xs:simpleType>
<xs:restriction base="xs:NMTOKEN">
<xs:enumeration value="0.0625"/>
<xs:enumeration value="0.5"/>
</xs:restriction>
</xs:simpleType>
</xs:attribute>
</xs:complexType>
<xs:complexType name="WriteType">
<xs:sequence>
<xs:element ref="WriteScratchPad" minOccurs="0"/>
<xs:element ref="ReadScratchPad" minOccurs="0"/>
<xs:element ref="CopyScratchPad" minOccurs="0"/>
<xs:element ref="WriteAppReg" minOccurs="0"/>
<xs:element ref="ReadAppReg" minOccurs="0"/>
<xs:element ref="CopyAndLock" minOccurs="0"/>
<xs:element ref="Program" minOccurs="0"/>
<xs:element ref="ReadVerify" minOccurs="0"/>
</xs:sequence>
</xs:complexType>
<xs:element name="WriteAppReg" type="xs:string"/>
<xs:element name="WriteScatchPad" type="xs:string"/>
<xs:element name="WriteScratchPad" type="xs:string"/>
</xs:schema>
図2. XMLのデバイス記述スキーマ

付録

メモリ構成ページ

以下の一般メモリ記述は、残りのメモリ空間を利用するのに必要なすべての情報を提供する構成ページを備えた理想的なメモリデバイスを記述しています。構成ページは、デバイスタイプの差を提供することが可能で、これは現在、ROMファミリコードで実装されていますが、より多くの情報が伝達されています。一般的な汎用ファミリコード(たとえばFD hex)は、この構成ページを備えたすべてのデバイスで使用することができます。

1-WireのメモリデバイスはすべてRead Memoryコマンド(F0 hex)をサポートしています。また、DS2430Aの例外はありますが、2アドレスバイトを必要とします。この例では、Read Memoryコマンドを使用して、固定アドレスFF7F hexでの構成ページ情報を取り出しています。メモリ位置には、バイト長、26バイトのデータとそれに続く検証用の反転CRC16があります。表A1は、ビットレベルで詳細な構成ページフォーマットを提示しています。

表A1. 構成ページのフォーマット
Byte Offset Name Content
0 Length Length of data in the configuration page (fixed at 26)
1 General_Flags Bit 0 Memory type (1 EEPROM, 0 EEPROM)
Bit 1 Scratchpad erased on read-memory (1 YES, 0 NO)
Bit 2 Device has read page with CRC16 (1 YES, 0 NO)
Bit 3 Device has write-once mode like pseudo EPROM (1 YES, 0 NO) (EEPROM only)
Bit 4 Device has map of used pages (1 YES, 0 NO)
Bit 5 not used 0
Bit 6 not used 0
Bit 7 not used 0
2 WriteProt_Flags Bit 0 Individual page write-protect (1 YES, 0 NO)
Bit 1 Global device write-protect (1 YES, 0 NO)
Bit 2 Write protect register is organized with one page per bit (1 YES, 0 NO). If not then one page per byte
Bit 3 not used 0
Bit 4 not used 0
Bit 5 not used 0
Bit 6 not used 0
Bit 7 not used 0
3 CRC_Flags Bit 0 Write scratchpad has CRC16 (1 YES, 0 NO)
Bit 1 Read scratchpad has CRC16 (1 YES, 0 NO)
Bit 2 Read special memory command has CRC16 (1 YES, 0 NO)
Bit 3 not used 0
Bit 4 not used 0
Bit 5 not used 0
Bit 6 not used 0
Bit 7 not used 0
4 Scratchpad_Length Length of scratchpad in bytes (EEPROM only)
5 Page_Length Length of normal memory page in bytes
6 Pages Number of pages (2 bytes)
8 Special_Pages Number of special function pages
9 Special_Page_Length Length of special memory page in bytes
10 ReadScratch_CMD Read scratchpaf command
11 Write_CMD Write command (scratchpad for EEPROM)
12 CopyScratch_CMD Copy scratchpad command
13 ReadPageCRC_CMC Read page of memory with CRC16 command
14 ReadSpecial_CMD Read special memory page command
15 Write_Special_CMD Write special memory command
16 WriteProt_Addr Address of write-protect registers in special memory. (2 bytes)
18 WriteProtDev_Addr Address of write-protect entire device register in special memory. (2 bytes)
20 WriteOnce_Addr Address to write-once mode (pseudo EPROM) flag in special memory. (2 bytes)
22 UsedPgs_Addr Address in special memory for map of used pages. (2 bytes)
24 UsedPgs_Offset Bit offset of the map of used pages
25 WriteProt_Value Value written to special memory register to write-protect a page.
26 WriteOnce_Value Value written to special memory register to make a page write-once like pseudo EPROM.
27 CRC16 Bitwise inverted CRC16 of bytes 0 to 24, LSB first. (2 bytes)

以下の表は、構成ページによって記述される操作を一覧で示しています。

表A2. 操作
Operation EEPROM EPROM Description
Read Memory X X Read memory with device generated CRC
Read Page with CRC x x Read a page of memory with device generated CRC
Write Scratchpad X   Write the scratchpad in preparation of writing ot memory
Read Scratchpad X   Read the scratchpad to verify the write was correct
Copy Scratchpad X   Copy the scratchpad to the final memory location
Write Memory   X Write a byte to memory
Read speical page with CRC   x Read a page of special memory with device generated CRC
Write special byte   x Write a byte to the special memory
Write protect page x x Write protect a page
Set page for write-once x   Set an EEPROM page to be write-once like (pseudo EPROM)
Calculate Free Pages   x Calculate the number of free pages in an EPROM device by looking at the map of used pages.
X:このタイプのすべてのデバイスでサポートされる
x:このタイプの一部のデバイスでサポートされる
<空白>:通常、このタイプのデバイスではサポートされない

詳細な操作

表A2に挙げる詳細な操作は、構成ページによって提供される細目によって実装することができます。この項では、操作の実装に使用するシーケンスとデータフィールドを示します。

メモリの読取り
  • 1-Wireリセットとプレゼンス
  • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
  • ReadMemoryコマンド(F0 hex)の書込み
  • 第1アドレスバイトTA1 (LSB)の書込み
  • 第2アドレスバイトTA2 (MSB)の書込み
  • データの読取り
CRC付きのページの読取り
  • General_Flags.Bit2 = 1の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • ReadPageCRC_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の書込み
    • 第2アドレスバイトTA2 (MSB)の書込み
    • Page_Lengthバイトの読取り(アドレスがページの先頭にない場合を除く)
    • ビット単位で反転CRC16の読取り
スクラッチパッドの書込み
  • General_Flags.Bit0 = 1の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • Write_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の書込み
    • 第2アドレスバイトTA2 (MSB)の書込み
    • データバイトの書込み
    • CRCFlags.Bit0 = 1の場合およびページの最後で
      • ビット単位で反転CRC16の読取り
スクラッチパッドの読取り
  • General_Flags.Bit0 = 1の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • ReadScratch_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の読取り
    • 第2アドレスバイトTA2 (MSB)の読取り
    • オフセットとステータスフラグESの読取り
    • データバイトの読取り
    • CRCFlags.Bit1 = 1の場合およびページの最後で
      • ビット単位で反転CRC16の読取り
スクラッチパッドのコピー
  • General_Flags.Bit0 = 1の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • CopyScratch_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の書込み
    • 第2アドレスバイトTA2 (MSB)の書込み
    • オフセットとステータスフラグESの書込み
    • 最小10msの間、ストロングプルアップを1-Wireに適用
    • 確認バイトの読取り(AAまたは55であること)
メモリの書込み
  • General_Flags.Bit0 = 0の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • Write_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の書込み
    • 第2アドレスバイトTA2 (MSB)の書込み
    • 書き込むべきデータバイトの書込み
    • コマンド、アドレス、およびデータ(第1パス)、またはアドレスおよびデータ(第2パス)の反転CRC16のビット単位の読取り
    • 1-Wire上に480µsで12Vのプログラミングパルスを印加
    • 確認データバイトの読取り(古いデータバイトと最新データバイトのORが必要)
    • 書き込むべき次のアドレスが連続アドレスであれば、次のデータバイトを送信することができます...
CRC付きの特殊ページの読取り
  • General_Flags.Bit2 = 1の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • ReadSpecial_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の読取り
    • 第2アドレスバイトTA2 (MSB)の読取り
    • Special_Page_Lengthバイトの読取り(アドレスがページの先頭にない場合を除く)
    • ビット単位で反転CRC16の読取り
特殊バイトの書込み
  • General_Flags.Bit0 = 0の場合
    • 1-Wireリセットとプレゼンス
    • ROMレベルのコマンドシーケンス(read/search/match/overdrive match/overdrive skip)
    • Write_Special_CMDの書込み
    • 第1アドレスバイトTA1 (LSB)の書込み
    • 第2アドレスバイトTA2 (MSB)の書込み
    • 書き込むべきデータバイトの書込み
    • コマンド、アドレス、およびデータ(第1パス)、またはアドレスおよびデータ(第2パス)の反転CRC16のビット単位の読取り
    • 1-Wire上に480µsで12Vのプログラミングパルスを印加
    • 確認データバイトの読取り(古いデータバイトと最新データバイトのORが必要)
    • 書き込むべき次のアドレスが連続アドレスであれば、次のデータバイトを送信することができます...
保護ページの書込み
  • WriteProt_Flags.Bit0 = 1の場合
    • WriteProt_Flags.Bit2 = 1の場合
      • Address = WriteProt_Addr + Page/8
      • Data = WriteProt_Value Rotate left Remainder (Page/8)
    • Else
      • Address = WriteProt_Addr + Page
      • Data = WriteProt_Value
    • AddressとDataを用いた特殊バイトの書込み
追記型ページの設定
  • General_Flags.Bit3 = 1の場合
    • Address = WriteOnce_Addr
    • Data = WriteOnce_Value
    • AddressとDataを用いた特殊バイトの書込み
使用済みページにマーク
  • General_Flags.Bit4 = 1の場合
    • Address = UsedPgs_Addr + (Page + UsedPgs_Offset)/8
    • Data = BitInverse (1 Rotate left Remainder ((Page + UsedPgs_Offest)/8)
    • AddressとDataにて特殊バイトの書込み
フリーページの計算
  • General_Flags.Bit4 = 1の場合
    • Address = UsedPgs_Addr
    • Addressから始まり、(Special_Pages/8)の読取りバイトまでのCRC付き特殊ページの読取り
    • 読取りバイト内の1の数をカウント(これがフリーページの数になる)
表A3は、テンプレートとして既存のデバイスを使用した構成ページの例を示しています。ただし、現在、これらのデバイスには構成ページは含まれていません。

表A3. 構成ページの例
# Name Content DS2433 DS2406 DS2505 DS2506 DS2431 DS28E04
0 Length Length of data in the configuration page 1A 1A 1A 1A 1A 1A
1 General_Flags Bit 0 Memory type (1 EEPROM, 0 EPROM) 1 0 0 0 1 1
Bit 1 Scratchpad erased on read-memory (1 YES, 0 NO) 1 0 0 0 1 1
Bit 2 Device has read page with CRC16 (1 YES, 0 NO) 0 1 1 1 1 1
Bit 3 Device has write-once mode like pseudo EPROM (1 YES, 0 NO) (EEPROM only) 0 0 0 0 1 1
Bit 4 Device has map of used pages (1 YES, 0 NO) 0 1 1 1 0 0
Bit 5 not used 0 0 0 0 0 0
Bit 6 not used 0 0 0 0 0 0
Bit 7 not used 0 0 0 0 0 0
2 WriteProt_Flags Bit 0 Individual page write-protect (1 YES, 0 NO) 0 1 1 1 1 1
Bit 1 Global device write-protect (1 YES, 0 NO) 0 0 0 0 0 0
Bit 2 Write protect register is organized with one page per bit (1 YES, 0 NO). If no then is one page per byte. 0 1 1 1 0 0
Bit 3 not used 0 0 0 0 0 0
Bit 4 not used 0 0 0 0 0 0
Bit 5 not used 0 0 0 0 0 0
Bit 6 not used 0 0 0 0 0 0
Bit 7 not used 0 0 0 0 0 0
3 CRC_Flags Bit 0 Write scratchpad has CRC16 (1 YES, 0 NO) 1 0 0 0 1 1
Bit 1 Read scratchpad has CRC16 (1 YES, 0 NO) 0 0 0 0 1 1
Bit 2 Read special memory command has CRC16 (1 YES, 0 NO) 0 1 1 1 0 0
Bit 3 not used 0 0 0 0 0 0
Bit 4 not used 0 0 0 0 0 0
Bit 5 not used 0 0 0 0 0 0
Bit 6 not used 0 0 0 0 0 0
Bit 7 not used 0 0 0 0 0 0
4 Scratchpad_Length Length of scratchpad in bytes (EEPROM only) 20 00 00 00 08 20
5 Page_Length Length of normal memory page in bytes 20 20 20 20 20 20
6 Pages Number of pages 10
00
04
00
40
00
00
01
04
00
10
00
8 Special_Pages Number of special function pages 00 01 0B 0B 01 02
9 Special_Page_Length Length of special memory page in bytes 00 08 08 08 08 20
10 ReadScratch_CMD Read scratchpad command AA 00 00 00 AA AA
11 Write_CMD Write command (scratchpad for EEPROM) 0F 0F 0F 0F 0F 0F
12 CopyScratch_CMD Copy scratchpad command 55 00 00 00 55 55
13 ReadPageCRC_CMD Read page of memory with CRC16 command 00 A5 A5 A5 00 00
14 ReadSpecial_CMD Read special memory page command 00 AA AA AA F0 F0
15 Write_Special_CMD Write special memory command 00 55 55 55 0F 0F
16 WriteProt_Addr Address of write-protect registers in special memory. (2 bytes) 00
00
00
00
00
00
00
00
80
00
00
20
18 WriteProtDev_Addr Address of write-protect entire device register in special memory. (2 bytes) 00
00
00
00
00
00
00
00
00
00
00
00
20 WriteOnce_Addr Address to write-once mode (pseudo EPROM) flag in special memory. (2 bytes) 00
00
00
00
00
00
00
00
80
00
00
20
22 UsedPgs_Addr Address in special memory for map of used pages. (2 bytes) 00
00
00
00
40
00
40
00
00
00
00
00
24 UsedPgs_Offset Bit offset of the map of used pages 00 04 00 00 00 00
25 WriteProt_Value Value written to special memory register to write-protect a page. 00 00 00 00 55 55
26 WriteOnce_Value Value written to special memory register to make a page write-once like pseudo EPROM. 00 00 00 00 AA AA
27 CRC16 Bitwise inverted CRC16 of bytes 0 to 24, LSB first. (2 bytes) xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
xx
Xの1数字は2進数(0または1)
XXの2数字は16進数

DS2506、DS2409、およびDS2430Aは、新規設計用には推奨されません。



1-WireはMaxim Integrated Products, Inc.の登録商標です。

IEEEはInstitute of Electrical and Electronics Engineersの登録サービスマークです。


関連製品  APP 2965: Nov 10, 2008
DS18B20 プログラマブル分解能1-Wireディジタルサーモメータ フルデータシート
(PDF, 224kB)
無料
サンプル
DS1920 温度用iButton® フルデータシート
(PDF, 496kB)
DS2406 1Kbメモリ付き、デュアル、アドレス指定可能なスイッチ フルデータシート
(PDF, 264kB)
無料
サンプル
DS2409 MicroLANカプラ フルデータシート
(PDF, 428kB)
DS2430A 256ビット1-Wire EEPROM フルデータシート
(PDF, 240kB)
DS2431 1024ビット、1-Wire EEPROM フルデータシート
(PDF, 712kB)
無料
サンプル
DS2433 4Kb、1-Wire EEPROM フルデータシート
(PDF, 568kB)
無料
サンプル
DS2505 16Kbアドオンリーメモリ フルデータシート
(PDF, 320kB)
無料
サンプル
DS2506 64Kbアドオンリーメモリ フルデータシート
(PDF, 900kB)
DS28E04-100 PIO付き、4096ビットアドレス指定可能1-Wire EEPROM フルデータシート
(PDF, 312kB)

自動アップデート
お客様が関心のある分野でアプリケーションノートが新規に掲載された際に自動通知Eメールの受信を希望する場合は、EE-Mail™にご登録ください。


We Want Your Feedback!



フィードバックをお寄せください。
内容に満足されましたか、あるいは満足されていませんか?もっと良いページにできると思いますか?あるいは、単なるコメントでも結構です。フィードバックをお待ちしています。—マキシムはお客様からいただく訂正、提案を元に改善していきます。 このページを評価し、フィードバックを送信する。

 

ダウンロード、PDFフォーマットダウンロード、PDFフォーマット(206kB)
 AN2965, AN 2965, APP2965, Appnote2965, Appnote 2965

        •         •         •     プライバシーポリシー     •     法的お知らせ

    Copyright © 2009 by Maxim Integrated Products