JP4924472B2 - Host device - Google Patents

Host device Download PDF

Info

Publication number
JP4924472B2
JP4924472B2 JP2008044631A JP2008044631A JP4924472B2 JP 4924472 B2 JP4924472 B2 JP 4924472B2 JP 2008044631 A JP2008044631 A JP 2008044631A JP 2008044631 A JP2008044631 A JP 2008044631A JP 4924472 B2 JP4924472 B2 JP 4924472B2
Authority
JP
Japan
Prior art keywords
usb
serial
data
serial converter
standard data
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.)
Active
Application number
JP2008044631A
Other languages
Japanese (ja)
Other versions
JP2009205271A (en
Inventor
竜次 河合
文敏 宇野
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.)
Brother Industries Ltd
Original Assignee
Brother Industries Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Brother Industries Ltd filed Critical Brother Industries Ltd
Priority to JP2008044631A priority Critical patent/JP4924472B2/en
Publication of JP2009205271A publication Critical patent/JP2009205271A/en
Application granted granted Critical
Publication of JP4924472B2 publication Critical patent/JP4924472B2/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Description

本発明は、USBシリアル変換器を用いてシリアル機器とホスト機器との間のデータ転送を行う場合に、USBシリアル変換器に蓄積されたデータを速やかに読み出しながら、ホスト機器の処理負荷を低減する技術に関する。   The present invention reduces the processing load on a host device while quickly reading data stored in the USB serial converter when transferring data between the serial device and the host device using a USB serial converter. Regarding technology.

従来より、パーソナルコンピュータ等のホスト機器に接続されて使用されるプリンタやモデム等の電子機器が知られている。このような電子機器は、例えば、RS−232Cやセントロニクス等のインタフェースを備えており、所定のケーブルを介してホスト機器と接続され、ホスト機器からの制御等に従って動作する。   2. Description of the Related Art Conventionally, electronic devices such as printers and modems that are connected to a host device such as a personal computer are known. Such an electronic device has an interface such as RS-232C or Centronics, for example, is connected to a host device via a predetermined cable, and operates according to control from the host device.

近年、ホスト機器に採用されるインタフェース規格として、USB(Universal Serial Bus)が多くなっている。このUSBは、ホスト機器において導入されている一般的なOS(Operating System)にてサポートされており、電子機器の電源を入れたままで接続できるホット・プラグ・インや、電子機器を使用するための設定を自動的に行えるプラグ・アンド・プレイが特徴となっている(例えば、特許文献1参照。)。そして、上述のRS−232C等のような従来型のインタフェースを備えた電子機器と、USB等の最新型のインタフェースを備えた電子機器とを混在して使用する機会が多い。その際、いわゆるUSBシリアル変換器を用いて両者を接続する。   In recent years, USB (Universal Serial Bus) is increasing as an interface standard adopted for host devices. This USB is supported by a general OS (Operating System) installed in the host device, and can be connected while the power of the electronic device is turned on. It is characterized by plug and play that can be automatically set (see, for example, Patent Document 1). There are many opportunities to use a mixture of an electronic device having a conventional interface such as the above-mentioned RS-232C and an electronic device having the latest interface such as USB. At that time, both are connected using a so-called USB serial converter.

このUSBシリアル変換器は、パーソナルコンピュータ等のホスト機器に接続することでシリアル端子を増設するものであり、ホスト機器のアプリケーション層からのアクセスには旧来のシリアル用APIを利用する。また、USBシリアル変換器用のドライバについても、旧来のシリアル用のドライバを模擬した動作をすることで、APIレベルでは互換性を保っている。このような実装方式によって、USBシリアル変換器を利用しても、シリアル通信用の通信ソフトウェア等を利用することができる。   This USB serial converter has an additional serial terminal by connecting to a host device such as a personal computer, and uses a conventional serial API for access from the application layer of the host device. Also, the USB serial converter driver maintains compatibility at the API level by simulating the conventional serial driver. With such a mounting method, communication software for serial communication can be used even if a USB serial converter is used.

なお、シリアル規格でのデータ転送では双方向且つ非同期にデータ転送が行われ、一方、USB規格でのデータ転送ではフレーム構造のパケット転送が行われる。このため、USBシリアル変換器とホスト機器との間のデータ交換プロトコルが問題になる。すなわち、USBシリアル変換器では、RxDからビット列を受信すると、受信したデータをバイト変換してバッファに保持する。この場合、USBシリアル変換器内部のバッファの容量は一般的に小さく設定されているため、バッファに空き容量が無くなる前に、バッファが記憶するデータをホスト機器が読み出す必要がある。   In the data transfer in the serial standard, data transfer is performed bi-directionally and asynchronously. On the other hand, in the data transfer in the USB standard, frame structure packet transfer is performed. For this reason, a data exchange protocol between the USB serial converter and the host device becomes a problem. That is, when a USB serial converter receives a bit string from RxD, the received data is byte-converted and held in a buffer. In this case, since the capacity of the buffer inside the USB serial converter is generally set to be small, it is necessary for the host device to read the data stored in the buffer before the buffer has no free space.

そのため、ホスト機器では、USBシリアル変換器のバッファにデータが蓄積されているか否かを確認するためにインタラプト転送を行うことやバルク転送(ポーリング)を定期的に行うことが一般的である。   Therefore, the host device generally performs interrupt transfer or periodically performs bulk transfer (polling) to check whether data is stored in the buffer of the USB serial converter.

しかし、ホスト機器がインタラプト転送を行う場合には、転送周期を決定して一定量のパケット転送を常に行うため、バッファにデータが蓄積されていないときでもUSBバスを一定幅占有するという問題がある。また、ホスト機器がバルク転送を行う場合には、ホスト機器が制御コマンドを定期的に発行し、それに対してUSBシリアル変換器がデータ返信を行う処理を繰り返すことになり、この場合も同様に、バッファにデータが蓄積されていないときでもUSBバスを一定幅占有するという問題がある。つまり、シリアル方式でのデータ転送では、転送すべきデータが発生する頻度が低く、転送すべきデータが存在しない期間が多いにもかかわらず、転送すべきデータの有無を確認するためのホスト機器やUSBシリアル変換器の負担が大きくなっている。   However, when the host device performs an interrupt transfer, the transfer cycle is determined and a fixed amount of packets are always transferred. Therefore, there is a problem that the USB bus is occupied by a certain width even when data is not stored in the buffer. . Also, when the host device performs bulk transfer, the host device periodically issues a control command, and the USB serial converter repeats the process of returning data in response to this, and in this case as well, There is a problem that the USB bus is occupied by a certain width even when data is not stored in the buffer. In other words, in the data transfer in the serial system, the frequency of occurrence of data to be transferred is low, and there are many periods in which there is no data to be transferred. The burden on the USB serial converter is increasing.

なお、上述のようにインタラプト転送やバルク転送を行う際の転送周期については、シリアル方式でデータ転送を行う場合の最大転送速度(一般に115200bps)に対して余裕があるものでなければならない。一例を挙げると、UBSシリアル変換器の制御LSIが有するデータ受信バッファの容量が、例えば英FTDI社(Future Technology Devices International Ltd.)製「FT232R」の場合には256byte程度なので、22msec以下の転送周期でインタラプト転送を行い、22msec以下の周期でバルク転送を行うといった具合である。
特開2002−197048号公報(第2頁、図2)
As described above, the transfer cycle when performing interrupt transfer or bulk transfer must have a margin for the maximum transfer rate (generally 115200 bps) when data transfer is performed in a serial manner. For example, in the case of “FT232R” manufactured by FTDI (Future Technology Devices International Ltd.), for example, the capacity of the data reception buffer of the control LSI of the UBS serial converter is about 256 bytes, so the transfer cycle is 22 msec or less. For example, interrupt transfer is performed and bulk transfer is performed at a cycle of 22 msec or less.
JP 2002-197048 (second page, FIG. 2)

しかし、このようなUSBシリアル変換器を用いてシリアル機器とホスト機器との間のデータ転送方法においては、旧来のシリアル通信用のドライバを介してシリアル機器とのデータ転送を行う場合に比べて、ホスト機器が備えるCPUが行う処理の負荷が増大するという問題がある。その理由は、ホスト機器が備えるUSBホストコントローラLSIには、PCIバス接続として「OHCI」、「EHCI」および「UHCI」の三種類があるが、何れの場合にもUSB規格ではパケット1個の受信につき1度の割り込み処理を行う必要があり、そのため、転送周期での割込み処理を行う必要があるからである。因みに、旧来のシリアル用のドライバを介してシリアル機器とのデータ転送を行う場合には、データ転送を行う場合のみ上述のような割込み処理を行うこととなるため、転送すべきデータが発生する頻度が低いシリアル機器とのデータ転送においては、割込み処理を行う頻度も著しく少なく、仮に割込み処理を行う周期が短くても、実際にホスト機器が備えるCPUが行う処理の負荷は小さい。   However, in the data transfer method between the serial device and the host device using such a USB serial converter, compared to the case where data transfer with the serial device is performed via a conventional serial communication driver, There is a problem that the processing load of the CPU provided in the host device increases. The reason is that the USB host controller LSI provided in the host device has three types of “OHCI”, “EHCI”, and “UHCI” as PCI bus connections. In either case, the USB standard receives one packet. This is because it is necessary to perform the interrupt processing once for each, and therefore it is necessary to perform the interrupt processing in the transfer cycle. By the way, when transferring data with a serial device via a conventional serial driver, the above interrupt processing is performed only when transferring data, so the frequency with which data to be transferred is generated. In data transfer with a low-speed serial device, the frequency of interrupt processing is extremely low, and even if the cycle of interrupt processing is short, the load of processing actually performed by the CPU included in the host device is small.

また、シリアル機器の中には、センサ機器や操作端末などのように例えば数分につき数バイト程度のデータ転送を行う機器や、処理負荷の変動幅が大きい機器が多い。さらに、USB規格のデータ転送においては、USBシリアル変換器から転送トリガを発行することが規格上できない。そのため、USBシリアル変換器では、バッファに空き容量が無くなる前にバッファが記憶するデータをホスト機器が読み出す必要があるために、バルク転送を行う場合にはホスト機器のCPUの負荷が大きくなることを承知の上でその転送周期を可能な限り短く設定している。つまり、転送すべきデータが発生する頻度が低いにもかかわらず、バッファに蓄積されたデータの有無を頻繁に確認するようにしている。   In addition, among serial devices, there are many devices that transfer data of, for example, several bytes per several minutes, such as sensor devices and operation terminals, and devices that have a large variation in processing load. Furthermore, in USB standard data transfer, it is not possible in the standard to issue a transfer trigger from a USB serial converter. Therefore, in the USB serial converter, since the host device needs to read the data stored in the buffer before the buffer runs out of space, the load on the CPU of the host device increases when performing bulk transfer. The transfer cycle is set as short as possible. In other words, despite the low frequency with which data to be transferred is generated, the presence or absence of data stored in the buffer is frequently checked.

本発明は、このような課題に鑑みなされたものであり、その目的とするところは、USBシリアル変換器を用いてシリアル機器とホスト機器との間のデータ転送を行う場合に、USBシリアル変換器に蓄積されたデータを速やかに読み出しながら、ホスト機器の処理負担を低減する技術を提供することにある。   The present invention has been made in view of such a problem, and an object of the present invention is to use a USB serial converter when performing data transfer between a serial device and a host device using the USB serial converter. It is an object to provide a technique for reducing the processing load on a host device while quickly reading data stored in the host device.

上記課題を解決するためになされた請求項1に係るホスト機器は、USBシリアル変換器との間でUSB規格のデータを送受信可能なデバイスドライバと、通信アプリケーションを備える。   In order to solve the above-described problems, a host device according to claim 1 includes a device driver capable of transmitting / receiving USB standard data to / from a USB serial converter, and a communication application.

なお、USBシリアル変換器とは、シリアル規格のデータを処理可能な電子機器である「シリアル機器」とUSB規格のデータを処理可能な電子機器である「USB機器」と間のデータ転送を中継する機能を有する。具体的には、USBシリアル変換器は、シリアル機器とUSB機器との間に接続された際に、シリアル機器がUSB機器へ送信したシリアル規格のデータを内蔵するバッファに一時的に蓄積するとともにUSB規格のデータに変換してUSB機器からの要求に応じてUSB機器へ送信し、一方、USB機器がシリアル機器へ送信したUSB規格のデータをシリアル規格のデータに変換した後にシリアル機器へ送信する。なお、シリアル規格のデータをUSB規格のデータに変換する時期としては、バッファにデータを蓄積する前であってもよいし、バッファに蓄積したデータを読み出した後であってもよい。   The USB serial converter relays data transfer between a “serial device” that is an electronic device that can process serial standard data and a “USB device” that is an electronic device that can process USB standard data. It has a function. Specifically, when the USB serial converter is connected between the serial device and the USB device, the USB serial converter temporarily stores the serial standard data transmitted from the serial device to the USB device and stores the data in the USB. The data is converted into standard data and transmitted to the USB device in response to a request from the USB device. On the other hand, the USB standard data transmitted from the USB device to the serial device is converted into serial standard data and then transmitted to the serial device. The time for converting the serial standard data to the USB standard data may be before the data is stored in the buffer or after the data stored in the buffer is read.

そして、デバイスドライバは、上述のようにUSBシリアル変換器との間でUSB規格のデータを送受信可能であり、USBシリアル変換器に対して各種コマンドを発行可能であり、バッファに蓄積されるデータの有無を確認するための確認コマンドを予め設定された周期にてUSBシリアル変換器へ発行する。なお、この予め設定された周期については、バッファの容量およびUSBシリアル変換器との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定される。   The device driver can transmit / receive USB standard data to / from the USB serial converter as described above, can issue various commands to the USB serial converter, and can store the data stored in the buffer. A confirmation command for confirming the presence or absence is issued to the USB serial converter at a preset cycle. The preset period is set in advance according to the capacity of the buffer and the maximum data transfer amount per unit time when performing data transfer with the USB serial converter.

また、通信アプリケーションは、読出しコマンドをデバイスドライバを介してUSBシリアル変換器へ発行する。なお、読出しコマンドとは、USBシリアル変換器のバッファに蓄積されたデータを読み出すためのコマンドであり、USBシリアル変換器のバッファの空き容量が無くならないように設定された周期で発行される。   The communication application issues a read command to the USB serial converter via the device driver. Note that the read command is a command for reading data stored in the buffer of the USB serial converter, and is issued at a cycle set so that the free space of the buffer of the USB serial converter is not lost.

そして、上述のデバイスドライバは、通信アプリケーションが読出しコマンドを発行する周期を計測し、確認コマンドを発行する周期を予め設定された周期からその計測した周期へ変更する。なお、USBシリアル変換器に蓄積されたデータについては、通信アプリケーションが読出しコマンドを発行される度に、USBシリアル変換器からホスト機器にデータ転送される。   Then, the device driver described above measures the period at which the communication application issues the read command, and changes the period at which the confirmation command is issued from the preset period to the measured period. The data stored in the USB serial converter is transferred from the USB serial converter to the host device every time the communication application issues a read command.

なお、上述のようなデバイスドライバおよび通信アプリケーションの機能により、ホスト機器は、USB機器として機能することとなる。
このようにすると、通信アプリケーションが読出しコマンドを発行する周期は、デバイスドライバが確認コマンドを発行する周期よりも長いために、変更後の確認コマンドを発行する周期が変更前に比べて長くなる。なお、USBシリアル変換器のバッファに蓄積されたデータについては、通信アプリケーションが読出しコマンドを発行する度に、USBシリアル変換器からホスト機器にデータ転送されるので、バッファの空き容量が無くなることはない。したがって、USBシリアル変換器に蓄積されたデータを速やかに読み出しながら、ホスト機器の処理負担を軽減することができる。
Note that the host device functions as a USB device by the functions of the device driver and the communication application as described above.
In this case, since the cycle in which the communication application issues the read command is longer than the cycle in which the device driver issues the confirmation command, the cycle in which the changed confirmation command is issued becomes longer than before the change. Note that the data stored in the buffer of the USB serial converter is transferred from the USB serial converter to the host device every time the communication application issues a read command, so that the buffer free capacity is not lost. . Therefore, it is possible to reduce the processing load on the host device while quickly reading the data stored in the USB serial converter.

また、上述の確認コマンドを発行する周期を予め設定された周期から通信アプリケーションが設定したデータ転送速度に対応する周期へ変更することが考えられる。具体的には、請求項2のように、通信アプリケーションが、シリアル機器との間でデータ転送を行う際の単位時間当たりのデータ転送量であるRS232Cのシリアル通信速度、つまりボーレート(bps:Bits Per Second)を設定可能であり、デバイスドライバが、通信アプリケーションによって設定したボーレートに対応する周期を算出し、確認コマンドを発行する周期を予め設定された周期からその算出した周期へ変更することが考えられる。   In addition, it is conceivable to change the period for issuing the above confirmation command from a preset period to a period corresponding to the data transfer rate set by the communication application. Specifically, as described in claim 2, the RS232C serial communication speed, that is, the data transfer amount per unit time when the communication application performs data transfer with the serial device, that is, the baud rate (bps: Bits Per). Second) can be set, and it is conceivable that the device driver calculates a period corresponding to the baud rate set by the communication application, and changes the period for issuing the confirmation command from the preset period to the calculated period. .

このようにすると、ボーレートが、予め設定される周期を算出する際に用いられる「単位時間当たりの最大データ転送量」よりも小さいため、変更後の確認コマンドを発行する周期が変更前に比べて長くなる。なお、USBシリアル変換器のバッファに蓄積されたデータについては、上述のように、通信アプリケーションが読出しコマンドを発行される度に、USBシリアル変換器からホスト機器にデータ転送されるので、バッファの空き容量が無くなることはない。したがって、USBシリアル変換器に蓄積されたデータを速やかに読み出しながら、ホスト機器の処理負担を軽減することができる。   In this way, the baud rate is smaller than the “maximum data transfer amount per unit time” used when calculating the preset period, so the period for issuing the confirmation command after the change is less than before the change. become longer. As described above, the data stored in the buffer of the USB serial converter is transferred from the USB serial converter to the host device every time the communication application issues a read command. There is no loss of capacity. Therefore, it is possible to reduce the processing load on the host device while quickly reading the data stored in the USB serial converter.

また、上述の確認コマンドの発行を停止することが考えられる。具体的には、請求項3のように、確認コマンドの発行を停止する旨を入力するための入力手段を備え、確認コマンドの発行を停止する旨が入力手段から入力された場合には、デバイスドライバが、確認コマンドの発行を停止することが考えられる。なお、確認コマンドの発行を停止する旨を入力手段に入力する方法としては、利用者による手動入力や当該ホスト機器によるコマンド発行などが挙げられる。なお、USBシリアル変換器のバッファに蓄積されたデータについては、上述のように、通信アプリケーションが読出しコマンドを発行される度に、USBシリアル変換器からホスト機器にデータ転送されるので、バッファの空き容量が無くなることはない。したがって、USBシリアル変換器に蓄積されたデータを速やかに読み出しながら、ホスト機器の処理負担を軽減することができる。   It is also conceivable to stop issuing the above confirmation command. Specifically, as in claim 3, an input unit for inputting that the issuance of the confirmation command is stopped is provided, and when the input unit is inputted to stop the issuance of the confirmation command, the device It is possible that the driver stops issuing confirmation commands. As a method for inputting to the input means to stop issuing the confirmation command, there are manual input by the user, command issuance by the host device, and the like. As described above, the data stored in the buffer of the USB serial converter is transferred from the USB serial converter to the host device every time the communication application issues a read command. There is no loss of capacity. Therefore, it is possible to reduce the processing load on the host device while quickly reading the data stored in the USB serial converter.

以下に本発明の実施形態を図面とともに説明する。
[第一実施形態]
図1はUSBシリアル変換器を用いてホスト機器とシリアル機器とを接続する例を示す説明図である。また、図2はホスト機器およびUSBシリアル変換器の構成を示すハードブロック図である。また、図3はホスト機器の構成を示すソフトブロック図である。なお、USB機器とは、USB規格のデータを処理可能な電子機器であり、シリアル機器とは、シリアル規格のデータを処理可能な電子機器である。
Embodiments of the present invention will be described below with reference to the drawings.
[First embodiment]
FIG. 1 is an explanatory diagram showing an example in which a host device and a serial device are connected using a USB serial converter. FIG. 2 is a hardware block diagram showing the configurations of the host device and the USB serial converter. FIG. 3 is a software block diagram showing the configuration of the host device. The USB device is an electronic device capable of processing USB standard data, and the serial device is an electronic device capable of processing serial standard data.

[USBシリアル変換器20の構成の説明]
USBシリアル変換器20は、USB機器を接続可能なUSB(B)コネクタ21と、USBシリアル変換LSI22と、シリアル機器を接続可能なシリアルコネクタ23と、を備える。なお、USBシリアル変換器20内部では、USB(B)コネクタ21とUSBシリアル変換LSI22のUSBデバイスコントローラ回路ブロック22a(後述)とが接続され、USBシリアル変換LSI22のシリアル回路ブロック22c(後述)とシリアルコネクタ23とが接続されている。
[Description of Configuration of USB Serial Converter 20]
The USB serial converter 20 includes a USB (B) connector 21 to which a USB device can be connected, a USB serial conversion LSI 22, and a serial connector 23 to which a serial device can be connected. In the USB serial converter 20, a USB (B) connector 21 and a USB device controller circuit block 22 a (described later) of the USB serial conversion LSI 22 are connected, and a serial circuit block 22 c (described later) of the USB serial conversion LSI 22 is serially connected. The connector 23 is connected.

USBシリアル変換LSI22は、各種処理を実行するマイコンCPU回路ブロック22bと、マイコンCPU回路ブロック22bとUSB(B)コネクタ21に接続されたUSB機器との間のデータのやり取りを仲介するUSBデバイスコントローラ回路ブロック22aと、マイコンCPU回路ブロック22bとシリアルコネクタ23に接続されたシリアル機器との間のデータのやり取りを仲介するシリアル回路ブロック22cと、を有する。   The USB serial conversion LSI 22 includes a microcomputer CPU circuit block 22b that executes various processes, and a USB device controller circuit that mediates data exchange between the microcomputer CPU circuit block 22b and a USB device connected to the USB (B) connector 21. And a serial circuit block 22c that mediates data exchange between the microcomputer CPU circuit block 22b and a serial device connected to the serial connector 23.

このように構成されたUSBシリアル変換器20は、シリアル機器とUSB機器と間のデータ転送を中継する機能を有する。具体的には、USBシリアル変換器20は、シリアル機器とUSB機器との間に接続された際に、シリアル機器がUSB機器へ送信したシリアル規格のデータを内蔵するバッファ(図示省略)に一時的に蓄積するとともにUSB規格のデータに変換してUSB機器からの要求に応じてUSB機器へ送信し、一方、USB機器がシリアル機器へ送信したUSB規格のデータをシリアル規格のデータに変換した後にシリアル機器へ送信する。なお、シリアル規格のデータをUSB規格のデータに変換する時期としては、バッファにデータを蓄積する前であってもよいし、バッファに蓄積したデータを読み出した後であってもよい。   The USB serial converter 20 configured as described above has a function of relaying data transfer between the serial device and the USB device. Specifically, the USB serial converter 20 is temporarily connected to a buffer (not shown) containing serial standard data transmitted from the serial device to the USB device when connected between the serial device and the USB device. Is converted to USB standard data and transmitted to the USB device in response to a request from the USB device. On the other hand, the USB standard data transmitted from the USB device to the serial device is converted into serial standard data and then serialized. Send to device. The time for converting the serial standard data to the USB standard data may be before the data is stored in the buffer or after the data stored in the buffer is read.

[ホスト機器10の構成の説明]
ホスト機器10は、複数のソフトウェアに基づく処理を時分割で並列に実行するCPU11と、PCチップセット12と、USB機器に対してホストとして各種処理を実行するUSBホストコントローラLSI13と、USB機器を接続可能なUSB(A)コネクタ14と、シリアル機器を接続可能なシリアルコネクタ15と、を備え、USB機器として機能する。なお、本実施形態のホスト機器10は、4個のUSB(A)コネクタ14および1個のシリアルコネクタ15を備える。
[Description of Configuration of Host Device 10]
The host device 10 connects a CPU 11 that executes processes based on a plurality of software in parallel in a time division manner, a PC chip set 12, a USB host controller LSI 13 that executes various processes as a host for the USB device, and a USB device. A USB (A) connector 14 and a serial connector 15 to which a serial device can be connected are provided, and functions as a USB device. Note that the host device 10 of the present embodiment includes four USB (A) connectors 14 and one serial connector 15.

なお、ホスト機器10内部では、CPU11とPCチップセット12とが接続され、PCチップセット12のPCIバスブリッジ回路ブロック12b(後述)とUSBホストコントローラLSI13とがPCIバスを介して接続され、PCチップセット12のシリアル回路ブロック12a(後述)とシリアルコネクタ15とが接続され、USBホストコントローラLSI13とUSB(A)コネクタ14とが接続されている。   In the host device 10, the CPU 11 and the PC chip set 12 are connected, and the PCI bus bridge circuit block 12 b (described later) of the PC chip set 12 and the USB host controller LSI 13 are connected via the PCI bus, and the PC chip. A serial circuit block 12a (described later) of the set 12 and a serial connector 15 are connected, and a USB host controller LSI 13 and a USB (A) connector 14 are connected.

また、PCチップセット12には、CPU11とシリアル機器との間のデータのやり取りを仲介するシリアル回路ブロック12aや、CPU11とPCIバスに接続される各種構成と間のデータのやり取りを仲介するPCIバスブリッジ回路ブロック12bなどが搭載されている。   The PC chip set 12 includes a serial circuit block 12a that mediates data exchange between the CPU 11 and the serial device, and a PCI bus that mediates data exchange between the CPU 11 and various components connected to the PCI bus. A bridge circuit block 12b and the like are mounted.

また、USBホストコントローラLSI13は、CPU11に制御されて、USB規格のデータを生成し、その生成したデータをUSB(A)コネクタ14を介してUSB(A)コネクタ14に接続されるUSB機器に出力するとともに、USB機器からUSB(A)コネクタ14を介して送信されてくる通信信号を受信して、受信したデータをCPU11に入力する。   Also, the USB host controller LSI 13 is controlled by the CPU 11 to generate USB standard data, and outputs the generated data to the USB device connected to the USB (A) connector 14 via the USB (A) connector 14. At the same time, a communication signal transmitted from the USB device via the USB (A) connector 14 is received, and the received data is input to the CPU 11.

また、ホスト機器10は、図3に示すように、アプリケーション層に通信アプリケーション101を備え、API層にシリアルAPI102を備え、デバイスドライバ層にUSBシリアル変換器デバイスドライバ103、16550シリアルデバイスドライバ104、およびUSBホストコントローラデバイスドライバ105を備える。なお、これらホスト機器10が備える各種アプリケーションソフトについては、上述のCPU11、PCチップセット12、およびUSBホストコントローラLSI13によって実行される。   Further, as shown in FIG. 3, the host device 10 includes a communication application 101 in the application layer, a serial API 102 in the API layer, a USB serial converter device driver 103, a 16550 serial device driver 104 in the device driver layer, and A USB host controller device driver 105 is provided. Various application software provided in the host device 10 is executed by the CPU 11, the PC chip set 12, and the USB host controller LSI 13 described above.

デバイスドライバとしてのUSBシリアル変換器デバイスドライバ103は、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器20との間でUSB規格のデータを送受信可能である。また、USBシリアル変換器デバイスドライバ103は、USBシリアル変換器20に対して各種コマンドを発行可能であり、USBシリアル変換器20のバッファに蓄積されるデータの有無を確認するための確認コマンド(ポーリング)を予め設定された周期にてUSBシリアル変換器20へ発行する。なお、この予め設定された周期については、バッファの容量およびUSBシリアル変換器20との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定され、本実施形態では16msecに設定される。   The USB serial converter device driver 103 as a device driver can send and receive USB standard data to and from the USB serial converter 20 via the USB host controller device driver 105. Further, the USB serial converter device driver 103 can issue various commands to the USB serial converter 20, and a confirmation command (polling) for checking the presence or absence of data accumulated in the buffer of the USB serial converter 20. ) Is issued to the USB serial converter 20 at a preset cycle. The preset period is set in advance according to the capacity of the buffer and the maximum data transfer amount per unit time when performing data transfer with the USB serial converter 20, and in the present embodiment, 16 msec. Set to

[ホスト機器10のその他の構成について]
なお、本実施形態のホスト機器10のその他の構成については、公知技術に従っているので、ここでは詳細な説明は省略する。
[Other configuration of host device 10]
Since other configurations of the host device 10 according to the present embodiment are in accordance with known techniques, detailed description thereof is omitted here.

[従来のホスト機器10とシリアル機器30とのデータ送受信プロセスの説明]
次に、USBシリアル変換器20を用いてホスト機器10とシリアル機器30とを接続し、ホスト機器10とシリアル機器30との間でデータの送受信を行う際の従来のプロセスを(1)OPENコマンド発行、(2)READコマンド発行、(3)WRITEコマンド発行、および(4)CLOSEコマンド発行の順に、図4を参照して説明する。なお、図4は従来のホスト機器10とシリアル機器30とのデータ送受信プロセスを説明するシーケンス図である。
[Description of Data Transmission / Reception Process Between Conventional Host Device 10 and Serial Device 30]
Next, a conventional process for transmitting and receiving data between the host device 10 and the serial device 30 by connecting the host device 10 and the serial device 30 using the USB serial converter 20 is described as follows: (1) OPEN command The order of issue, (2) READ command issue, (3) WRITE command issue, and (4) CLOSE command issue will be described in this order. FIG. 4 is a sequence diagram for explaining a data transmission / reception process between the conventional host device 10 and the serial device 30.

(1)OPENコマンド発行
通信アプリケーション101とUSBシリアル変換器20との間でデータの送受信を開始する際には、通信アプリケーション101がOPENコマンドを発行する。すなわち、通信アプリケーション101が、USBシリアル変換器20とのデータの送受信を開始するためにOPENコマンドを発行すると、そのOPENコマンドはシリアルAPI102を介してUSBシリアル変換器デバイスドライバ103に送信される。USBシリアル変換器デバイスドライバ103では、OPENコマンドを受信するとOPEN返値を発行する。このOPEN返値は、シリアルAPI102を介して通信アプリケーション101へ送信される。また、USBシリアル変換器デバイスドライバ103では、USBシリアル変換器20に対してコマンドを発行する。このコマンドは、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器20へ送信される。USBシリアル変換器20では、コマンドを受信するとコマンド返信割込を発行する。コマンド返信割込は、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器デバイスドライバ103へ送信される。以上のプロセスにより、通信アプリケーション101とUSBシリアル変換器20との間でデータの送受信が開始される。
(1) OPEN command issuance When starting transmission / reception of data between the communication application 101 and the USB serial converter 20, the communication application 101 issues an OPEN command. That is, when the communication application 101 issues an OPEN command to start transmission / reception of data with the USB serial converter 20, the OPEN command is transmitted to the USB serial converter device driver 103 via the serial API 102. When the USB serial converter device driver 103 receives the OPEN command, it issues an OPEN return value. This OPEN return value is transmitted to the communication application 101 via the serial API 102. The USB serial converter device driver 103 issues a command to the USB serial converter 20. This command is transmitted to the USB serial converter 20 via the USB host controller device driver 105. When the USB serial converter 20 receives a command, it issues a command reply interrupt. The command reply interrupt is transmitted to the USB serial converter device driver 103 via the USB host controller device driver 105. Through the above process, data transmission / reception is started between the communication application 101 and the USB serial converter 20.

そして、コマンド返信割込を受信したUSBシリアル変換器デバイスドライバ103は、所定周期でポーリングを開始する。具体的には、USBシリアル変換器デバイスドライバ103は、USBシリアル変換器20のバッファにデータが蓄積されていることを確認するためのコマンドを発行する。このコマンドは、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器20へ送信される。USBシリアル変換器20では、バッファにデータが蓄積しているか否かを確認し、確認結果を示すコマンド(コマンド返信割込)を発行する。コマンド返信割込は、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器デバイスドライバ103へ送信される。   The USB serial converter device driver 103 that has received the command reply interrupt starts polling at a predetermined cycle. Specifically, the USB serial converter device driver 103 issues a command for confirming that data is stored in the buffer of the USB serial converter 20. This command is transmitted to the USB serial converter 20 via the USB host controller device driver 105. The USB serial converter 20 checks whether data is stored in the buffer and issues a command (command reply interrupt) indicating the check result. The command reply interrupt is transmitted to the USB serial converter device driver 103 via the USB host controller device driver 105.

なお、USBシリアル変換器20が、シリアル機器から送信されたデータを受信し、その受信したデータをバッファに蓄積しているときには、通信アプリケーション101がREADコマンドを発行するのを待って、その蓄積するデータを通信アプリケーション101へ向けて送信する。   When the USB serial converter 20 receives the data transmitted from the serial device and accumulates the received data in the buffer, it waits for the communication application 101 to issue the READ command and accumulates it. Data is transmitted to the communication application 101.

なお、本実施形態では、ポーリングを行う周期の初期値が16msecに設定されており、以後この周期にてポーリングが実行される。
(2)READコマンド発行
通信アプリケーション101では、所定の周期でREADコマンドを発行するように設定されており、この周期にてREADコマンドを発行する。なお、READコマンドとは、USBシリアル変換器20のバッファに蓄積されたデータを読み出すためのコマンドであり、USBシリアル変換器20のバッファの空き容量が無くならないように設定された周期で発行される。なお、この周期については通信アプリケーション101によって設定される。
In the present embodiment, the initial value of the polling cycle is set to 16 msec, and thereafter polling is executed in this cycle.
(2) READ command issuance The communication application 101 is set to issue a READ command at a predetermined cycle, and issues a READ command at this cycle. The READ command is a command for reading data stored in the buffer of the USB serial converter 20, and is issued at a cycle set so that the free capacity of the buffer of the USB serial converter 20 is not lost. . Note that this cycle is set by the communication application 101.

まず、通信アプリケーション101が、USBシリアル変換器20のバッファに蓄積されるデータを読み出すためにREADコマンドを発行すると、そのREADコマンドはシリアルAPI102を介してUSBシリアル変換器デバイスドライバ103に送信される。USBシリアル変換器デバイスドライバ103では、READコマンドを受信するとREAD返値を発行する。このREAD返値は、シリアルAPI102を介して通信アプリケーション101へ送信される。また、USBシリアル変換器デバイスドライバ103では、USBシリアル変換器20に対してコマンド発行する。このコマンドは、USBホストコントローラデバイスドライバ105を介してUSBシリアル変換器20へ送信される。USBシリアル変換器20では、コマンドを受信すると、データをバッファに蓄積しているときには、その蓄積するデータをUSBホストコントローラデバイスドライバ105を介してUSBシリアル変換器デバイスドライバ103へ送信する。USBシリアル変換器デバイスドライバ103では、受信したデータをUSB規格に変換した後にシリアルAPI102などを介して通信アプリケーション101へ送信する。通信アプリケーション101では、受信したデータをバッファに一時保管し、そのデータを必要とするアプリケーションの指示によって処理される。   First, when the communication application 101 issues a READ command to read data stored in the buffer of the USB serial converter 20, the READ command is transmitted to the USB serial converter device driver 103 via the serial API 102. When the USB serial converter device driver 103 receives the READ command, it issues a READ return value. This READ return value is transmitted to the communication application 101 via the serial API 102. The USB serial converter device driver 103 issues a command to the USB serial converter 20. This command is transmitted to the USB serial converter 20 via the USB host controller device driver 105. When the USB serial converter 20 receives the command and stores data in the buffer, the USB serial converter 20 transmits the stored data to the USB serial converter device driver 103 via the USB host controller device driver 105. The USB serial converter device driver 103 converts the received data into the USB standard and then transmits the data to the communication application 101 via the serial API 102 or the like. In the communication application 101, the received data is temporarily stored in a buffer and processed according to an instruction from an application that requires the data.

(3)WRITEコマンド発行
他のアプリケーションからの指示によってシリアル機器にデータを送信する場合には、通信アプリケーション101が、USBシリアル変換器20のバッファにデータを書き込むためにWRITEコマンドを発行する。すなわち、通信アプリケーション101が、USBシリアル変換器20のバッファにデータを書き込むためにWRITEコマンドを発行すると、そのWRITEコマンドはシリアルAPI102を介してUSBシリアル変換器デバイスドライバ103に送信される。一方、USBシリアル変換器デバイスドライバ103では、WRITEコマンドを受信するとWRITE返値を発行する。このWRITE返値は、シリアルAPI102を介して通信アプリケーション101へ送信される。そして、通信アプリケーション101が、USBシリアル変換器20のバッファに書き込みたいデータをシリアルAPI102などを介してUSBシリアル変換器20へ送信する。USBシリアル変換器20では、受信したデータをバッファへ一旦保管した後にシリアル規格に変換してシリアル機器へ送信する。
(3) WRITE command issuance When data is transmitted to a serial device according to an instruction from another application, the communication application 101 issues a WRITE command to write data to the buffer of the USB serial converter 20. That is, when the communication application 101 issues a WRITE command to write data to the buffer of the USB serial converter 20, the WRITE command is transmitted to the USB serial converter device driver 103 via the serial API 102. On the other hand, when the USB serial converter device driver 103 receives the WRITE command, it issues a WRITE return value. This WRITE return value is transmitted to the communication application 101 via the serial API 102. Then, the communication application 101 transmits data to be written to the buffer of the USB serial converter 20 to the USB serial converter 20 via the serial API 102 or the like. The USB serial converter 20 temporarily stores the received data in a buffer, converts it into a serial standard, and transmits it to a serial device.

(4)CLOSEコマンド発行
通信アプリケーション101とUSBシリアル変換器20との間でデータの送受信を終了する際には、通信アプリケーション101がCLOSEコマンドを発行する。すなわち、通信アプリケーション101が、USBシリアル変換器20とのデータの送受信を終了するためにCLOSEコマンドを発行すると、そのCLOSEコマンドはシリアルAPI102を介してUSBシリアル変換器デバイスドライバ103に送信される。一方、USBシリアル変換器デバイスドライバ103では、CLOSEコマンドを受信すると、これまで定期的に行ってきたポーリングを停止するとともにCLOSE返値を発行する。このCLOSE返値は、シリアルAPI102を介して通信アプリケーション101へ送信される。
(4) CLOSE command issuance When the transmission / reception of data between the communication application 101 and the USB serial converter 20 is completed, the communication application 101 issues a CLOSE command. That is, when the communication application 101 issues a CLOSE command to end data transmission / reception with the USB serial converter 20, the CLOSE command is transmitted to the USB serial converter device driver 103 via the serial API 102. On the other hand, when receiving the CLOSE command, the USB serial converter device driver 103 stops the polling that has been periodically performed and issues a CLOSE return value. This CLOSE return value is transmitted to the communication application 101 via the serial API 102.

[ポーリング周期変更処理(1)の説明]
以下に、USBシリアル変換器デバイスドライバ103により実行されるポーリング周期変更処理の処理(1)手順を図5のフローチャートおよび図6に基づいて説明する。なお、図6はポーリング周期変更処理(1)を説明するシーケンス図である。
[Description of polling cycle change processing (1)]
Hereinafter, the procedure (1) of the polling cycle changing process executed by the USB serial converter device driver 103 will be described with reference to the flowchart of FIG. 5 and FIG. FIG. 6 is a sequence diagram for explaining the polling cycle changing process (1).

このポーリング周期変更処理(1)は、ホスト機器10が起動している場合において他の処理からは独立して繰り返し実行される。
まず、USBシリアル変換器デバイスドライバ103によるコマンド発行であるドライバコールが開始されると、そのドライバコールの種別に応じてファンクション分岐が行われる。本実施形態では、(A)ドライバコールの種別がOPENコマンドである場合、(B)ドライバコールの種別がCLOSEコマンドである場合、(C)ドライバコールの種別がREADコマンドである場合、(D)ドライバコールの種別がWRITEコマンドである場合、(E)ドライバコールの種別がボーレート設定コマンドである場合を説明する。
This polling cycle changing process (1) is repeatedly executed independently of other processes when the host device 10 is activated.
First, when a driver call that is a command issue by the USB serial converter device driver 103 is started, a function branch is performed according to the type of the driver call. In this embodiment, (A) when the type of driver call is an OPEN command, (B) when the type of driver call is a CLOSE command, (C) when the type of driver call is a READ command, (D) A case where the type of the driver call is a WRITE command and (E) the type of the driver call is a baud rate setting command will be described.

(A)ドライバコールの種別がOPENコマンドである場合
この処理では、設定内容を初期化するよう指示する初期化コマンドを発行する。初期化コマンドが発行されると、タイマ処理の設定を初期化する。本実施形態ではポーリング周期が16msecに設定される。そして、ドライバコールを終了する。
(A) When the type of the driver call is an OPEN command In this process, an initialization command for instructing to initialize the setting contents is issued. When the initialization command is issued, the timer processing settings are initialized. In the present embodiment, the polling period is set to 16 msec. Then, the driver call ends.

なお、ホスト機器10が搭載するOSの機能の一つであるタイマ起動処理が実行されると、上述のタイマ処理が開始され、本実施形態では250msecごとに上述のようなREADコマンドを発行する。そして、タイマ処理を終了する。   Note that when the timer activation process, which is one of the functions of the OS installed in the host device 10, is executed, the above-described timer process is started, and in the present embodiment, the above-described READ command is issued every 250 msec. Then, the timer process ends.

(B)ドライバコールの種別がCLOSEコマンドである場合
この処理では、タイマ処理の設定を解除する。このことにより、タイマ処理が実行されなくなり、以後READコマンドが発行されなくなる。また、上述のようなCLOSEコマンドの発行によってポーリングも停止する。そして、ドライバコールを終了する。
(B) When the type of driver call is a CLOSE command In this process, the timer process setting is canceled. As a result, the timer process is not executed and the READ command is not issued thereafter. Also, polling is stopped by issuing the CLOSE command as described above. Then, the driver call ends.

(C)ドライバコールの種別がREADコマンドである場合
この処理では、READデータの出力処理を実行する。具体的には、USBシリアル変換器デバイスドライバ103内のバッファからデータを読み出す。読み出したデータについては、そのデータを必要とするアプリケーションの指示によって処理される。さらに、タイマ処理の再設定を行う。具体的には、処理を実行する度に内蔵するメモリ(図示省略)に記憶された処理時刻記録を参照して、前回の処理時刻から今回の処理時刻までの時間を計算した計算結果を新しいポーリング周期として設定する。一例を挙げると、前回READコマンドを発行した時刻から今回READコマンドを発行した時刻までの時間が250msecである場合には、ポーリング周期を250msecに設定すると云った具合である。そして、ドライバコールを終了する。
(C) When Driver Call Type is READ Command In this process, an output process of READ data is executed. Specifically, data is read from a buffer in the USB serial converter device driver 103. The read data is processed according to an instruction from an application that requires the data. Furthermore, the timer process is reset. Specifically, each time a process is executed, the processing time record stored in a built-in memory (not shown) is referred to, and the calculation result obtained by calculating the time from the previous processing time to the current processing time is newly polled. Set as period. As an example, when the time from the time when the READ command is issued to the time when the READ command is issued is 250 msec, the polling period is set to 250 msec. Then, the driver call ends.

なお、上述のUSBシリアル変換器デバイスドライバ103内のバッファに保管されるデータは、上述のようなREADデータ出力処理にて読み出される一方、コマンド完了割り込み処理が開始された際にも読み出される。具体的には、コマンド完了割り込み処理が開始されると、USBシリアル変換器デバイスドライバ103内のバッファに保管されるデータが読み出され、その読み出されたデータはUSBシリアル変換器20へ転送される。USBシリアル変換器20では、転送されたデータをバッファに保管する。なお、このバッファに保管されたデータは、USB規格からシリアル規格へ変換された後にシリアル機器へ送信される。コマンド完了割り込み処理が終了する。   Note that the data stored in the buffer in the USB serial converter device driver 103 is read by the READ data output process as described above, and is also read when the command completion interrupt process is started. Specifically, when the command completion interrupt process is started, the data stored in the buffer in the USB serial converter device driver 103 is read, and the read data is transferred to the USB serial converter 20. The The USB serial converter 20 stores the transferred data in a buffer. The data stored in the buffer is transmitted from the USB standard to the serial standard and then transmitted to the serial device. Command completion interrupt processing ends.

(D)ドライバコールの種別がWRITEコマンドである場合
この処理では、WRITEデータの入力処理を実行する。具体的には、USBシリアル変換器デバイスドライバ103内のバッファにデータが書き込まれるとともに、USBシリアル変換器20のバッファに書き込まれる。そして、WRITEコマンドを発行し、上述のようにタイマ処理の再設定を行う。そして、ドライバコールを終了する。
(D) When the type of the driver call is a WRITE command In this process, a WRITE data input process is executed. Specifically, data is written to a buffer in the USB serial converter device driver 103 and also written to a buffer of the USB serial converter 20. Then, a WRITE command is issued to reset the timer process as described above. Then, the driver call ends.

(E)ドライバコールの種別がボーレート設定コマンドである場合
この処理では、ボーレート設定コマンドを発行する。なお、ボーレート(bps:Bits Per Second)とは、RS232Cのシリアル通信速度であり、シリアル変換器30との間でデータ転送を行う際の単位時間当たりのデータ転送量である。このボーレートについては通信アプリケーション101によって設定される。そして、ドライバコールを終了する。
(E) When the type of driver call is a baud rate setting command In this process, a baud rate setting command is issued. The baud rate (bps: Bits Per Second) is an RS232C serial communication speed, and is a data transfer amount per unit time when data is transferred to and from the serial converter 30. This baud rate is set by the communication application 101. Then, the driver call ends.

[第一実施形態の効果]
(1)このように第一実施形態のホスト機器10によれば、READコマンドを発行する間隔を計算した計算結果を新しいポーリング周期として設定する。このように計算したポーリング周期は、USBシリアル変換器20のバッファの容量およびUSBシリアル変換器20との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定されたポーリング周期の初期値よりも長いために、変更後のポーリング周期が変更前に比べて長くなる。なお、USBシリアル変換器20のバッファに蓄積されたデータについては、通信アプリケーション101がREADコマンドを発行する度に、USBシリアル変換器20からホスト機器10にデータ転送されるので、USBシリアル変換器20のバッファの空き容量が無くなることはない。したがって、USBシリアル変換器20に蓄積されたデータを速やかに読み出しながら、ホスト機器10の処理負担を軽減することができる。
[Effect of the first embodiment]
(1) As described above, according to the host device 10 of the first embodiment, the calculation result obtained by calculating the interval for issuing the READ command is set as a new polling cycle. The polling cycle calculated in this way is a polling preset in accordance with the buffer capacity of the USB serial converter 20 and the maximum data transfer amount per unit time when data is transferred to and from the USB serial converter 20. Since the period is longer than the initial value, the polling period after the change becomes longer than before the change. The data accumulated in the buffer of the USB serial converter 20 is transferred from the USB serial converter 20 to the host device 10 every time the communication application 101 issues a READ command. There is no loss of free buffer space. Therefore, the processing load on the host device 10 can be reduced while quickly reading the data stored in the USB serial converter 20.

[他の実施形態]
以上、本発明の一実施形態について説明したが、本発明は上記実施形態に限定されるものではなく、以下のような様々な態様にて実施することが可能である。
[Other Embodiments]
As mentioned above, although one Embodiment of this invention was described, this invention is not limited to the said embodiment, It is possible to implement in the following various aspects.

(1)上記実施形態では、READコマンドを発行する間隔を計算した計算結果を新しいポーリング周期として設定するが、これには限られず、例えば、通信アプリケーション101によって設定したボーレートに対応する周期を新しいポーリング周期として設定してもよい。なお、図7はポーリング周期変更処理(2)を示すフローチャートであり、図8はポーリング周期変更処理(2)を説明するシーケンス図である。具体的には、図7および図8に例示するように、ドライバコールの種別がボーレート設定である場合にボーレートコマンドを発行した後に、タイマ処理の再設定を行う。この際、通信アプリケーション101によって設定したボーレートに対応する周期を新しいポーリング周期として設定する。なおこの場合、ドライバコールの種別がREADコマンドである場合にREADデータの出力処理を実行した後、および、ドライバコールの種別がWRITEコマンドである場合にWRITEコマンドを発行した後に実行する、タイマ処理の再設定でREADコマンドを発行する間隔を計算する処理を行わない。このように計算したポーリング周期は、上述のように予め設定されたポーリング周期の初期値よりも長いために、変更後のポーリング周期が変更前に比べて長くなる。なお、USBシリアル変換器20のバッファに蓄積されたデータについては、上述のように、通信アプリケーション101がREADコマンドを発行する度に、USBシリアル変換器20からホスト機器10にデータ転送されるので、USBシリアル変換器20のバッファの空き容量が無くなることはない。したがって、USBシリアル変換器20に蓄積されたデータを速やかに読み出しながら、ホスト機器10の処理負担を軽減することができる。   (1) In the above embodiment, the calculation result obtained by calculating the interval at which the READ command is issued is set as a new polling cycle. However, the present invention is not limited to this. For example, the cycle corresponding to the baud rate set by the communication application 101 is set as a new polling cycle. You may set as a period. 7 is a flowchart showing the polling cycle changing process (2), and FIG. 8 is a sequence diagram for explaining the polling cycle changing process (2). Specifically, as illustrated in FIGS. 7 and 8, when the type of the driver call is a baud rate setting, the timer process is reset after issuing a baud rate command. At this time, a cycle corresponding to the baud rate set by the communication application 101 is set as a new polling cycle. In this case, the timer process is executed after the READ data output process is executed when the driver call type is the READ command, and after the WRITE command is issued when the driver call type is the WRITE command. The processing for calculating the interval for issuing the READ command at the resetting is not performed. Since the polling period calculated in this way is longer than the initial value of the preset polling period as described above, the polling period after the change becomes longer than before the change. The data stored in the buffer of the USB serial converter 20 is transferred from the USB serial converter 20 to the host device 10 every time the communication application 101 issues a READ command as described above. The free space of the buffer of the USB serial converter 20 is not lost. Therefore, the processing load on the host device 10 can be reduced while quickly reading the data stored in the USB serial converter 20.

なお、前述した、タイマ処理再設定による、通信アプリケーション101によって設定したボーレートに対応する周期を新しいポーリング周期の具体的は数値(図7、ポーリング周期X(ms))設定の一例を以下に説明する。ここで、「SET」は、通信アプリケーション101が設定する通信速度(ボーレート:bps)である。通信アプリケーション101が送付するデータ(有効データ)8bitに対して、RS232Cで転送するデータ(転送データ)は、前記有効データに加えRS232Cスタートビット(START−bit)とストップビット(STOP−bit)とが加わるので、有効データ8bit(1byte)を送付するときのRS232C転送データは(8bit+1bit+1bit)となる。なお、本実施形態におけるUSBシリアル変換器20(例えば、FT232R)のバッファ容量は256(byte)である。よって、ポーリング周期Xは、X(sec)=1÷(SET÷(8+1+1)÷256)となり、秒からミリ秒へ単位変換すれば、X*1000=1÷(SETbps÷(8+1+1)÷256)=X(ms)となる。   A specific example of setting a new polling cycle with a numerical value (FIG. 7, polling cycle X (ms)) corresponding to the baud rate set by the communication application 101 by resetting the timer processing described above will be described below. . Here, “SET” is a communication speed (baud rate: bps) set by the communication application 101. Data (transfer data) transferred by RS232C with respect to data (valid data) 8 bits sent by the communication application 101 includes an RS232C start bit (START-bit) and a stop bit (STOP-bit) in addition to the valid data. Therefore, the RS232C transfer data when valid data 8 bits (1 byte) is sent is (8 bits + 1 bit + 1 bit). Note that the buffer capacity of the USB serial converter 20 (for example, FT232R) in this embodiment is 256 (bytes). Therefore, the polling cycle X is X (sec) = 1 / (SET / (8 + 1 + 1) / 256). If the unit is converted from seconds to milliseconds, X * 1000 = 1 / (SETbps / (8 + 1 + 1) / 256) = X (ms).

(2)また、OPENコマンドを発行後に、ポーリングを停止するようにしてもよい。なお、図9はポーリング周期変更処理(3)を説明するシーケンス図である。具体的には、図9に例示するように、入力部としてのホスト機器10のキーボードなどに対するユーザからの指示や他のアプリケーションからの指示により、通信アプリケーション101が、ポーリングを停止するためにマニュアルトリガモードに変更する旨のモード変更コマンドを発行する。すなわち、通信アプリケーション101が、モード変更コマンドを発行すると、そのモード変更コマンドはシリアルAPI102を介してUSBシリアル変換器デバイスドライバ103に送信される。一方、USBシリアル変換器デバイスドライバ103では、そのモード変更コマンドを受信すると、これまで定期的に行ってきたポーリングを停止するとともにモード変更返値を発行する。このモード変更返値は、シリアルAPI102を介して通信アプリケーション101へ送信される。なお、USBシリアル変換器20のバッファに蓄積されたデータについては、上述のように、通信アプリケーション101がREADコマンドを発行する度に、USBシリアル変換器20からホスト機器10にデータ転送されるので、USBシリアル変換器20のバッファの空き容量が無くなることはない。したがって、USBシリアル変換器20に蓄積されたデータを速やかに読み出しながら、ホスト機器10の処理負担を軽減することができる。   (2) Polling may be stopped after issuing an OPEN command. FIG. 9 is a sequence diagram for explaining the polling cycle changing process (3). Specifically, as illustrated in FIG. 9, the communication application 101 uses a manual trigger to stop polling according to an instruction from a user or an instruction from another application to the keyboard of the host device 10 as an input unit. Issue a mode change command to change the mode. That is, when the communication application 101 issues a mode change command, the mode change command is transmitted to the USB serial converter device driver 103 via the serial API 102. On the other hand, when receiving the mode change command, the USB serial converter device driver 103 stops polling that has been performed regularly and issues a mode change return value. This mode change return value is transmitted to the communication application 101 via the serial API 102. The data stored in the buffer of the USB serial converter 20 is transferred from the USB serial converter 20 to the host device 10 every time the communication application 101 issues a READ command as described above. The free space of the buffer of the USB serial converter 20 is not lost. Therefore, the processing load on the host device 10 can be reduced while quickly reading the data stored in the USB serial converter 20.

USBシリアル変換器を用いてホスト機器とシリアル機器とを接続する例を示す説明図である。It is explanatory drawing which shows the example which connects a host apparatus and a serial apparatus using a USB serial converter. ホスト機器およびUSBシリアル変換器の構成を示すハードブロック図である。It is a hardware block diagram which shows the structure of a host apparatus and a USB serial converter. ホスト機器の構成を示すソフトブロック図である。It is a software block diagram which shows the structure of a host apparatus. 従来のホスト機器とシリアル機器とのデータ送受信プロセスを説明するシーケンス図である。It is a sequence diagram explaining the data transmission / reception process of the conventional host device and a serial device. ポーリング周期変更処理(1)を示すフローチャートである。It is a flowchart which shows a polling period change process (1). ポーリング周期変更処理(1)を説明するシーケンス図である。It is a sequence diagram explaining a polling period change process (1). ポーリング周期変更処理(2)を示すフローチャートである。It is a flowchart which shows a polling period change process (2). ポーリング周期変更処理(2)を説明するシーケンス図である。It is a sequence diagram explaining a polling period change process (2). ポーリング周期変更処理(3)を説明するシーケンス図である。It is a sequence diagram explaining a polling period change process (3).

符号の説明Explanation of symbols

10…ホスト機器、11…CPU、12…PCチップセット、12a…シリアル回路ブロック、12b…PCIバスブリッジ回路ブロック、13…USBホストコントローラLSI、14…USB(A)コネクタ、15…シリアルコネクタ、20…USBシリアル変換器、21…USB(B)コネクタ、22…USBシリアル変換LSI、22a…USBデバイスコントローラ回路ブロック、22b…マイコンCPU回路ブロック、22c…シリアル回路ブロック、23…シリアルコネクタ、30…シリアル機器、101…通信アプリケーション、102…シリアルAPI、103…USBシリアル変換器デバイスドライバ、104…シリアルデバイスドライバ、105…USBホストコントローラデバイスドライバ DESCRIPTION OF SYMBOLS 10 ... Host apparatus, 11 ... CPU, 12 ... PC chip set, 12a ... Serial circuit block, 12b ... PCI bus bridge circuit block, 13 ... USB host controller LSI, 14 ... USB (A) connector, 15 ... Serial connector, 20 ... USB serial converter, 21 ... USB (B) connector, 22 ... USB serial conversion LSI, 22a ... USB device controller circuit block, 22b ... Microcomputer CPU circuit block, 22c ... Serial circuit block, 23 ... Serial connector, 30 ... Serial Device 101 Communication application 102 Serial API 103 USB serial converter device driver 104 Serial device driver 105 USB host controller device driver

Claims (3)

シリアル規格のデータを処理可能な電子機器であるシリアル機器とUSB規格のデータを処理可能な電子機器であるUSB機器との間に接続された際に、前記シリアル機器が前記USB機器へ送信したシリアル規格のデータを内蔵するバッファに一時的に蓄積するとともにUSB規格のデータに変換して前記USB機器からの要求に応じて前記USB機器へ送信し、一方、前記USB機器が前記シリアル機器へ送信したUSB規格のデータをシリアル規格のデータに変換した後に前記シリアル機器へ送信し、前記シリアル機器と前記USB機器との間のデータ転送を中継するUSBシリアル変換器との間でUSB規格のデータを送受信可能であり、前記バッファに蓄積されるデータの有無を確認するための確認コマンドを、前記バッファの容量および前記USBシリアル変換器との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定された周期にて前記USBシリアル変換器へ発行するデバイスドライバと、
前記USBシリアル変換器の前記バッファに蓄積されたデータを読み出すための読出しコマンドを前記デバイスドライバを介して前記USBシリアル変換器へ発行する通信アプリケーションと、
を備え、前記USB機器として機能するホスト機器であって、
前記デバイスドライバは、前記通信アプリケーションが前記読出しコマンドを発行する周期を計測し、前記確認コマンドを発行する周期を予め設定された周期からその計測した周期へ変更することを特徴とするホスト機器。
The serial device transmitted to the USB device when connected between a serial device that is an electronic device capable of processing serial standard data and a USB device that is an electronic device capable of processing USB standard data Standard data is temporarily stored in a built-in buffer, converted to USB standard data and transmitted to the USB device in response to a request from the USB device, while the USB device transmits to the serial device USB standard data is converted to serial standard data and then transmitted to the serial device, and USB standard data is transmitted and received between the serial device and the USB serial converter that relays data transfer between the serial device and the USB device. A confirmation command for confirming the presence or absence of data accumulated in the buffer. And the device driver issuing into the USB serial converter at preset periods according to the maximum data transfer amount per unit time for data transfer in and between the USB serial converter,
A communication application for issuing a read command for reading data stored in the buffer of the USB serial converter to the USB serial converter via the device driver;
A host device that functions as the USB device,
The host device is characterized in that the device driver measures a cycle in which the communication application issues the read command, and changes a cycle in which the confirmation command is issued from a preset cycle to the measured cycle.
シリアル規格のデータを処理可能な電子機器であるシリアル機器とUSB規格のデータを処理可能な電子機器であるUSB機器との間に接続された際に、前記シリアル機器が前記USB機器へ送信したシリアル規格のデータを内蔵するバッファに一時的に蓄積するとともにUSB規格のデータに変換して前記USB機器からの要求に応じて前記USB機器へ送信し、一方、前記USB機器が前記シリアル機器へ送信したUSB規格のデータをシリアル規格のデータに変換した後に前記シリアル機器へ送信し、前記シリアル機器と前記USB機器との間のデータ転送を中継するUSBシリアル変換器との間でUSB規格のデータを送受信可能であり、前記バッファに蓄積されるデータの有無を確認するための確認コマンドを、前記バッファの容量および前記USBシリアル変換器との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定された周期にて前記USBシリアル変換器へ発行するデバイスドライバと、
前記USBシリアル変換器の前記バッファに蓄積されたデータを読み出すための読出しコマンドを前記デバイスドライバを介して前記USBシリアル変換器へ発行する通信アプリケーションと、
を備え、前記USB機器として機能するホスト機器であって、
前記通信アプリケーションは、前記シリアル機器との間でデータ転送を行う際の単位時間当たりのデータ転送量であるボーレートを設定可能であり、
前記デバイスドライバは、前記通信アプリケーションが設定したボーレートに対応する周期を算出し、前記確認コマンドを発行する周期を予め設定された周期からその算出した周期へ変更すること
を特徴とするホスト機器。
The serial device transmitted to the USB device when connected between a serial device that is an electronic device capable of processing serial standard data and a USB device that is an electronic device capable of processing USB standard data Standard data is temporarily stored in a built-in buffer, converted to USB standard data and transmitted to the USB device in response to a request from the USB device, while the USB device transmits to the serial device USB standard data is converted to serial standard data and then transmitted to the serial device, and USB standard data is transmitted and received between the serial device and the USB serial converter that relays data transfer between the serial device and the USB device. A confirmation command for confirming the presence or absence of data accumulated in the buffer. And the device driver issuing into the USB serial converter at preset periods according to the maximum data transfer amount per unit time for data transfer in and between the USB serial converter,
A communication application for issuing a read command for reading data stored in the buffer of the USB serial converter to the USB serial converter via the device driver;
A host device that functions as the USB device,
The communication application can set a baud rate, which is a data transfer amount per unit time when performing data transfer with the serial device,
The host device calculates a period corresponding to a baud rate set by the communication application, and changes a period for issuing the confirmation command from a preset period to the calculated period.
シリアル規格のデータを処理可能な電子機器であるシリアル機器とUSB規格のデータを処理可能な電子機器であるUSB機器との間に接続された際に、前記シリアル機器が前記USB機器へ送信したシリアル規格のデータを内蔵するバッファに一時的に蓄積するとともにUSB規格のデータに変換して前記USB機器からの要求に応じて前記USB機器へ送信し、一方、前記USB機器が前記シリアル機器へ送信したUSB規格のデータをシリアル規格のデータに変換した後に前記シリアル機器へ送信し、前記シリアル機器と前記USB機器との間のデータ転送を中継するUSBシリアル変換器との間でUSB規格のデータを送受信可能であり、前記バッファに蓄積されるデータの有無を確認するための確認コマンドを、前記バッファの容量および前記USBシリアル変換器との間でデータ転送を行う際の単位時間当たりの最大データ転送量に応じて予め設定された周期にて前記USBシリアル変換器へ発行するデバイスドライバと、
前記USBシリアル変換器の前記バッファに蓄積されたデータを読み出すための読出しコマンドを前記デバイスドライバを介して前記USBシリアル変換器へ発行する通信アプリケーションと、
を備え、前記USB機器として機能するホスト機器であって、
前記確認コマンドの発行を停止する旨を入力するための入力手段を備え、
前記デバイスドライバは、前記確認コマンドの発行を停止する旨が入力手段から入力された場合には前記確認コマンドの発行を停止すること
を特徴とするホスト機器。
The serial device transmitted to the USB device when connected between a serial device that is an electronic device capable of processing serial standard data and a USB device that is an electronic device capable of processing USB standard data Standard data is temporarily stored in a built-in buffer, converted to USB standard data and transmitted to the USB device in response to a request from the USB device, while the USB device transmits to the serial device USB standard data is converted to serial standard data and then transmitted to the serial device, and USB standard data is transmitted and received between the serial device and the USB serial converter that relays data transfer between the serial device and the USB device. A confirmation command for confirming the presence or absence of data accumulated in the buffer. And the device driver issuing into the USB serial converter at preset periods according to the maximum data transfer amount per unit time for data transfer in and between the USB serial converter,
A communication application for issuing a read command for reading data stored in the buffer of the USB serial converter to the USB serial converter via the device driver;
A host device that functions as the USB device,
An input means for inputting that the issuance of the confirmation command is stopped;
The host device, wherein the device driver stops issuing the confirmation command when the input means inputs an instruction to stop issuing the confirmation command.
JP2008044631A 2008-02-26 2008-02-26 Host device Active JP4924472B2 (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
JP2008044631A JP4924472B2 (en) 2008-02-26 2008-02-26 Host device

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
JP2008044631A JP4924472B2 (en) 2008-02-26 2008-02-26 Host device

Publications (2)

Publication Number Publication Date
JP2009205271A JP2009205271A (en) 2009-09-10
JP4924472B2 true JP4924472B2 (en) 2012-04-25

Family

ID=41147489

Family Applications (1)

Application Number Title Priority Date Filing Date
JP2008044631A Active JP4924472B2 (en) 2008-02-26 2008-02-26 Host device

Country Status (1)

Country Link
JP (1) JP4924472B2 (en)

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
JP3994583B2 (en) * 1999-06-30 2007-10-24 ブラザー工業株式会社 Serial communication method, serial transmission device, serial reception device, and serial communication system
JP3409749B2 (en) * 1999-09-09 2003-05-26 エヌイーシーマイクロシステム株式会社 Apparatus and method for evaluating USB function
JP2002197048A (en) * 2000-12-26 2002-07-12 Kenwood Corp Electronic equipment and interface conversion method

Also Published As

Publication number Publication date
JP2009205271A (en) 2009-09-10

Similar Documents

Publication Publication Date Title
KR100456180B1 (en) A peripheral device and control method thereof
EP3462328B1 (en) Serial connection between management controller and microcontroller
US20170116147A1 (en) System, device and method for transmitting signals between different communication interfaces
CN110765058A (en) Method, system, equipment and medium for realizing SPI slave function by GPIO
JP2008502976A (en) Bus controller for processing split transactions
JP2010086524A (en) Bridge device with function to save power
CN115499505B (en) USB network card and communication method
CN101937413B (en) Communication method of I2C bus
JP2007088775A (en) Radio communication system, device, and method
JP2003241908A5 (en)
CN101393542B (en) Embedded equipment and method for supporting USB interface by GPIO terminal port
CN101561790B (en) Method, system and device for communication between main control computer and slave computers
JP4924472B2 (en) Host device
JP6418021B2 (en) Information processing apparatus and information processing apparatus control method
JP6299260B2 (en) Information processing apparatus and information processing apparatus control method
CN116541329A (en) Data transmission method, device, equipment and medium
CN101976230B (en) Transaction translator of universal serial bus and input request isochronous transaction method
EP4323880A1 (en) I2c bus architecture using shared clock and dedicated data lines
JP3906838B2 (en) USB compatible digital MFP
CN114385544A (en) UART chip and FPGA chip
KR20070024600A (en) Bus controller for transferring data
JP2008204005A (en) Communication method for peripheral device, computer program, and peripheral device
JP2006238209A (en) Hub apparatus and hub system
US20210157764A1 (en) Data conversion device and data conversion system
KR20030044373A (en) Universal serial bus device for using direct memory access interface

Legal Events

Date Code Title Description
A621 Written request for application examination

Free format text: JAPANESE INTERMEDIATE CODE: A621

Effective date: 20100118

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

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

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

Free format text: PAYMENT UNTIL: 20150217

Year of fee payment: 3

R150 Certificate of patent or registration of utility model

Ref document number: 4924472

Country of ref document: JP

Free format text: JAPANESE INTERMEDIATE CODE: R150

Free format text: JAPANESE INTERMEDIATE CODE: R150