JP2006195607A - Method and circuit for determining bulk-out transfer end - Google Patents

Method and circuit for determining bulk-out transfer end Download PDF

Info

Publication number
JP2006195607A
JP2006195607A JP2005004722A JP2005004722A JP2006195607A JP 2006195607 A JP2006195607 A JP 2006195607A JP 2005004722 A JP2005004722 A JP 2005004722A JP 2005004722 A JP2005004722 A JP 2005004722A JP 2006195607 A JP2006195607 A JP 2006195607A
Authority
JP
Japan
Prior art keywords
bulk
packet
value
out transfer
usb
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.)
Withdrawn
Application number
JP2005004722A
Other languages
Japanese (ja)
Inventor
Hideyo Nakano
秀世 中野
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.)
Kawasaki Microelectronics Inc
Original Assignee
Kawasaki Microelectronics Inc
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 Kawasaki Microelectronics Inc filed Critical Kawasaki Microelectronics Inc
Priority to JP2005004722A priority Critical patent/JP2006195607A/en
Publication of JP2006195607A publication Critical patent/JP2006195607A/en
Withdrawn legal-status Critical Current

Links

Images

Abstract

<P>PROBLEM TO BE SOLVED: To accurately determine end of bulk-out transfer to an own USB device even when the transfer period of bulk-out transfer is reduced by connection of two or more USB devices to a host device. <P>SOLUTION: In this determination method, a SOF packet counter counting SOF packets is used, and the increment value of the SOF packet counter is set to "2" when only SOF packets are transferred, or when no packet is transferred to any USB device to increase a count value increment rate. When packets to USB devices other than the own device are transferred, the increment value is set to "1" to reduce the count value increment rate, and when the count value of the SOF packet counter is a predetermined value, end of bulk-out transfer to the own USB device is determined. <P>COPYRIGHT: (C)2006,JPO&NCIPI

Description

本発明は、USBホスト装置等のホスト装置からUSBデバイス等の周辺装置に対して行われたバルクアウト転送の終了を判定する方法および回路に関するものである。   The present invention relates to a method and a circuit for determining the end of a bulk-out transfer performed from a host device such as a USB host device to a peripheral device such as a USB device.

まず、USBについて簡単に説明する。USBで転送されるデータは、トークンパケット、データパケット、ハンドシェークパケットで構成され、これら3つのパケットで構成される1回のデータ転送はトランザクションと呼ばれる。   First, USB will be briefly described. Data transferred by USB is composed of a token packet, a data packet, and a handshake packet, and one data transfer composed of these three packets is called a transaction.

トークンパケットには、トランザクションの種類を示すPID(識別子)やデータ転送の相手方となるUSBデバイスのアドレスおよびエンドポイントが格納されており、このトークンパケットの情報に適合したUSBデバイスとホスト装置との間でデータ転送が可能になる。データパケットには転送データが格納されている。ハンドシェークパケットにはデータ転送が正常に完了したか否かを示す情報が格納されている。   The token packet stores the PID (identifier) indicating the type of transaction, the address of the USB device that is the counterpart of the data transfer, and the endpoint, and between the USB device and the host device that conforms to the information of this token packet. Data transfer becomes possible. Transfer data is stored in the data packet. The handshake packet stores information indicating whether or not the data transfer has been normally completed.

トランザクションには、INトランザクション、OUTトランザクション、SETUPトランザクションの3種類がある。INトランザクションではUSBデバイスからホスト装置へデータが転送される。OUTトランザクションではホスト装置からUSBデバイスへデータが転送される。SETUPトランザクションはホスト装置からUSBデバイスに対して規格で規定されたコマンドの転送を行うとき使用される。これら3つのトランザクションで、バルク転送、コントロール転送、アイソクロナス転送、あるいはインタラプト転送と呼ばれる転送が構成される。   There are three types of transactions: IN transactions, OUT transactions, and SETUP transactions. In the IN transaction, data is transferred from the USB device to the host device. In the OUT transaction, data is transferred from the host device to the USB device. The SETUP transaction is used when a command specified by the standard is transferred from the host device to the USB device. These three transactions constitute a transfer called bulk transfer, control transfer, isochronous transfer, or interrupt transfer.

バルク転送は非周期的に大量データを扱う転送に用いられ、INトランザクション、またはOUTトランザクションの繰り返しで行われる。以下では、OUTトランザクションの繰り返しで行われるバルク転送を特に「バルクアウト転送」と呼ぶ。コントロール転送は周辺装置の制御などに必要な情報のやりとりについて使用される転送であり、SETUPトランザクションで始まりINトランザクションとOUTランザクションが並ぶ。アイソクロナス転送は連続的で周期的な通信に使用され、ハンドシェークパケットの無いINトランザクションまたはOUTトランザクションの並びである。インタラプト転送は周期的でバンド幅が低いデータ転送に使用される1つのINトランザクションである。   Bulk transfer is used for transferring a large amount of data aperiodically, and is performed by repeating an IN transaction or an OUT transaction. Hereinafter, the bulk transfer performed by repeating the OUT transaction is particularly referred to as “bulk-out transfer”. The control transfer is a transfer used for exchanging information necessary for controlling the peripheral device, and starts with a SETUP transaction and includes an IN transaction and an OUT transaction. Isochronous transfer is used for continuous and periodic communication, and is a sequence of IN or OUT transactions without handshake packets. An interrupt transfer is a single IN transaction used for periodic and low bandwidth data transfers.

これらの各種転送は、フレームと呼ばれる一定期間(フルスピードモードでは1ms、ハイスピードモードでは125μs)に並べられて、1フレーム単位で転送される。フレームの開始は、SOF(Start of Frame)パケットと呼ばれる特殊なパケットで通知される。   These various transfers are arranged in a certain period called a frame (1 ms in the full speed mode, 125 μs in the high speed mode) and transferred in units of one frame. The start of the frame is notified by a special packet called an SOF (Start of Frame) packet.

さて、PC(パーソナルコンピュータ)等のUSBホスト装置からプリンタやスキャナ等のUSBデバイスに大容量のデータを転送する場合は、前記したバルクアウト転送により、USBプロトコルのパケット単位で複数パケットに分割されて転送される。例えばUSB2.0のハイスピードモードの機能を持つ装置では、図8に示すように、512バイト単位(最大パケットサイズ)に分割されて送信される。   When transferring a large amount of data from a USB host device such as a PC (personal computer) to a USB device such as a printer or scanner, the data is divided into a plurality of packets in units of USB protocol packets by the bulk-out transfer described above. Transferred. For example, in a device having a USB 2.0 high-speed mode function, as shown in FIG. 8, the data is divided into 512-byte units (maximum packet size) and transmitted.

図8の(a)は転送データが512バイトで割り切れない場合を示し、最後のバルクアウト転送のパケットに残りのデータ(1〜511バイト)を転送している。各パケットにおいて、「OUT」はUSBホストからUSBデバイス方向へのデータ送信を示すトークンパケット、「512バイト」は転送されるデータパケット、「ACK」はエラー無しでデータパケットを受信したことを示すハンドシェイクパケットであり、USBデバイスからUSBホスト装置に向けて転送される。図8(a)における最後のバルクアウト転送のパケットはショートパケットと呼ばれる。図8の(b)は512バイトで割り切れる場合を示し、最後のバルクアウト転送のパケットで0バイトのデータを転送している。この最後のバルクアウトパケットはNullパケットと呼ばれる。   FIG. 8A shows a case where transfer data is not divisible by 512 bytes, and the remaining data (1 to 511 bytes) is transferred to the last bulk-out transfer packet. In each packet, “OUT” is a token packet indicating data transmission from the USB host toward the USB device, “512 bytes” is a data packet to be transferred, and “ACK” is a hand indicating that the data packet has been received without error. This is a shake packet and is transferred from the USB device to the USB host device. The last bulk-out transfer packet in FIG. 8A is called a short packet. FIG. 8B shows a case where 512 bytes are divisible, and 0-byte data is transferred in the last bulk-out transfer packet. This last bulk-out packet is called a Null packet.

このようにして、USBデバイス側では、バルクアウト転送による転送データの終了を、最大パケットサイズ(前記では512バイト)と異なるパケットを受信したこと、すなわちショートパケット、あるいはNullパケットを受信したこと、で判断するのが一般である。   In this way, on the USB device side, the end of the transfer data by the bulk-out transfer is received by receiving a packet different from the maximum packet size (512 bytes in the above case), that is, receiving a short packet or a Null packet. It is common to judge.

しかしながら、バルクアウト転送において、例えばプリンタ装置に対するデータ転送などのように、一部装置では、NullパケットがUSBホスト装置から送信されない場合がある。そのため最大パケットサイズで割り切れるデータ転送の場合に、転送の終了が判断できない問題が発生している。   However, in bulk-out transfer, a null packet may not be transmitted from the USB host device in some devices, such as data transfer to a printer device. Therefore, in the case of data transfer that is divisible by the maximum packet size, there is a problem that the end of transfer cannot be determined.

そこで、ショートパケットあるいはNullパケットで終わることを検出してバルクアウト転送の終了を判定する以外の判定手法として、USBデバイス側にタイマ機能を持たせ、タイマで設定した一定期間内にデータが受信されない(USBデバイス側の受信データが更新されない)ことを検出してバルクアウト転送の終了を判断する技術(例えば特許文献1)や、装置の処理速度を低下させないようにそのタイマ時間を転送スピード等に応じて最適値に切り替える技術(例えば特許文献2、特許文献3)が提案されている。   Therefore, as a determination method other than detecting the end of a short packet or Null packet and determining the end of bulk-out transfer, the USB device side has a timer function, and data is not received within a fixed period set by the timer. (For example, Patent Document 1) that detects that the received data on the USB device side is not updated and determines the end of bulk-out transfer, or the timer time is set to transfer speed or the like so as not to decrease the processing speed of the apparatus A technique (for example, Patent Document 2 and Patent Document 3) that switches to an optimum value in response to this has been proposed.

特開2003−249965号公報JP 2003-249965 A 特開2004−118517号公報JP 2004-118517 A 特開2004−133537号公報JP 2004-133537 A

以上のように、USBのバルクアウト転送は転送周期が保証されている転送方式でなく、USBバスが空いているとき転送する非周期転送であるため、USBホスト装置に複数のUSBデバイスが接続された場合(1つのUSBホスト装置には最大127のUSBデバイスが接続可能)には、USBホスト装置が複数のUSBデバイスを制御することになるため、各USBデバイスに対するデータの転送周期が遅くなる。このため、タイマでデータ終了を判断する場合には、未だバルクアウト転送が終了していないにも拘わらずタイムアウトを迎え、データ終了と判断し、終了の判断を誤ることがある。   As described above, the USB bulk-out transfer is not a transfer method in which the transfer cycle is guaranteed, but is an aperiodic transfer that is transferred when the USB bus is free, so that multiple USB devices are connected to the USB host device. In this case (a maximum of 127 USB devices can be connected to one USB host device), the USB host device controls a plurality of USB devices, and therefore the data transfer cycle to each USB device is delayed. For this reason, when the end of data is determined by the timer, the time-out may be reached even though the bulk-out transfer has not yet ended, and the end of data may be determined to be erroneous.

本発明の目的は、USBホスト装置等のホスト装置にUSBデバイス等の周辺装置が複数接続されたことによりデータ転送周期が低下した場合であっても、バルクアウト転送の終了を正確に判定できるようにしたバルクアウト転送終了判定方法および回路を提供することである。   It is an object of the present invention to accurately determine the end of bulk-out transfer even when a data transfer cycle is reduced due to a plurality of peripheral devices such as USB devices connected to a host device such as a USB host device. An object of the present invention is to provide a bulk-out transfer end determination method and circuit.

請求項1にかかる発明は、ホスト装置に2以上の周辺装置を接続し、該ホスト装置から該各周辺装置の内の少なくとも1つの周辺装置にバルクアウト転送を行うとき、該周辺装置側で該バルクアウト転送の終了を判定する方法において、前記ホスト装置から前記各周辺装置に対して定期的に転送されるSOFパケットによりインクリメントされるカウント手段を前記各周辺装置に設け、自己の周辺装置宛のバルクアウトパケットが転送されたときは前記カウント手段をクリアし、自己以外の周辺装置宛のパケットが転送されたときは前記カウント手段のインクリメント値を第1の値に設定し、SOFパケットのみが転送されてくるときは前記インクリメント値を前記第1の値より大きな第2の値に設定し、前記カウント手段のカウント値が予め設定した所定値に達すると、前記自己の周辺装置に対する前記バルクアウト転送が終了したと判定することを特徴とする。   According to the first aspect of the present invention, when two or more peripheral devices are connected to the host device and bulk-out transfer is performed from the host device to at least one of the peripheral devices, the peripheral device side In the method for determining the end of bulk-out transfer, each peripheral device is provided with a counting means that is incremented by an SOF packet periodically transferred from the host device to each peripheral device. When a bulk-out packet is transferred, the counting means is cleared. When a packet addressed to a peripheral device other than itself is transferred, the increment value of the counting means is set to the first value, and only the SOF packet is transferred. When this happens, the increment value is set to a second value larger than the first value, and the count value of the counting means is preliminarily set. Upon reaching the set predetermined value, the bulk-out transfer to the self peripherals and judging to be complete.

請求項2にかかる発明は、請求項1に記載のバルクアウト転送終了判定方法において、自己の周辺装置宛のバルクアウトパケットがショートパケット又はNullパケットのときは、前記カウント手段をクリアすると共に前記バルクアウト転送が終了したと判定することを特徴とする法。   The invention according to claim 2 is the bulk out transfer end determination method according to claim 1, wherein when the bulk out packet addressed to its own peripheral device is a short packet or a null packet, the counting means is cleared and the bulk A method characterized by determining that the out transfer has been completed.

請求項3にかかる発明は、請求項1又は2に記載のバルクアウト転送終了判定方法において、前記カウント手段がインクリメントされたときは、前記インクリメント値を前記第2の値に設定することを特徴とする。   The invention according to claim 3 is the bulk-out transfer end determination method according to claim 1 or 2, wherein when the counting unit is incremented, the increment value is set to the second value. To do.

請求項4にかかる発明は、ホスト装置に2以上接続される周辺装置に組み込まれ、前記ホスト装置により行われるバルクアウト転送の終了を判定するバルクアウト転送終了判定回路であって、前記ホスト装置から定期的に転送されるSOFパケットによりインクリメントされ、自己の周辺装置宛のバルクアウトパケットを受けたときはクリアされるカウント手段と、自己の周辺装置宛のバルクアウトパケット以外のパケットを受けたときは前記カウント手段のインクリメント値を第1の値に設定し、前記SOFパケットのみを受けたときは前記第1の値よりも大きな第2の値にインクリメント値を設定するインクリメント値制御手段と、前記カウント手段のカウント値を予め設定したプリセット値と比較する比較手段とを具備し、前記カウント手段のカウント値が前記プリセット値に達したとき、自己の周辺装置に対する前記バルクアウト転送が終了したと判定することを特徴とする。   According to a fourth aspect of the present invention, there is provided a bulk-out transfer end determination circuit which is incorporated in a peripheral device connected to two or more host devices and determines the end of a bulk-out transfer performed by the host device. Count means that is incremented by a SOF packet periodically transferred and cleared when a bulk-out packet addressed to its own peripheral device is received, and when a packet other than a bulk-out packet addressed to its own peripheral device is received An increment value control means for setting the increment value of the count means to a first value and setting an increment value to a second value larger than the first value when only the SOF packet is received; Means for comparing the count value of the means with a preset value set in advance, When the count value of the unit reaches the preset value, and judging said to self peripherals bulk-out transfer is completed.

請求項5にかかる発明は、請求項4に記載のバルクアウト転送終了判定回路において、自己の周辺装置宛のバルクアウトパケットがショートパケット又はNullパケットのときは、前記カウント手段をクリアすると共に前記バルクアウト転送が終了したと判定するパケット識別手段を具備することを特徴とする。   According to a fifth aspect of the present invention, in the bulk-out transfer end determination circuit according to the fourth aspect, when the bulk-out packet addressed to its own peripheral device is a short packet or a null packet, the counting means is cleared and the bulk Packet identification means for determining that the out transfer has been completed is provided.

請求項6にかかる発明は、請求項4又は5に記載のバルクアウト転送終了判定回路において、前記インクリメント値制御手段は、前記カウント手段がインクリメントされたとき、前記インクリメント値を前記第2の値に設定することを特徴とする。   According to a sixth aspect of the present invention, in the bulk-out transfer end determination circuit according to the fourth or fifth aspect, the increment value control means sets the increment value to the second value when the count means is incremented. It is characterized by setting.

本発明によれば、SOFパケットをカウントするカウント手段を使用し、SOFパケットのみが転送されてくるときはそのカウント手段のインクリメント値を大きな値にしてカウント値増大率を大きくし、自己以外の周辺装置宛のパケットが転送されているときはインクリメント値を小さな値にしてカウント値増大率を小さくするので、自己の周辺装置宛のバルクアウト転送の終了時点を設定するカウント手段のカウント値(プリセット値)を適宜設定することにより、ホスト装置に周辺装置が2以上接続されたことによりバルクアウト転送の転送周期の低下が発生しても、バルクアウト転送の終了を正確に判定することが可能となる。本発明は、1台のUSBホスト装置に対して2以上のUSBデバイスを接続してデータ転送を混在させた場合に特に効果的である。   According to the present invention, the counting means for counting SOF packets is used, and when only the SOF packet is transferred, the increment value of the counting means is increased to increase the count value increase rate, When the packet addressed to the device is being transferred, the increment value is set to a small value to decrease the count value increase rate, so that the count value (preset value) of the counting means for setting the end point of the bulk-out transfer addressed to its own peripheral device ) Is appropriately set, it is possible to accurately determine the end of the bulk-out transfer even if the transfer period of the bulk-out transfer is reduced due to two or more peripheral devices connected to the host device. . The present invention is particularly effective when two or more USB devices are connected to one USB host device and data transfer is mixed.

図1に示すように、1個のUSBホスト装置1に複数(ここでは3台の例を示す)のUSBデバイス2A,2B,2Cが接続された場合、個々のUSBデバイス2A,2B,2CにはUSBホスト装置1によりアドレスA1,A2,A3が割り当てられる。そして、各USBデバイス2A,2B,2Cは、USBホスト装置1から転送されるトークンパケットに含まれるアドレスを確認し、自己のUSBデバイス宛に送信されたパケットか、他のUSBデバイス宛に送信されたパケットかを判断する。   As shown in FIG. 1, when a plurality (three examples are shown) of USB devices 2A, 2B, and 2C are connected to one USB host device 1, each USB device 2A, 2B, and 2C is connected to each USB device 2A, 2B, and 2C. Are assigned addresses A1, A2 and A3 by the USB host device 1. Then, each USB device 2A, 2B, 2C confirms the address included in the token packet transferred from the USB host device 1, and the packet is sent to its own USB device or sent to another USB device. To determine whether it is a packet.

図2はこの処理の概要を示す図で、USBホスト装置1からUSBデバイス2A→2B→2C→2Aの順にデータが転送されている場合を示す。USBデバイス2Aでは、自己アドレスA1のパケットについてはハンドシェークパケットACKを返し、送信されたデータDataを保存するが、他のアドレスA2,A3のパケットに対してはハンドシェークパケットを返さず、送信されてきたデータを無視する。   FIG. 2 is a diagram showing an outline of this processing, and shows a case where data is transferred from the USB host device 1 in the order of USB devices 2A → 2B → 2C → 2A. In the USB device 2A, the handshake packet ACK is returned for the packet of the self address A1, and the transmitted data Data is stored, but the handshake packet is not returned for the packets of the other addresses A2 and A3. Ignore the data.

また、図3に示すように、USBホスト装置1は複数のUSBデバイスに転送する各種パケットを1つのフレーム内にまとめて転送する。このフレームの先頭にSOFパケットが付けられる。このSOFパケットは前記したように一定周期で定期的に全てのUSBデバイス2A,2B,2Cに送信される。データ転送が行われていないときは、フレームはSOFパケットのみとなる。   Also, as shown in FIG. 3, the USB host device 1 transfers various packets to be transferred to a plurality of USB devices in one frame. An SOF packet is added to the head of this frame. As described above, the SOF packet is periodically transmitted to all the USB devices 2A, 2B, and 2C at a constant period. When data transfer is not performed, the frame is only the SOF packet.

図4は本実施例のUSBデバイス2の構成を示すブロック図である。USBデバイス2はUSBデバイスコントローラ21、USB動作を制御するMPU22、データ格納用のメモリ(RAM)23、そのメモリ23を制御するメモリコントローラ24、内部バス25を具備する。   FIG. 4 is a block diagram showing the configuration of the USB device 2 of this embodiment. The USB device 2 includes a USB device controller 21, an MPU 22 that controls USB operation, a memory (RAM) 23 for storing data, a memory controller 24 that controls the memory 23, and an internal bus 25.

図5は図4に示したUSBデバイスコントローラ21の内部構成を示すブロック図である。USBデバイスコントローラ21は、パケットの入出力を制御するUSBPHY211、入出力するパケットを制御するパケット制御回路212、エンドポイントバッファ213、DMAコントローラ214、制御レジスタ215を具備する。   FIG. 5 is a block diagram showing an internal configuration of the USB device controller 21 shown in FIG. The USB device controller 21 includes a USBPHY 211 that controls input / output of packets, a packet control circuit 212 that controls packets to be input / output, an endpoint buffer 213, a DMA controller 214, and a control register 215.

図6は図5に示したパケット制御回路212の内の本発明に関連する一部回路212Aの内部構成を示すブロック図である。2121はUSBホスト装置1から送信されてきたパケットを識別するパケット識別回路、2122はパケット識別回路2121で識別されたSOFパケットによりインクリメントされるSOFパケットカウンタ、2123は自己のUSBデバイス宛のバルクアウトパケット以外のパケットを受けたときはカウンタ2122のインクリメント値を「1」に設定し、SOFパケットカウンタ2122がインクリメントされると「2」に設定するインクリメント値制御回路、2124はSOFパケットカウンタのカウント値を予め設定したプリセット値と比較し、一致した場合に転送終了を制御レジスタ215に通知するカウント値比較回路である。   FIG. 6 is a block diagram showing an internal configuration of a partial circuit 212A related to the present invention in the packet control circuit 212 shown in FIG. Reference numeral 2121 denotes a packet identification circuit for identifying a packet transmitted from the USB host device 1, 2122 denotes an SOF packet counter incremented by the SOF packet identified by the packet identification circuit 2121, and 2123 denotes a bulk-out packet addressed to its own USB device. When the other packet is received, the increment value of the counter 2122 is set to “1”, and when the SOF packet counter 2122 is incremented, it is set to “2”. The increment value control circuit 2124 sets the count value of the SOF packet counter. This is a count value comparison circuit that compares with a preset value set in advance and notifies the control register 215 of the end of transfer if they match.

上記の回路212Aを含むパケット制御回路212は、一般的なUSBデバイスコントローラに元々ある機能に簡単な機能回路を追加するのみで実現可能であり、ハードウェアの負担は軽い。また、上記回路212Aで得られる機能(転送終了)のファームウエアへの通知をショートパケットやNullパケットを受信した場合の通知方法と同じ構成にすれば、ファームウェアの負荷も軽くなる。また、ファームウエアでのタイマ計測が不要となる(例えば、通知方法としてインタラプト信号の出力がある)。   The packet control circuit 212 including the above-described circuit 212A can be realized only by adding a simple functional circuit to the functions originally provided in a general USB device controller, and the hardware load is light. Further, if the notification of the function (transfer end) obtained by the circuit 212A to the firmware is made the same as the notification method when a short packet or a null packet is received, the load on the firmware is reduced. Further, timer measurement with firmware is not required (for example, an interrupt signal is output as a notification method).

図7は本実施例のバルクアウト転送の終了を判定するフローチャートである。本実施例では受信するSOFパケットをSOFパケットカウンタ2122によりカウントし、そのカウント値がプリセット値に達するとバルクアウト転送の終了を通知するものである。このとき、そのカウンタ2122は、デフォルトのインクリメント値を「2」とし、SOFパケットをカウントしたときはインクリメント値がその「2」に設定され、自己のUSBデバイスへのバルクアウトパケットを受信したときはクリアされ、他のUSBデバイス宛のパケットを受信したときはインクリメント値が「1」に設定される。なお、インクリメント値は受信する他のUSBデバイスの数をアドレスで判別し、その種類を増やすことも可能である。   FIG. 7 is a flowchart for determining the end of the bulk-out transfer according to this embodiment. In this embodiment, the received SOF packet is counted by the SOF packet counter 2122, and when the count value reaches a preset value, the end of the bulk-out transfer is notified. At this time, the counter 2122 sets the default increment value to “2”, and when the SOF packet is counted, the increment value is set to “2”. When the bulk-out packet to the own USB device is received, When the packet is cleared and a packet addressed to another USB device is received, the increment value is set to “1”. The increment value can be determined by determining the number of other USB devices to be received by the address and increasing the number of types.

USBデバイス2は、まず、パケットの受信を待機(S1)し、受信(S2)するとそれをパケット識別回路2121で確認(S3)し、それがSOFパケットであった場合(S4)は現在のインクリメント値をインクリメント値制御回路2123で確認(S5)し、SOFパケットカウンタ2122をインクリメント(S6)する。そして、インクリメント値を「2」に設定(S7)してから、カウンタ比較回路2124によりカウント値をプリセット値Pと比較(S8)し、一致するかどうか判定(S9)し、一致すれば自己のUSBデバイス宛のバルクアウト転送が終了したと判断する。   The USB device 2 first waits for reception of a packet (S1), and when it is received (S2), the packet identification circuit 2121 confirms it (S3). If it is an SOF packet (S4), the current increment is made. The value is confirmed by the increment value control circuit 2123 (S5), and the SOF packet counter 2122 is incremented (S6). After the increment value is set to “2” (S7), the counter comparison circuit 2124 compares the count value with the preset value P (S8) to determine whether or not they match (S9). It is determined that the bulk-out transfer addressed to the USB device has been completed.

パケットがSOFパケットでなかった場合(S4)は、それが自己のUSBデバイス宛のバルクアウトパケットか否かをパケット識別回路2121で判定(S10)する。自己のUSBデバイス宛のバルクアウトパケットであった場合は、SOFパケットカウンタ2122をクリア(S11)し、それがショートパケット又はNullパケットか否かを判定(S12)して、ショートパケット又はNullパケットの場合は自己へのバルクアウト転送が終了したと判断する。   If the packet is not an SOF packet (S4), the packet identification circuit 2121 determines whether it is a bulk-out packet addressed to its own USB device (S10). If it is a bulk-out packet addressed to its own USB device, the SOF packet counter 2122 is cleared (S11), it is determined whether it is a short packet or a null packet (S12), and the short packet or null packet is determined. In this case, it is determined that the bulk-out transfer to itself has been completed.

前記ステップS10において、SOFパケット以外のパケットが自己のUSBデバイス宛のバルクアウトパケットではないと判定されたときは、インクリメント値制御回路2123によりインクリメント値を「1」に設定する。   If it is determined in step S10 that the packet other than the SOF packet is not a bulk-out packet addressed to its own USB device, the increment value control circuit 2123 sets the increment value to “1”.

以上より、自己のUSBデバイス2へのみバルクアウト転送が継続して行われている場合は、SOFパケットがSOFパケットカウンタ2122でカウントされるものの、そのSOFパケットカウンタ2122はその後に到来する自己のUSBデバイス宛のバルクアウトパケットの受信でクリアされるので、そのカウント値がプリセット値に到達することはないが、ショートパケット又はNullパケットが到来すれば、バルクアウト転送が終了したと判定される。ショートパケット又はNullパケットはパケット識別回路2121で識別される。   As described above, when the bulk-out transfer is continuously performed only to the own USB device 2, the SOF packet counter 2122 counts the SOF packet, but the SOF packet counter 2122 receives the own USB device that arrives thereafter. Since the count value does not reach the preset value because it is cleared upon reception of the bulk-out packet addressed to the device, it is determined that the bulk-out transfer is completed when a short packet or a null packet arrives. The short packet or the null packet is identified by the packet identification circuit 2121.

自己のUSBデバイス宛のバルクアウト転送のみならず他のUSBデバイスへもパケット転送も行われている場合は、他のUSBデバイス宛のパケット転送が行われているときにインクリメント値が「1」に設定され、毎回のSOFパケット到来毎にそれに続くパケットが他のUSBデバイス宛のものである場合は、そのSOFパケットの到来毎にSOFパケットカウンタ2122が「1」づつインクリメントされる。しかし、SOFパケットカウンタ2122のカウント値がプリセット値Pに到来する以前に自己のUSBデバイス宛のバルクアウト転送が行われると、そのSOFパケットカウンタ2122はクリアされるので、バルクアウト転送が終了したと判定されることはない。   When packet transfer is performed not only to the bulk-out transfer addressed to the own USB device but also to another USB device, the increment value is set to “1” when the packet transfer addressed to another USB device is performed. When the SOF packet is set and every subsequent SOF packet is addressed to another USB device, the SOF packet counter 2122 is incremented by “1” every time the SOF packet arrives. However, if bulk-out transfer addressed to its own USB device is performed before the count value of the SOF packet counter 2122 reaches the preset value P, the SOF packet counter 2122 is cleared, so that the bulk-out transfer is completed. It will not be judged.

自己のUSBデバイス宛のバルクアウト転送が行われなくなり、他のUSBデバイス宛のパケット転送が行われる場合は、インクリメント値が「1」に設定され、その後到来するSOFパケットによりSOFパケットカウンタ2122がインクリメントされ、一旦はインクリメント値が「2」に切り替わるものの、直後に「1」に切り替わるので、インクリメント値「1」によるインクリメントが進行し、カウント値がプリセット値Pに到達すると、バルクアウト転送が終了したと判定される。   When the bulk-out transfer addressed to the own USB device is not performed and the packet transfer addressed to another USB device is performed, the increment value is set to “1”, and the SOF packet counter 2122 is incremented by the SOF packet that arrives thereafter. Although the increment value is once switched to “2”, but immediately after that, the increment value is switched to “1”. Therefore, when the increment value “1” increments and the count value reaches the preset value P, the bulk-out transfer is completed. It is determined.

自己のUSBデバイス宛のバルクアウト転送が行われなくなり、かつ他のUSBデバイスへのパケット転送も行われなくなった場合は、インクリメント値が「2」に設定された状態で、到来するSOFパケットによりSOFパケットカウンタ2122がインクリメントされるので、インクリメント値「2」によるインクリメントが進行し、カウント値がプリセット値Pに到達すると、バルクアウト転送が終了したと判定される。このときのプリセット値Pに到達するまでの時間は、他のUSBデバイス宛のみのパケット転送が行われる場合の半分になる。   When the bulk-out transfer addressed to the own USB device is not performed and the packet transfer to another USB device is not performed, the SOF packet is set by the incoming SOF packet with the increment value set to “2”. Since the packet counter 2122 is incremented, the increment by the increment value “2” proceeds, and when the count value reaches the preset value P, it is determined that the bulk-out transfer is completed. The time required to reach the preset value P at this time is half that in the case where packet transfer only to other USB devices is performed.

すなわち、本実施例では、SOFパケットのみが転送されてくるときは前記インクリメント値を大きな値にしてカウント値増大率を大きくし、自己以外のUSBデバイス宛のパケットが転送されているときはインクリメント値を小さな値にしてカウント値増大率を小さくするので、前者の場合は速いタイミングで自己USBデバイス宛のバルクアウト転送が終了したことが判定され、後者の場合は他のUSBデバイスの状態を考慮して遅いタイミングで自己USBデバイス宛のバルクアウト転送が終了したことが判定されるので、カウント値比較回路2124のプリセット値Pを適宜設定することにより、ホスト装置に周辺装置が2以上接続されたことによりバルクアウト転送の転送周期の低下が発生しても、バルクアウト転送の終了を正確に判定することが可能となる。   That is, in this embodiment, when only the SOF packet is transferred, the increment value is increased to increase the count value increase rate, and when a packet addressed to a USB device other than itself is transferred, the increment value is increased. Therefore, it is determined that the bulk-out transfer addressed to the self-USB device is completed at a fast timing in the former case, and the state of the other USB device is taken into consideration in the latter case. Since it is determined that the bulk-out transfer addressed to the self USB device is completed at a later timing, two or more peripheral devices are connected to the host device by appropriately setting the preset value P of the count value comparison circuit 2124. Even if the transfer period of bulk-out transfer is reduced due to the It is possible to determine.

なお、以上ではUSBシステムに適用した場合を例として説明したが、これに限られるものではなく、他の類似のシステムにも適用可能であり、このような適用形態も本発明に含まれるものである。   In the above description, the case where the present invention is applied to the USB system has been described as an example. However, the present invention is not limited to this, and the present invention can also be applied to other similar systems. is there.

USBシステムの構成を示すブロック図である。It is a block diagram which shows the structure of a USB system. USBホスト装置から各USBデバイスに転送されるパケットの説明図である。It is explanatory drawing of the packet transferred to each USB device from a USB host apparatus. USBシステムにおけるフレームの説明図である。It is explanatory drawing of the flame | frame in a USB system. USBデバイスの概略構成を示すブロック図である。It is a block diagram which shows schematic structure of a USB device. 図4のUSBデバイスコントローラの構成を示すブロック図である。FIG. 5 is a block diagram illustrating a configuration of a USB device controller in FIG. 4. 図5のパケット制御回路の構成を示すブロック図である。FIG. 6 is a block diagram illustrating a configuration of a packet control circuit in FIG. 5. 本実施例のバルクアウト転送の終了判定のフローチャートである。It is a flowchart of the completion | finish determination of the bulk-out transfer of a present Example. 従来のバルクアウト転送の終了判定の説明図である。It is explanatory drawing of the completion determination of the conventional bulk-out transfer.

符号の説明Explanation of symbols

212:パケット制御回路、212A:パケット制御回路の一部回路、2121:パケット識別回路、2122:SOFパケットカウンタ、2123:インクリメント値制御回路、2124:カウント値比較回路   212: Packet control circuit, 212A: Partial circuit of packet control circuit, 2121: Packet identification circuit, 2122: SOF packet counter, 2123: Increment value control circuit, 2124: Count value comparison circuit

Claims (6)

ホスト装置に2以上の周辺装置を接続し、該ホスト装置から該各周辺装置の内の少なくとも1つの周辺装置にバルクアウト転送を行うとき、該周辺装置側で該バルクアウト転送の終了を判定する方法において、
前記ホスト装置から前記各周辺装置に対して定期的に転送されるSOFパケットによりインクリメントされるカウント手段を前記各周辺装置に設け、
自己の周辺装置宛のバルクアウトパケットが転送されたときは前記カウント手段をクリアし、自己以外の周辺装置宛のパケットが転送されたときは前記カウント手段のインクリメント値を第1の値に設定し、SOFパケットのみが転送されてくるときは前記インクリメント値を前記第1の値より大きな第2の値に設定し、
前記カウント手段のカウント値が予め設定した所定値に達すると、前記自己の周辺装置に対する前記バルクアウト転送が終了したと判定することを特徴とするバルクアウト転送終了判定方法。
When two or more peripheral devices are connected to the host device and bulk-out transfer is performed from the host device to at least one of the peripheral devices, the end of the bulk-out transfer is determined on the peripheral device side. In the method
Each peripheral device is provided with a counting means that is incremented by an SOF packet periodically transferred from the host device to each peripheral device,
When a bulk-out packet addressed to its own peripheral device is transferred, the counting means is cleared. When a packet addressed to a peripheral device other than itself is transferred, the increment value of the counting means is set to the first value. , When only the SOF packet is transferred, the increment value is set to a second value larger than the first value,
When the count value of the counting means reaches a predetermined value set in advance, it is determined that the bulk-out transfer to the peripheral device is completed.
請求項1に記載のバルクアウト転送終了判定方法において、
自己の周辺装置宛のバルクアウトパケットがショートパケット又はNullパケットのときは、前記カウント手段をクリアすると共に前記バルクアウト転送が終了したと判定することを特徴とするバルクアウト転送終了判定方法。
The bulk-out transfer end determination method according to claim 1,
When the bulk-out packet addressed to its own peripheral device is a short packet or a null packet, the counting means is cleared and it is determined that the bulk-out transfer is completed.
請求項1又は2に記載のバルクアウト転送終了判定方法において、
前記カウント手段がインクリメントされたときは、前記インクリメント値を前記第2の値に設定することを特徴とするバルクアウト転送終了判定方法。
In the bulk-out transfer end determination method according to claim 1 or 2,
When the counting means is incremented, the increment value is set to the second value.
ホスト装置に2以上接続される周辺装置に組み込まれ、前記ホスト装置により行われるバルクアウト転送の終了を判定するバルクアウト転送終了判定回路であって、
前記ホスト装置から定期的に転送されるSOFパケットによりインクリメントされ、自己の周辺装置宛のバルクアウトパケットを受けたときはクリアされるカウント手段と、
自己の周辺装置宛のバルクアウトパケット以外のパケットを受けたときは前記カウント手段のインクリメント値を第1の値に設定し、前記SOFパケットのみを受けたときは前記第1の値よりも大きな第2の値にインクリメント値を設定するインクリメント値制御手段と、
前記カウント手段のカウント値を予め設定したプリセット値と比較する比較手段とを具備し、
前記カウント手段のカウント値が前記プリセット値に達したとき、自己の周辺装置に対する前記バルクアウト転送が終了したと判定することを特徴とするバルクアウト転送終了判定回路。
A bulk-out transfer end determination circuit that is incorporated in a peripheral device connected to two or more host devices and determines the end of bulk-out transfer performed by the host device,
A counting means which is incremented by a SOF packet periodically transferred from the host device and cleared when a bulk-out packet addressed to its own peripheral device is received;
When a packet other than a bulk-out packet addressed to its own peripheral device is received, the increment value of the counting means is set to a first value, and when only the SOF packet is received, a value larger than the first value is set. An increment value control means for setting an increment value to a value of 2,
Comparing means for comparing the count value of the counting means with a preset value set in advance,
A bulk-out transfer end determination circuit, wherein when the count value of the counting means reaches the preset value, it is determined that the bulk-out transfer to its own peripheral device has ended.
請求項4に記載のバルクアウト転送終了判定回路において、
自己の周辺装置宛のバルクアウトパケットがショートパケット又はNullパケットのときは、前記カウント手段をクリアすると共に前記バルクアウト転送が終了したと判定するパケット識別手段を具備することを特徴とするバルクアウト転送終了判定回路。
The bulk-out transfer end determination circuit according to claim 4,
When the bulk-out packet addressed to its own peripheral device is a short packet or a null packet, it comprises a packet identification means for clearing the counting means and determining that the bulk-out transfer has been completed. End determination circuit.
請求項4又は5に記載のバルクアウト転送終了判定回路において、
前記インクリメント値制御手段は、前記カウント手段がインクリメントされたとき、前記インクリメント値を前記第2の値に設定することを特徴とするバルクアウト転送終了判定回路。
In the bulk-out transfer end determination circuit according to claim 4 or 5,
The bulk-out transfer end determination circuit, wherein the increment value control means sets the increment value to the second value when the count means is incremented.
JP2005004722A 2005-01-12 2005-01-12 Method and circuit for determining bulk-out transfer end Withdrawn JP2006195607A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2005004722A JP2006195607A (en) 2005-01-12 2005-01-12 Method and circuit for determining bulk-out transfer end

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2005004722A JP2006195607A (en) 2005-01-12 2005-01-12 Method and circuit for determining bulk-out transfer end

Publications (1)

Publication Number Publication Date
JP2006195607A true JP2006195607A (en) 2006-07-27

Family

ID=36801663

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2005004722A Withdrawn JP2006195607A (en) 2005-01-12 2005-01-12 Method and circuit for determining bulk-out transfer end

Country Status (1)

Country Link
JP (1) JP2006195607A (en)

Cited By (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008257690A (en) * 2007-03-09 2008-10-23 Nec Corp Usb communication control method and controller
JP2011003162A (en) * 2009-06-22 2011-01-06 Ricoh Co Ltd Usb device, image processor, usb transfer control method, usb transfer control program, and recording medium

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP2008257690A (en) * 2007-03-09 2008-10-23 Nec Corp Usb communication control method and controller
JP4730381B2 (en) * 2007-03-09 2011-07-20 日本電気株式会社 USB communication control method and apparatus
JP2011003162A (en) * 2009-06-22 2011-01-06 Ricoh Co Ltd Usb device, image processor, usb transfer control method, usb transfer control program, and recording medium

Similar Documents

Publication Publication Date Title
EP1471431B1 (en) Computer for determining interruption delay dynamically
US8214552B2 (en) Transmission apparatus, transmission method, communication apparatus, and program
US20050204189A1 (en) Network apparatus, method for controlling the same, and program for the same
US20110119557A1 (en) Data Transmission Methods and Universal Serial Bus Host Controllers Utilizing the Same
JP2002135257A (en) Data processor for serial communication
JP2002342260A (en) Usb transmission control circuit and control method therefor
EP1433069B1 (en) Bus system and bus interface for connection to a bus
US8576734B2 (en) Information processing apparatus, control method thereof and program
JP2006195607A (en) Method and circuit for determining bulk-out transfer end
KR20040059491A (en) Asynchronous serial data interface
JP5930767B2 (en) Electronic device, communication control method
JP2009188508A (en) Data transmission and reception device
JP3970728B2 (en) Data communication device
KR100514748B1 (en) Direct Memory Access method and apparatus using SOF signal of USB
JP4685414B2 (en) Bus transfer device
JP2009251771A (en) Dma transfer device
JP2010262663A (en) Memory interface device, memory interface method and modem device
JP2001331440A (en) Data reception processor
JP2005182505A (en) Data transfer controller and image forming apparatus
JP2005267294A (en) Network interrupt control method, information processing apparatus and image forming apparatus
JP2560476B2 (en) Communication control device
JP2005251095A (en) Usb device
JP2602975B2 (en) Reception control device in start-stop synchronous communication
JP4666369B2 (en) USB device
JP6213003B2 (en) Communication control device, image processing device, communication control program

Legal Events

Date Code Title Description
A300 Application deemed to be withdrawn because no request for examination was validly filed

Free format text: JAPANESE INTERMEDIATE CODE: A300

Effective date: 20080401