JP2016004516A - Electronic device - Google Patents
Electronic device Download PDFInfo
- Publication number
- JP2016004516A JP2016004516A JP2014126058A JP2014126058A JP2016004516A JP 2016004516 A JP2016004516 A JP 2016004516A JP 2014126058 A JP2014126058 A JP 2014126058A JP 2014126058 A JP2014126058 A JP 2014126058A JP 2016004516 A JP2016004516 A JP 2016004516A
- Authority
- JP
- Japan
- Prior art keywords
- power
- initial
- host device
- printer
- time
- 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.)
- Pending
Links
- 238000000034 method Methods 0.000 claims description 378
- 230000008569 process Effects 0.000 claims description 365
- 230000006854 communication Effects 0.000 claims description 76
- 238000004891 communication Methods 0.000 claims description 62
- 230000008859 change Effects 0.000 claims description 15
- 230000004913 activation Effects 0.000 description 39
- 238000007639 printing Methods 0.000 description 34
- 239000002699 waste material Substances 0.000 description 15
- 230000006870 function Effects 0.000 description 10
- 230000000694 effects Effects 0.000 description 8
- 238000010586 diagram Methods 0.000 description 6
- 230000007246 mechanism Effects 0.000 description 6
- 230000004044 response Effects 0.000 description 5
- 230000032258 transport Effects 0.000 description 5
- 230000007423 decrease Effects 0.000 description 4
- 230000009467 reduction Effects 0.000 description 4
- 230000005611 electricity Effects 0.000 description 3
- 238000001514 detection method Methods 0.000 description 2
- 238000003384 imaging method Methods 0.000 description 2
- 238000012544 monitoring process Methods 0.000 description 2
- 230000007704 transition Effects 0.000 description 2
- 230000003213 activating effect Effects 0.000 description 1
- 238000005452 bending Methods 0.000 description 1
- 230000005540 biological transmission Effects 0.000 description 1
- 230000003111 delayed effect Effects 0.000 description 1
- 238000005516 engineering process Methods 0.000 description 1
- 238000003825 pressing Methods 0.000 description 1
- 239000004065 semiconductor Substances 0.000 description 1
- 230000001960 triggered effect Effects 0.000 description 1
Landscapes
- Accessory Devices And Overall Control Thereof (AREA)
- Power Sources (AREA)
Abstract
Description
本発明は、パーソナルコンピューター(PC)等の外部装置との通信を確立して外部装置から電力供給を受ける電子機器に関する。 The present invention relates to an electronic device that establishes communication with an external device such as a personal computer (PC) and receives power supply from the external device.
例えば特許文献1には、USB端子部がホスト装置(外部装置の一例)と接続された場合、ホスト装置からの電源供給でバッテリー(充電式の電池)を充電する電子機器の一例として携帯電話機が開示されている。この携帯電話機は、USB端子部を介してホスト装置との間でデータ転送を行うことによって初期処理(エニュメレーション)を開始すると共に第1電力(例えば電流値で100mA)でバッテリーへの充電を行う。USB端子部がホスト装置に接続されてから所定時間以内に初期処理が完了した場合はその初期処理に基づいた処理を行う。一方、USB端子部がホスト装置に接続されてから所定時間以内に初期処理が完了しなかった場合は、第1電力よりも大きい第2電力(例えば電流値で500mA)でバッテリーへの充電を行う。 For example, in Patent Document 1, when a USB terminal unit is connected to a host device (an example of an external device), a mobile phone is an example of an electronic device that charges a battery (a rechargeable battery) by supplying power from the host device. It is disclosed. This mobile phone starts initial processing (enumeration) by transferring data to and from the host device via the USB terminal, and charges the battery with the first power (for example, 100 mA in current value). Do. When the initial processing is completed within a predetermined time after the USB terminal unit is connected to the host device, processing based on the initial processing is performed. On the other hand, if the initial processing is not completed within a predetermined time after the USB terminal unit is connected to the host device, the battery is charged with a second power (for example, a current value of 500 mA) larger than the first power. .
ところで、電子機器の電源オフ状態において、ホスト装置とUSB接続されたときに充電を行う場合、制御回路を構成するCPUは、初期処理(エニュメレーション)において、ホスト装置に対して第1電力より大きな第2電力の要求とクラス情報(一例としてプリンタークラス)とを含むディスクリプターと呼ばれる構成情報を送信する。ホスト装置は、第2電力を供給可能であれば、構成情報の設定を通知する初期処理完了通知を電子機器に送信する。電子機器は、初期処理完了通知を受信して初期処理を完了した後、ホスト装置から第2電力の供給を受けることで充電が可能となる。 By the way, when charging is performed when the electronic device is powered off and connected to the host device via USB, the CPU constituting the control circuit uses the first power to the host device in the initial processing (enumeration). Configuration information called a descriptor including a large second power request and class information (for example, a printer class) is transmitted. If the second power can be supplied, the host device transmits an initial processing completion notification for notifying the setting of the configuration information to the electronic device. The electronic device can be charged by receiving the supply of the second power from the host device after receiving the initial processing completion notification and completing the initial processing.
しかし、ホスト装置は電子機器から要求された第2電力で電源供給ができない場合がある。例えばホスト装置と電子機器とがバスパワーで動作するハブを経由して接続されている場合が挙げられる。この場合、電子機器が初期処理において第2電力及びクラス情報を含むディスクリプターと呼ばれる構成情報を送信しても、ホスト装置は第2電力での電源供給が不可能なハブ経由であることを認識し、その構成情報を設定しない。このため、ホスト装置から電子機器に対して、構成情報の設定を通知する初期処理完了通知(設定完了通知)は送信されない。この結果、電子機器はホスト装置から送信されることのない初期処理完了通知を待つことになり、CPUは起動状態のまま放置される。 However, the host device may not be able to supply power with the second power requested from the electronic device. For example, the host device and the electronic device may be connected via a hub that operates on bus power. In this case, even if the electronic device transmits configuration information called a descriptor including the second power and class information in the initial process, the host device recognizes that the power supply via the second power is not possible via the hub. However, the configuration information is not set. For this reason, the initial processing completion notification (setting completion notification) for notifying the setting of the configuration information is not transmitted from the host device to the electronic device. As a result, the electronic device waits for an initial processing completion notification that is not transmitted from the host device, and the CPU is left in an activated state.
また、例えばホスト装置がバッテリー駆動であるときに電力の消費を抑えるため、最大供給電力(例えば電流値500mA)未満の第3電力でしか電源供給を許可しない設定がなされている場合がある。電子機器からこの種のホスト装置に第3電力より大きな第2電力を要求した場合、ホスト装置は第2電力での電源供給ができないので、この場合もホスト装置から電子機器に対して初期処理完了通知が送信されない。このため、電子機器はホスト装置から送信されることのない初期処理完了通知を待つことになり、この場合もCPUは起動状態のまま放置される。 For example, when the host device is driven by a battery, in order to suppress power consumption, there is a case where power supply is permitted only with the third power less than the maximum supply power (for example, a current value of 500 mA). When the second power larger than the third power is requested from the electronic device to the host device of this type, the host device cannot supply power with the second power. In this case, the initial processing is completed from the host device to the electronic device. Notifications are not sent. For this reason, the electronic device waits for an initial processing completion notification that is not transmitted from the host device, and in this case, the CPU is left in an activated state.
ところで、特許文献1に記載の電子機器では、ホスト装置と電子機器との接続を継続する状態で、ホスト装置と電子機器とを再接続する場合がある。例えば電源オフ中に電池が満充電になって通信を切断した後に電池の残量が放電により閾値を下回って再び充電が必要になって再接続するとき、USB充電中に電源アダプターが接続されてUSB充電の中止のために通信を遮断した後、電源アダプターが外されて再びUSB充電を開始するために再接続するときなどが挙げられる。また、ホスト装置と電子機器との接続を継続する状態で、電源のオン/オフが切り替えられて再接続するときが挙げられる。この電源のオン/オフ切替え時は、電子機器が例えばプリンターの場合、ホスト装置に認識させるデバイス機器のクラスを、電源オフ時のクラス(例えばHIDクラス)から、電源オン時のクラス(例えばプリンタークラス)へ切り替える初期処理を行うためにホスト装置と電子機器とが再接続される。 Incidentally, in the electronic device described in Patent Document 1, the host device and the electronic device may be reconnected in a state where the connection between the host device and the electronic device is continued. For example, when the battery is fully charged while the power is off and the communication is cut off, the remaining power of the battery falls below the threshold due to the discharge and needs to be recharged. For example, when the communication is interrupted to stop the USB charging, the power adapter is removed and the USB cable is reconnected to start the USB charging again. Another example is when the host device and the electronic device are continuously connected, and the power source is switched on / off and reconnected. When the power is turned on / off, when the electronic device is a printer, for example, the class of the device device recognized by the host device is changed from the power-off class (for example, HID class) to the power-on class (for example, printer class). The host device and the electronic device are reconnected to perform the initial process of switching to (1).
これらを一例とする再接続時は、ホスト装置と電子機器との間で初期処理が行われるが、特許文献1に記載された電子機器では、再接続の度に、第2電力の要求を含む初期処理を行うことになる。例えば、再接続の前に行った初期処理が何らかの原因で所定時間内に完了できず一度失敗していても、その失敗した同じホスト装置に対して、失敗の確率の高い第2電力の要求を含む初期処理を行う。この結果、高確率で失敗となる初期処理を行って、失敗となるまで所定時間を待たなければならず、この種の無駄な初期処理を実行する制御回路によって、電気が浪費される。 At the time of reconnection using these as an example, initial processing is performed between the host device and the electronic device. However, the electronic device described in Patent Document 1 includes a request for the second power every time reconnection is made. Initial processing will be performed. For example, even if the initial processing performed before reconnection cannot be completed within a predetermined time for some reason and fails once, a request for the second power with a high probability of failure is issued to the same failed host device. Perform initial processing including. As a result, an initial process that fails with high probability must be performed and a predetermined time must be waited until the failure occurs, and electricity is wasted by the control circuit that executes this kind of useless initial process.
なお、上記の課題は、携帯電話機やプリンター(複合機を含む。)等の電子機器に限らず、スキャナー、プロジェクター、デジタルカメラ(撮影装置)、オーディオ装置(音響機器)など、ホスト装置(外部装置)と電子機器とが接続を継続した状態で再接続されるとともに、ホスト装置からの電力供給を受ける電子機器において概ね共通する。 Note that the above problem is not limited to electronic devices such as mobile phones and printers (including multifunction devices), but also host devices (external devices) such as scanners, projectors, digital cameras (imaging devices), and audio devices (acoustic devices). ) And the electronic device are reconnected in a state in which the connection is continued, and is generally common in the electronic device that receives power supply from the host device.
本発明の目的は、外部装置との接続が継続している状態で、外部装置と初期処理を伴う再接続を行う場合に、制御回路の電気の浪費を抑制することができる電子機器を提供することにある。 An object of the present invention is to provide an electronic device capable of suppressing waste of electricity of a control circuit when reconnection with an external device is performed with initial processing in a state where the connection with the external device is continued. There is.
以下、上記課題を解決するための手段及びその作用効果について記載する。
上記課題を解決する電子機器は、外部装置と接続して、通信を行うとともに電力供給を受ける通信回路と、制御回路と、電源スイッチと、を備え、初期状態において前記通信回路が外部装置と接続した場合に、前記制御回路は、第1初期処理を行い、前記第1初期処理が完了したのちに、前記外部装置から電力供給を受け、前記第1初期処理に失敗したときは、前記外部装置から電力供給を受けず、前記第1初期処理が完了して前記外部装置との接続が継続している状態で前記外部装置と再接続を行う場合には、第1初期処理を行い、前記第1初期処理が完了したのちに、前記外部装置から電力供給を受け、前記第1初期処理が失敗して前記外部装置との接続が継続している状態で前記外部装置と再接続を行う場合には、第1初期処理を行わず、前記外部装置から電力供給を受けない。ここで、初期状態とは、初期設定により第1初期処理が設定されている状態を指す。
Hereinafter, means for solving the above-described problems and the effects thereof will be described.
An electronic device that solves the above problem includes a communication circuit that is connected to an external device to perform communication and receive power supply, a control circuit, and a power switch. The communication circuit is connected to the external device in an initial state. In this case, the control circuit performs a first initial process, receives power supply from the external device after the first initial process is completed, and fails in the first initial process, the external device When reconnecting to the external device in a state where the first initial processing is completed and the connection with the external device is continued without receiving power supply from the first, the first initial processing is performed, and the first When power is supplied from the external device after the initial processing is completed, and the first initial processing fails and the connection with the external device is continued, the reconnection to the external device is performed. Performs the first initial processing It receives no power supply from the external device. Here, the initial state refers to a state in which the first initial process is set by the initial setting.
この構成によれば、初期状態において通信回路が外部装置と接続した場合に、制御回路は、第1初期処理を行い、第1初期処理が完了したのちに、外部装置から電力供給を受ける。一方、第1初期処理に失敗したときは、外部装置から電力供給を受けない。また、第1初期処理が完了して外部装置との接続が継続している状態で外部装置と再接続を行う場合には、第1初期処理を行い、第1初期処理が完了したのちに、外部装置から電力供給を受ける。一方、第1初期処理が失敗して外部装置との接続が継続している状態で外部装置と再接続を行う場合には、第1初期処理を行わず、外部装置から電力供給を受けない。よって、制御回路が、第1初期処理を一度失敗している同じ外部装置と再接続するときに、第1初期処理を行うことによる電力の浪費を抑制できる。 According to this configuration, when the communication circuit is connected to the external device in the initial state, the control circuit performs the first initial processing, and receives the power supply from the external device after the first initial processing is completed. On the other hand, when the first initial process fails, no power is supplied from the external device. In addition, when reconnecting with an external device in a state where the first initial processing is completed and the connection with the external device is continued, the first initial processing is performed, and after the first initial processing is completed, Receives power from an external device. On the other hand, when reconnecting with an external device in a state where the first initial processing fails and the connection with the external device is continued, the first initial processing is not performed and no power is supplied from the external device. Therefore, when the control circuit reconnects with the same external device that has once failed in the first initial processing, it is possible to suppress waste of power due to performing the first initial processing.
上記電子機器では、前記制御回路は、前記外部装置との接続が途絶えた後に前記外部装置と接続した場合には、外部装置との接続が途絶える前に第1初期処理が完了したか失敗したかに関わらず、初期状態に戻って、第1初期処理を開始することが好ましい。 In the electronic device, when the connection to the external device is interrupted after the connection to the external device is interrupted, is the first initial process completed or failed before the connection to the external device is interrupted? Regardless, it is preferable to return to the initial state and start the first initial processing.
この構成によれば、制御回路が、外部装置との接続が途絶えた後に外部装置に接続される場合、その接続が途絶える前に第1初期処理が完了したか失敗したかに関わらず、初期状態に戻って、第1初期処理を開始する。ここで、外部装置との接続が途絶えた後に外部装置と接続した場合、その接続相手である外部装置は、接続が途絶える前の外部装置とは異なるものである可能性(第1初期処理が成功する可能性)がある。この場合、初期状態に戻って第1初期処理が行われる。この第1初期処理に成功すれば、例え接続が途絶える前に接続されていた外部装置との第1初期処理が失敗していてそれまで外部装置からの電力供給を受けていなかったとしても、外部装置からの電力供給を受けることが可能になる。例えば第1初期処理を失敗した外部装置と接続が途絶え、次に接続した外部装置がそれまでの外部装置と異なる可能性があるにも拘らず、第1初期処理を行わず、外部装置からの電力供給を受ける機会を逸することを回避できる。 According to this configuration, when the control circuit is connected to the external device after the connection with the external device is interrupted, the initial state regardless of whether the first initial processing is completed or failed before the connection is interrupted. Returning to step 1, the first initial processing is started. Here, when the connection with the external device is interrupted and then connected with the external device, the external device that is the connection partner may be different from the external device before the connection is interrupted (the first initial process was successful) there's a possibility that. In this case, the initial state is returned to the initial state. If the first initial process is successful, even if the first initial process with the external device connected before the connection is lost has failed and the power supply from the external device has not been received, It becomes possible to receive power supply from the apparatus. For example, although the connection with the external device that failed the first initial processing may be lost and the next external device connected may be different from the previous external device, the first initial processing is not performed and the external device It is possible to avoid missing the opportunity to receive power supply.
上記電子機器では、前記制御回路は、電源がオン状態であれば第1種の装置として第1初期処理を行い、電源がオフ状態であれば、第1種の装置と異なる第2種の装置として第1初期処理を行うことが好ましい。 In the electronic apparatus, the control circuit performs the first initial processing as the first type device when the power is on, and the second type device different from the first type device when the power is off. It is preferable to perform the first initial processing.
この構成によれば、制御回路は、電源がオン状態であれば、第1種の装置(一例としてプリンタークラス等の第1のクラスの装置)として第1初期処理を行う。一方、電源がオフ状態であれば第1種と異なる第2種の装置(一例としてヒューマンインターフェイスデバイス(HID)クラス等の第2のクラスの装置)として第1初期処理を行う。よって、外部装置は、電源オン状態であれば接続相手である電子機器を第1種の装置と認識し、第1種の装置として扱う。一方、外部装置は、電源オフ状態にあれば接続相手である電子機器を第2種の装置と認識し、第2種の装置として扱う。よって、電源オン状態にある接続相手を第2種の装置として扱ったり、電源オフ状態にある接続相手を第1種の装置として扱ったりする誤認による不都合を回避できる。 According to this configuration, the control circuit performs the first initial process as a first type device (a first class device such as a printer class as an example) when the power is on. On the other hand, if the power is off, the first initial processing is performed as a second type device (for example, a second class device such as a human interface device (HID) class) different from the first type. Therefore, the external device recognizes the electronic device that is the connection partner as the first type device when the power is on, and treats the electronic device as the first type device. On the other hand, if the external device is in the power-off state, the electronic device that is the connection partner is recognized as the second type device and is handled as the second type device. Therefore, it is possible to avoid inconvenience due to misidentification that the connection partner in the power-on state is handled as the second type device or the connection partner in the power-off state is handled as the first type device.
上記電子機器では、前記制御回路は、電源がオン状態であって第1初期処理に失敗したときに、第1初期処理よりも小さい電力の要求を含む第2初期処理を行い、第2初期処理が完了して外部装置との接続が継続している状態で外部装置と再接続を行う場合には、電源がオン状態であれば、第1初期処理を行わずに第2初期処理を行うことが好ましい。 In the electronic device, when the power supply is on and the first initial process fails, the control circuit performs a second initial process including a request for power smaller than the first initial process, and the second initial process. When reconnecting to an external device while the connection is completed and the external device is still connected, if the power is on, the second initial processing is performed without performing the first initial processing. Is preferred.
この構成によれば、制御回路は、電源がオン状態であって第1初期処理に失敗したときに、第1初期処理よりも小さい電力の要求を含む第2初期処理を行う。第2初期処理が完了して外部装置との接続が継続している状態で外部装置と再接続を行う場合には、電源がオン状態であれば、第1初期処理を行わずに第2初期処理を行う。よって、制御回路が一度失敗している第1初期処理を同じ接続相手の外部装置に行うことによる制御回路の電力の浪費を抑制できるうえ、第1初期処理を省く分だけ再接続後に早期に処理を開始させることができる。 According to this configuration, when the power is on and the first initial process fails, the control circuit performs the second initial process including a request for power smaller than that of the first initial process. When reconnecting to an external device in a state where the second initial processing is completed and the connection to the external device is continued, if the power is on, the second initial processing is not performed and the first initial processing is not performed. Process. Therefore, it is possible to suppress the waste of power of the control circuit by performing the first initial process in which the control circuit has failed once on the external device of the same connection partner, and to process early after the reconnection as much as the first initial process is omitted. Can be started.
上記電子機器では、前記制御回路は、前記第1初期処理においてタイムアウトが発生した場合に、前記第1初期処理に失敗したと判断することが好ましい。
この構成によれば、制御回路は、外部装置との第1初期処理においてタイムアウトが発生した場合に、第1初期処理に失敗したと判断する。タイムアウトを考慮することなく第1初期処理の完了まで待機する構成に比べ、早期に第2初期処理を行うことができるので、外部装置と電子機器との通信を早期に確立することができる。
In the electronic device, it is preferable that the control circuit determines that the first initial process has failed when a timeout occurs in the first initial process.
According to this configuration, the control circuit determines that the first initial process has failed when a timeout occurs in the first initial process with the external device. Compared to a configuration that waits until the completion of the first initial processing without considering timeout, the second initial processing can be performed earlier, so that communication between the external device and the electronic device can be established earlier.
上記電子機器では、前記制御回路は、定期的に外部装置から送られてくるはずの信号が送られてこなくなったことで、第1初期処理に失敗したと判断することが好ましい。
この構成によれば、制御回路は、外部から定期的に送られてくるはずの信号が送られてこなくなったことで、第1初期処理に失敗したと判断する。よって、第1初期処理に失敗したと判断した時点で、第2初期処理を早期に開始できる。例えばタイムアウトの発生を第1初期処理の失敗と判断する場合に比べ、第1初期処理の失敗時点で比較的早期に制御回路に第2初期処理を開始させることができる。このため、制御回路と外部装置との通信を比較的早期に確立することができる。
In the electronic apparatus, it is preferable that the control circuit determines that the first initial process has failed because a signal that should be periodically transmitted from the external device is not transmitted.
According to this configuration, the control circuit determines that the first initial processing has failed because a signal that should be periodically sent from the outside is not sent. Therefore, when it is determined that the first initial process has failed, the second initial process can be started early. For example, it is possible to cause the control circuit to start the second initial process relatively early at the time of the failure of the first initial process as compared with the case where the occurrence of the timeout is determined to be the failure of the first initial process. For this reason, communication between the control circuit and the external device can be established relatively early.
上記電子機器では、前記制御回路は、前記タイムアウトと判定する際に用いるタイムアウト時間を、電源がオフ状態のときの値よりもオン状態のときの値の方が短くなるように設定することが好ましい。 In the electronic device, it is preferable that the control circuit sets the timeout time used when determining the timeout as a value when the power source is in the on state is shorter than a value when the power source is in the off state. .
この構成によれば、タイムアウト時間が、電源がオフ状態のときの値よりもオン状態のときの値の方が短くなるように設定される。よって、電源オフ状態では外部装置から電力供給を受ける頻度を高めることができ、電源オン状態ではユーザーが外部装置から指示した処理の開始遅れを短く抑えることができる。 According to this configuration, the time-out time is set so that the value when the power is off is shorter than the value when the power is off. Therefore, the frequency of receiving power supply from the external device can be increased in the power-off state, and the start delay of processing instructed by the user from the external device can be suppressed short in the power-on state.
上記電子機器では、前記制御回路は、電源がオフ状態のときに前記タイムアウトと判定する際に用いるタイムアウト時間を、前記外部装置の起動所要時間に応じて設定することが好ましい。 In the electronic device, it is preferable that the control circuit sets a time-out time used when determining the time-out when the power is off according to the time required for starting the external device.
この構成によれば、制御回路は、タイムアウトと判定する際に用いるタイムアウト時間を、外部装置の起動所要時間に応じて設定する。よって、通信回路が接続している相手が外部装置であるときに、その外部装置が起動途中の状態にあっても、その後起動した外部装置と第1初期処理を行って外部装置から供給電力を受けることができる。 According to this configuration, the control circuit sets the timeout time used when determining the timeout according to the required startup time of the external device. Therefore, when the other party to which the communication circuit is connected is an external device, even if the external device is in the middle of starting, the first initial processing is performed with the started external device to supply power from the external device. Can receive.
上記電子機器では、データの入力のために操作される操作部を備え、前記制御回路が前記タイムアウトの発生を判定する際に用いるタイムアウト時間は、前記操作部の操作に基づいて設定されることが好ましい。 The electronic device includes an operation unit operated for data input, and a timeout time used when the control circuit determines occurrence of the timeout may be set based on an operation of the operation unit. preferable.
この構成によれば、制御回路がタイムアウトの発生を判定する際に用いるタイムアウト時間は、操作部の操作に基づいて設定される。よって、ユーザーの使用環境(使用される第2種の装置の起動所要時間等)に合った適切なタイムアウト時間を設定できる。このため、外部装置の起動所要時間に合っていない短過ぎるタイムアウト時間が設定されているために、外部装置の起動途中でタイムアウトと判定されてしまい、外部装置から電力供給を受けることができたにも拘らず外部装置から電力供給を受けることができない不都合を減らすことができる。したがって、外部装置から電力供給を受ける頻度を高めることができる。 According to this configuration, the timeout time used when the control circuit determines occurrence of timeout is set based on the operation of the operation unit. Therefore, it is possible to set an appropriate time-out period suitable for the user's usage environment (the time required for starting the second type device used). For this reason, a timeout time that is too short that does not match the startup time of the external device is set, so it was determined that a timeout occurred during startup of the external device, and power could be received from the external device. Regardless, it is possible to reduce the inconvenience of being unable to receive power supply from an external device. Therefore, the frequency of receiving power supply from an external device can be increased.
上記電子機器では、前記制御回路は、前記通信回路を介して接続された前記外部装置から前記起動所要時間を取得し、前記タイムアウトの発生を判定する際に用いるタイムアウト時間を前記起動所要時間に応じた値に設定することが好ましい。 In the electronic device, the control circuit acquires the required startup time from the external device connected via the communication circuit, and sets a timeout time used when determining the occurrence of the timeout according to the required startup time. It is preferable to set the value to
この構成によれば、制御回路は、外部装置に接続されたときは、外部装置の起動所要時間を取得し、その起動所要時間に応じたタイムアウト時間を設定する。よって、ユーザーの使用環境(使用される外部装置の起動所要時間等)に合った適切なタイムアウト時間を設定することができる。このため、外部装置の起動所要時間に合っていない短過ぎるタイムアウト時間が使用されたことが原因で、外部装置の起動途中でタイムアウトとなり、少し待てば外部装置から電力供給を受けることができたにも拘らず少し早く失敗としたために充電されない不都合を減らすことができる。したがって、電子機器が外部装置から電力供給を受ける頻度を高めることができる。 According to this configuration, when connected to an external device, the control circuit acquires the required startup time of the external device and sets a timeout time corresponding to the required startup time. Therefore, it is possible to set an appropriate time-out time that matches the user's usage environment (time required for starting up the external device to be used, etc.). Therefore, due to the use of a too short timeout time that does not match the required startup time of the external device, a timeout occurred during the startup of the external device. Nevertheless, it is possible to reduce the inconvenience of not being charged because the failure was made a little earlier. Therefore, it is possible to increase the frequency at which the electronic device receives power supply from the external device.
上記電子機器では、前記制御回路は、電池の残量又は残量の変化を示す値を計測し、前記電池の残量又は残量の変化を示す値が閾値を超えると、初期処理に失敗したと判断することが好ましい。 In the electronic device, the control circuit measures a value indicating the remaining amount of the battery or a change in the remaining amount, and if the value indicating the remaining amount of the battery or the change in the remaining amount exceeds a threshold value, the initial process fails. It is preferable to judge that.
この構成によれば、制御回路は、電池の残量又は残量の変化を示す値が閾値を超えたことをもって第1初期処理の失敗を判断するので、タイマー等の計時手段を用いなくても、あるいは外部装置から送られてくるはずの信号を監視しなくても、初期処理の失敗を判断することができる。 According to this configuration, the control circuit determines the failure of the first initial processing when the value indicating the remaining amount of the battery or the change in the remaining amount exceeds the threshold value, so that it is not necessary to use a timer such as a timer. Alternatively, the failure of the initial process can be determined without monitoring the signal that should be sent from the external device.
上記電子機器では、外部装置から供給を受けた電力で電池に充電を行う。この構成によれば、電子機器は、外部装置から供給を受けた電力で電池に充電を行うことができる。 In the electronic device, the battery is charged with power supplied from an external device. According to this configuration, the electronic device can charge the battery with the power supplied from the external device.
以下、印刷システムの一実施形態について、図面を参照して説明する。
図1に示すように、電子機器の一例としてのプリンター11(印刷装置)は、USB(Universal Serial Bus)規格上のUSBデバイス11A(図4参照)として機能する。図1に示すプリンター11は、USBホスト30Aとして機能するホスト装置30と通信ケーブルの一例であるUSBケーブル35を通じて通信可能に接続するためにそのコネクター35A(端子)が挿抜可能に接続されるUSBコネクター12を備えている。USBコネクター12は、電源供給路としての電源線(P,G)と、データを送受信するためのデータ線(D+,D−)とを備えている。USBケーブル35のコネクター35AがUSBコネクター12に接続された場合、データ線及び電源線のそれぞれ同じ極同士が接続され、ホスト装置30とデータの送受信及びホスト装置30からの電源供給が可能になる。USBコネクター12は、電源線とデータ線と各種の素子(例えば抵抗)等とを含む通信用の電気回路を有している。この点において、本実施形態では、USBコネクター12により、通信回路の一例が構成される。
Hereinafter, an embodiment of a printing system will be described with reference to the drawings.
As shown in FIG. 1, a printer 11 (printing apparatus) as an example of an electronic device functions as a USB device 11A (see FIG. 4) based on the USB (Universal Serial Bus) standard. The printer 11 shown in FIG. 1 has a USB connector to which a connector 35A (terminal) is detachably connected in order to be communicably connected to a host device 30 functioning as a USB host 30A through a USB cable 35 which is an example of a communication cable. 12 is provided. The USB connector 12 includes power supply lines (P, G) as power supply paths and data lines (D +, D−) for transmitting and receiving data. When the connector 35 </ b> A of the USB cable 35 is connected to the USB connector 12, the same poles of the data line and the power line are connected to each other, so that data transmission / reception with the host device 30 and power supply from the host device 30 are possible. The USB connector 12 has an electric circuit for communication including a power line, a data line, various elements (for example, resistors), and the like. In this regard, in this embodiment, the USB connector 12 constitutes an example of a communication circuit.
ホスト装置30は、例えばパーソナルコンピューター(PC)により構成されるが、USBホスト30Aとして機能する限りにおいて、携帯情報端末(PDA(Personal Digital Assistants))、タブレットPC等のコンピューター類であってもよい。さらにホスト装置30は、USBホスト機能を有するプリンターであってもよい。ホスト装置30は、図1に示すUSBホスト30A及びCPU30Bを備えている。USBホスト30Aのソフトウェア部分の少なくとも一部は例えばCPU30BがUSB用プログラムを実行することで構築される。なお、本実施形態では、USB規格として例えばUSB2.0を用いている。 The host device 30 is configured by, for example, a personal computer (PC), but may be a computer such as a personal digital assistant (PDA (Personal Digital Assistants)) or a tablet PC as long as it functions as the USB host 30A. Further, the host device 30 may be a printer having a USB host function. The host device 30 includes a USB host 30A and a CPU 30B shown in FIG. At least a part of the software portion of the USB host 30A is constructed, for example, by the CPU 30B executing a USB program. In this embodiment, for example, USB 2.0 is used as the USB standard.
図1に示すように、プリンター11は、USBコネクター12と電源供給路12Aとデータ線12Bで接続された制御回路13を備えている。また、プリンター11は、制御回路13により充電制御される充電式の電池の一例としての二次電池14と、制御回路13からの指示を受け付ける駆動回路15と、制御回路13の指示によって駆動回路15を介して制御される印刷機構16とを備えている。 As shown in FIG. 1, the printer 11 includes a control circuit 13 connected by a USB connector 12, a power supply path 12A, and a data line 12B. The printer 11 includes a secondary battery 14 as an example of a rechargeable battery whose charge is controlled by the control circuit 13, a drive circuit 15 that receives an instruction from the control circuit 13, and a drive circuit 15 according to an instruction from the control circuit 13. And a printing mechanism 16 controlled via the printer.
図1に示すように、USBコネクター12には、充電用のUSBバッテリーチャージャー40(電源アダプター)のコネクター40A(端子)が挿抜可能に接続される。また、プリンター11は、USBコネクター12に加え、補助的に電源供給するための外部電源コネクター17を備えている。外部電源コネクター17は、制御回路13と電源供給路17A及びデータ線17Bを通じて接続されている。外部電源コネクター17には、ACアダプター50(電源アダプター)のコネクター50A(端子)が挿抜可能に接続される。ACアダプター50のコネクター50Aは、他の一般的なACアダプターのコネクターの形状と同様の円筒形状を有している。なお、本実施形態では、ホスト装置30及びUSBバッテリーチャージャー40により、外部装置の一例が構成される。特にホスト装置30により、後述する初期処理を行う外部装置の一例が構成される。また、USBバッテリーチャージャー40により第1の装置の一例が構成され、ホスト装置30により第2の装置の一例が構成される。 As shown in FIG. 1, a connector 40A (terminal) of a charging USB battery charger 40 (power adapter) is detachably connected to the USB connector 12. In addition to the USB connector 12, the printer 11 includes an external power connector 17 for supplying power supplementarily. The external power connector 17 is connected to the control circuit 13 through a power supply path 17A and a data line 17B. A connector 50A (terminal) of an AC adapter 50 (power adapter) is detachably connected to the external power connector 17. The connector 50A of the AC adapter 50 has a cylindrical shape similar to the shape of other general AC adapter connectors. In the present embodiment, the host device 30 and the USB battery charger 40 constitute an example of an external device. In particular, the host device 30 constitutes an example of an external device that performs initial processing described later. The USB battery charger 40 constitutes an example of a first device, and the host device 30 constitutes an example of a second device.
また、図1に示すように、プリンター11の本体11aには、操作パネル19が設けられている。操作パネル19は、プリンター11に各種の指示等を入力するために操作される操作スイッチ群20と、各種メニューや動作状況のメッセージ等が表示される表示部21とを備えている。操作スイッチ群20は制御回路13と電気的に接続されている。また、表示部21は制御回路13に対して表示駆動回路18を介して電気的に接続されている。 As shown in FIG. 1, an operation panel 19 is provided on the main body 11 a of the printer 11. The operation panel 19 includes an operation switch group 20 that is operated to input various instructions and the like to the printer 11 and a display unit 21 that displays various menus, messages of operation statuses, and the like. The operation switch group 20 is electrically connected to the control circuit 13. The display unit 21 is electrically connected to the control circuit 13 via the display drive circuit 18.
操作スイッチ群20は、電源スイッチ20Aと、各種の指示入力や選択操作等によってデータの入力のために操作される操作スイッチ20Bとを備えている。電源スイッチ20Aが操作されることで、プリンター11の電源のオンとオフが切り替えられる。つまり、プリンター11は、電源オフ状態の下で電源スイッチ20Aが操作されると電源オン状態に切り替わり、電源オン状態の下で電源スイッチ20Aが操作されると電源オフ状態に切り替わる。また、例えば表示部21に表示されるメニューにおいてユーザーが操作スイッチ20Bを操作して各種の項目を選択することで、制御回路13はその選択結果を受け付けて印刷条件等を設定する。 The operation switch group 20 includes a power switch 20A and an operation switch 20B operated for inputting data by various instruction inputs, selection operations, and the like. By operating the power switch 20A, the printer 11 is turned on and off. That is, the printer 11 switches to the power-on state when the power switch 20A is operated under the power-off state, and switches to the power-off state when the power switch 20A is operated under the power-on state. Further, for example, when the user selects various items by operating the operation switch 20B in the menu displayed on the display unit 21, the control circuit 13 accepts the selection result and sets the printing conditions and the like.
制御回路13は、プリンター11の電源オフ中に、USBコネクター12が接続している相手がホスト装置30又はUSBバッテリーチャージャー40である場合、充電モードになり、ホスト装置30又はUSBバッテリーチャージャー40からUSBコネクター12を通じて供給される電力で二次電池14を充電する充電制御を司る。但し、制御回路13は、プリンター11の電源オフ中に外部電源コネクター17にACアダプター50が接続されている場合は、ACアダプター50からの供給電力による二次電池14の充電を優先し、ホスト装置30又はUSBバッテリーチャージャー40からの供給電力に基づく充電は行わない。 The control circuit 13 enters the charging mode when the partner to which the USB connector 12 is connected is the host device 30 or the USB battery charger 40 while the printer 11 is turned off. It controls charge control for charging the secondary battery 14 with power supplied through the connector 12. However, if the AC adapter 50 is connected to the external power connector 17 while the printer 11 is powered off, the control circuit 13 gives priority to charging the secondary battery 14 with the power supplied from the AC adapter 50, and the host device 30 or charging based on the power supplied from the USB battery charger 40 is not performed.
また、制御回路13は、プリンター11の電源オン中に、ホスト装置30から受信した印刷ジョブデータに基づく文書や画像を用紙等の印刷媒体に印刷する印刷制御を司る。プリンター11の電源オン中に、外部電源コネクター17にACアダプター50が接続されている場合は、ACアダプター50から供給される電力によりプリンター11は動作する。さらに制御回路13は、外部電源コネクター17にACアダプター50が接続されていないプリンター11の電源オン状態においては、USBコネクター12が接続している相手がホスト装置30であれば、ホスト装置30から供給される電力によりプリンター11は動作する。また、この電源オン状態において、USBコネクター12が接続している相手がUSBバッテリーチャージャー40であれば、USBバッテリーチャージャー40から供給される電力によりプリンター11は動作する。本実施形態では、この電源オン状態において、ホスト装置30又はUSBバッテリーチャージャー40から供給される電力のうちプリンター11の動作に使用されない余った電力を二次電池14の充電に使用する。もちろん、プリンター11を電源オン状態で非充電モードとし、外部装置からの供給電力は、プリンター11の動作に使用し、二次電池14の充電には使用しない構成としてもよい。 The control circuit 13 also controls print control for printing a document or image based on print job data received from the host device 30 on a print medium such as paper while the printer 11 is powered on. When the AC adapter 50 is connected to the external power connector 17 while the printer 11 is powered on, the printer 11 is operated by the power supplied from the AC adapter 50. Further, the control circuit 13 supplies power from the host device 30 when the partner to which the USB connector 12 is connected is the host device 30 in the power-on state of the printer 11 in which the AC adapter 50 is not connected to the external power connector 17. The printer 11 is operated by the generated power. Further, in this power-on state, if the other party to which the USB connector 12 is connected is the USB battery charger 40, the printer 11 operates with the power supplied from the USB battery charger 40. In the present embodiment, in this power-on state, surplus power that is not used for the operation of the printer 11 out of the power supplied from the host device 30 or the USB battery charger 40 is used for charging the secondary battery 14. Of course, the printer 11 may be in a non-charging mode with the power on, and power supplied from an external device may be used for the operation of the printer 11 and not used for charging the secondary battery 14.
本実施形態の印刷機構16は、用紙等の印刷媒体にインクで印刷する不図示の印刷ヘッドと、印刷媒体を搬送する不図示の搬送装置とを備える。印刷ヘッドは、印刷媒体の搬送方向と交差する走査方向に印刷ヘッドを往復移動させつつ印刷するシリアル方式でもよいし、搬送方向と交差する幅方向の印刷幅を一度で印刷可能な長尺状の印刷ヘッド又はヘッド群により、一定速度で搬送される印刷媒体に印刷するラインヘッド方式でもよい。また、印刷ヘッドの方式は、インクジェット方式、ドットインパクト方式及び電子写真式のいずれであってもよい。また、インクジェット方式の場合、インクを噴射する圧力を発生させる駆動素子には、ノズルに連通する室を形成する板部を撓ませて圧力を発生させる圧電素子や静電素子、あるいは熱等を利用して瞬間的に気泡を発生させるバブル素子を使用することができる。また、プリンター11は印刷に用いる印刷ジョブデータをホスト装置30から有線又は無線による通信で受信できるうえ、メモリーカード等の記憶媒体から印刷に用いるデータを読み取るものでもよい。 The printing mechanism 16 of the present embodiment includes a print head (not shown) that prints ink on a print medium such as paper, and a transport device (not shown) that transports the print medium. The print head may be a serial type that performs printing while reciprocating the print head in a scanning direction that intersects the conveyance direction of the print medium, or a long print that can print the print width in the width direction that intersects the conveyance direction at a time. A line head system that prints on a print medium conveyed at a constant speed by a print head or a head group may be used. Further, the print head method may be any of an ink jet method, a dot impact method, and an electrophotographic method. In addition, in the case of an ink jet system, a piezoelectric element or an electrostatic element that generates pressure by bending a plate portion that forms a chamber communicating with a nozzle, or heat is used as a driving element that generates pressure for ejecting ink. Thus, a bubble element that instantaneously generates bubbles can be used. The printer 11 may receive print job data used for printing from the host device 30 by wired or wireless communication, and may read data used for printing from a storage medium such as a memory card.
図1に示すように、制御回路13は、制御IC22、電源回路23、CPU24及び不揮発性メモリー25を備えている。制御IC22は、充電制御を行う集積回路である。ここで、制御回路13内にCPU24に加え、ASIC(Application Specific IC(特定用途向けIC))を備え、印刷機構16のうち一部(例えば印刷ヘッド)の制御をASICが行ってもよい。また、不揮発性メモリー25には、プリンター11の制御に必要な各種のプログラム及びプリンター11の電源オフ中にも保存の必要がある各種の設定データ等が記憶されている。なお、プリンター11は、CPU24が実行する際のプログラムや必要な各種データ等が一時的に格納されるRAM(図示せず)も備えている。 As shown in FIG. 1, the control circuit 13 includes a control IC 22, a power supply circuit 23, a CPU 24, and a nonvolatile memory 25. The control IC 22 is an integrated circuit that performs charge control. Here, in addition to the CPU 24 in the control circuit 13, an ASIC (Application Specific IC) may be provided, and the ASIC may control a part (for example, the print head) of the printing mechanism 16. The nonvolatile memory 25 stores various programs necessary for controlling the printer 11 and various setting data that need to be saved even when the printer 11 is turned off. The printer 11 also includes a RAM (not shown) that temporarily stores programs executed by the CPU 24 and various necessary data.
USBコネクター12の電源供給路12A及びデータ線12Bは、制御回路13内の制御IC22に接続されている。また、外部電源コネクター17の電源供給路17A及びデータ線17Bは、制御IC22に接続されている。制御IC22は、各コネクター12,17への外部装置の接続を検出する接続検出機能、その検出された接続相手(外部装置)を判別する判別機能を有する。さらに制御IC22は、充電モードにおいて二次電池14に充電する充電制御を行うとともに、CPU24及び駆動回路15等に電源電力を供給する電源供給路12A,17Aの管理、及びCPU24等にデータを送信するデータ線12B,17Bの管理を行う。 The power supply path 12 </ b> A and the data line 12 </ b> B of the USB connector 12 are connected to the control IC 22 in the control circuit 13. The power supply path 17A and the data line 17B of the external power connector 17 are connected to the control IC 22. The control IC 22 has a connection detection function for detecting connection of an external device to each of the connectors 12 and 17 and a discrimination function for discriminating the detected connection partner (external device). Further, the control IC 22 performs charge control for charging the secondary battery 14 in the charge mode, manages the power supply paths 12A and 17A for supplying power to the CPU 24 and the drive circuit 15, and transmits data to the CPU 24 and the like. The data lines 12B and 17B are managed.
制御IC22は、ホスト装置30からのUSBケーブル35のコネクター35A又はUSBバッテリーチャージャー40のコネクター40A等のいずれかがUSBコネクター12に接続されると、USB接続を検出する。制御IC22は、USB接続を検出すると、例えばデータ線12B(D+,D−)について、(D+)≠(D−)(異電位)である場合に、USBコネクター12がコンピューター類であるホスト装置30に接続されていると判断する。一方、(D+)=(D−)(同電位)である場合に、制御IC22は、USBコネクター12がUSBバッテリーチャージャー40に接続されていると判断する。つまり、制御IC22は、USBコネクター12に接続されている接続相手(接続先)が、ホスト装置30であるか、USBバッテリーチャージャー40であるかを判定可能である。この点において、本実施形態では、制御IC22により、接続相手を判定する判定回路の一例が構成される。なお、制御IC22は、他の判定手法により接続相手を判定してもよい。 The control IC 22 detects the USB connection when either the connector 35A of the USB cable 35 from the host device 30 or the connector 40A of the USB battery charger 40 is connected to the USB connector 12. When the control IC 22 detects the USB connection, for example, when the data line 12B (D +, D−) is (D +) ≠ (D−) (different potential), the host device 30 in which the USB connector 12 is a computer. Is determined to be connected. On the other hand, when (D +) = (D−) (the same potential), the control IC 22 determines that the USB connector 12 is connected to the USB battery charger 40. That is, the control IC 22 can determine whether the connection partner (connection destination) connected to the USB connector 12 is the host device 30 or the USB battery charger 40. In this regard, in the present embodiment, the control IC 22 constitutes an example of a determination circuit that determines a connection partner. The control IC 22 may determine the connection partner using another determination method.
電源供給路12Aにおける制御IC22とCPU24との間の部分には、電源回路23が直列に介在されている。電源回路23は、入力した直流電圧を必要に応じて変圧して制御IC22及びCPU24に必要な駆動電圧(例えば3〜6Vの範囲内の所定電圧)、印刷機構16中の印刷ヘッドの駆動に必要な駆動電圧、印刷媒体を搬送する搬送装置の動力源となる搬送モーターの駆動に必要な駆動電圧等を生成する。二次電池14は、電源供給路12Aのうち制御IC22と電源回路23とを接続する部分に第1スイッチ26を介して接続されている。この第1スイッチ26は制御IC22によりオン・オフ制御される。第1スイッチ26がオンになって導通しているときに電源供給路12Aからの電源電力によって二次電池14が充電される。 A power supply circuit 23 is interposed in series between the control IC 22 and the CPU 24 in the power supply path 12A. The power supply circuit 23 transforms the input DC voltage as necessary to drive the drive voltage necessary for the control IC 22 and the CPU 24 (for example, a predetermined voltage within a range of 3 to 6 V), and is necessary for driving the print head in the printing mechanism 16. Generating a driving voltage necessary for driving a transport motor serving as a power source for a transport device that transports a print medium. The secondary battery 14 is connected to a portion of the power supply path 12 </ b> A that connects the control IC 22 and the power circuit 23 via the first switch 26. The first switch 26 is on / off controlled by the control IC 22. When the first switch 26 is on and conducting, the secondary battery 14 is charged by the power supplied from the power supply path 12A.
また、電源供給路12Aのうち電源回路23とCPU24との間の部分には、プッシュ式の第2スイッチ27と、半導体スイッチで構成される第3スイッチ28とが互いに並列な状態で介在している。プッシュ式の第2スイッチ27は、電源スイッチ20Aの操作に連動して機械的に押下され、電源スイッチ20Aの操作中のみオンし、電源スイッチ20Aの操作が止められるとオフする。また、電源回路23と駆動回路15とを接続する電源供給路12C上には第4スイッチ29が介在している。 Further, a push-type second switch 27 and a third switch 28 composed of a semiconductor switch are interposed in parallel with each other between the power supply circuit 12A and the CPU 24 in the power supply path 12A. Yes. The push-type second switch 27 is mechanically pressed in conjunction with the operation of the power switch 20A, is turned on only during the operation of the power switch 20A, and is turned off when the operation of the power switch 20A is stopped. A fourth switch 29 is interposed on the power supply path 12 </ b> C connecting the power supply circuit 23 and the drive circuit 15.
制御IC22は、その判断結果に基づいて第3スイッチ28のオン(導通)とオフ(非導通)の切替え、データ線12B上の不図示のスイッチのオン(導通)とオフ(非導通)の切替え、第1スイッチ26のオン(導通)とオフ(非導通)の切替えを制御している。 The control IC 22 switches the third switch 28 on (conductive) and off (non-conductive) based on the determination result, and switches on (conductive) and off (non-conductive) a switch (not shown) on the data line 12B. The first switch 26 is controlled to be switched on (conducting) and off (non-conducting).
プリンター11の起動のトリガーとするのは、プッシュ式の第2スイッチ27であり、プリンター11の電源オフ状態の下でユーザーにより電源スイッチ20Aが押下されて第2スイッチ27がオンされると、制御IC22は第3スイッチ28をオン状態に維持する。詳しくは、プッシュ式の第2スイッチ27がオンした際のオン信号がCPU24に入力されると、CPU24は、制御IC22に対してプリンター11の電源のオン/オフの切替えを指示する。制御IC22は、プリンター11の電源オフ状態の下でCPU24から電源の切替え指示を受け付けると、第3スイッチ28及び第4スイッチ29をオンさせ、一方、プリンター11の電源オン状態の下でCPU24から電源の切替え指示を受け付けると、第3スイッチ28及び第4スイッチ29をオフさせる。 The trigger for starting the printer 11 is the push-type second switch 27. When the user presses the power switch 20A and the second switch 27 is turned on under the power-off state of the printer 11, the control is performed. The IC 22 maintains the third switch 28 in the on state. Specifically, when an ON signal when the push-type second switch 27 is turned on is input to the CPU 24, the CPU 24 instructs the control IC 22 to turn on / off the printer 11. When the control IC 22 receives a power supply switching instruction from the CPU 24 under the power-off state of the printer 11, the control IC 22 turns on the third switch 28 and the fourth switch 29, while the power is supplied from the CPU 24 under the power-on state of the printer 11. When the switching instruction is received, the third switch 28 and the fourth switch 29 are turned off.
第3スイッチ28がオンされることで電源回路23からCPU24へ必要な電力が供給され、第3スイッチ28がオフされることで電源回路23からCPU24への電力の供給が遮断される。また、第4スイッチ29がオンされることで電源回路23から駆動回路15へ必要な電力が供給され、第4スイッチ29がオフされることで電源回路23から駆動回路15への電力供給が遮断される。なお、第4スイッチ29は、駆動回路15へ供給するべき電圧別に設けられた複数のスイッチからなるスイッチ群により構成されてもよい。 When the third switch 28 is turned on, necessary power is supplied from the power supply circuit 23 to the CPU 24, and when the third switch 28 is turned off, supply of power from the power supply circuit 23 to the CPU 24 is interrupted. Further, when the fourth switch 29 is turned on, necessary power is supplied from the power supply circuit 23 to the drive circuit 15, and when the fourth switch 29 is turned off, power supply from the power supply circuit 23 to the drive circuit 15 is cut off. Is done. The fourth switch 29 may be configured by a switch group including a plurality of switches provided for each voltage to be supplied to the drive circuit 15.
プリンター11の電源オフ状態では、第3スイッチ28及び第4スイッチ29が共にオフ状態にある。また、この電源オフ状態において外部電源コネクター17にACアダプター50が接続されておらず、USBコネクター12にホスト装置30とUSBバッテリーチャージャー40のどちらも接続されていなければ、第1スイッチ26はオフ状態にある。 In the power-off state of the printer 11, both the third switch 28 and the fourth switch 29 are in the off state. Further, in this power-off state, if the AC adapter 50 is not connected to the external power connector 17 and neither the host device 30 nor the USB battery charger 40 is connected to the USB connector 12, the first switch 26 is in the off state. It is in.
制御IC22は、プリンター11の電源オフ状態であって、かつACアダプター50が接続されていない状態において、USBコネクター12へのUSB接続を検出したときにその接続先がホスト装置30(USBホスト30A)であり、そのとき二次電池14の充電が必要であれば、それまでオフ状態にあった第3スイッチ28をオンさせる。制御IC22は、第3スイッチ28のオンによって、二次電池14の充電に先立ちホスト装置30との間でエニュメレーションと呼ばれる初期処理を実行させるためにCPU24を起動させる。このとき、制御IC22は、内部のスイッチをオンさせてCPU24を、データ線12Bを通じたデータの送受信が可能な状態にする。 When the control IC 22 detects the USB connection to the USB connector 12 in a state where the printer 11 is powered off and the AC adapter 50 is not connected, the connection destination is the host device 30 (USB host 30A). If the secondary battery 14 needs to be charged at that time, the third switch 28 that has been in the off state is turned on. When the third switch 28 is turned on, the control IC 22 activates the CPU 24 in order to execute an initial process called enumeration with the host device 30 prior to charging of the secondary battery 14. At this time, the control IC 22 turns on an internal switch so that the CPU 24 can transmit and receive data through the data line 12B.
USBコネクター12がホスト装置30と接続した場合、ホスト装置30から第1電力(例えば保証電流値100mA)が供給される。また、CPU24は初期処理を行うことによって、USBコネクター12が受け取る第1電力以上の電力を消費する。このため、CPU24がホスト装置30から初期処理完了通知を受信することなく初期処理の途中で待機状態のまま放置された場合、その待機時間のうちにCPU24の起動中の消費電力により二次電池14の残量が低減してしまう。ここで、保証電力とは、USB規格上、USBホストがUSB接続されたUSBデバイスに供給しなければならない電力であり、USB規格では電流値で例えば100mAに定められている。 When the USB connector 12 is connected to the host device 30, first power (for example, a guaranteed current value of 100 mA) is supplied from the host device 30. In addition, the CPU 24 consumes power equal to or higher than the first power received by the USB connector 12 by performing the initial processing. For this reason, when the CPU 24 is left in a standby state in the middle of the initial process without receiving an initial process completion notification from the host device 30, the secondary battery 14 is caused by the power consumption during the startup of the CPU 24 during the standby time. The remaining amount of will be reduced. Here, the guaranteed power is the power that the USB host must supply to the USB device connected by USB according to the USB standard. In the USB standard, the current value is set to, for example, 100 mA.
なお、本実施形態では、プリンター11が電源オフ中にホスト装置30とUSB接続されたときに、二次電池14の充電に必要な初期処理を行わせるためのCPU24の起動を、「充電起動」と呼ぶ。また、制御IC22が第3スイッチ28をオンさせてCPU24を起動させることを「充電起動オン」、第3スイッチ28をオフさせて充電起動中のCPU24を電源オフさせることを「充電起動オフ」と呼ぶ場合がある。 In the present embodiment, when the printer 11 is connected to the host device 30 via the USB while the power is off, the CPU 24 is activated to perform initial processing necessary for charging the secondary battery 14. Call it. Further, “charging activation on” means that the control IC 22 turns on the third switch 28 to activate the CPU 24, and “charging activation off” means that the CPU 24 during the activation of charging is turned off by turning off the third switch 28. Sometimes called.
また、制御IC22は、プリンター11が電源オン状態の下でACアダプター50又はUSBバッテリーチャージャー40等の電源アダプターに接続されているときは、各スイッチ26,28,29をオン状態とすることにより電源アダプターから供給される電力でCPU24及び駆動回路15を動作させる。このとき、電源アダプターからの供給電力のうちプリンター11の動作に使用されない余った電力があれば、この電力で二次電池14を充電する。一方、制御IC22は、プリンター11が電源オフ状態の下でACアダプター50又はUSBバッテリーチャージャー40に接続されているときは、第1スイッチ26をオン状態、各スイッチ28,29をオフ状態とすることにより電源アダプターから供給される電力で二次電池14を充電する。 Further, when the printer 11 is connected to a power adapter such as the AC adapter 50 or the USB battery charger 40 under the power-on state, the control IC 22 turns on the power by turning on the switches 26, 28, and 29. The CPU 24 and the drive circuit 15 are operated with power supplied from the adapter. At this time, if there is surplus power that is not used for the operation of the printer 11 among the power supplied from the power adapter, the secondary battery 14 is charged with this power. On the other hand, when the printer 11 is connected to the AC adapter 50 or the USB battery charger 40 with the power off, the control IC 22 turns on the first switch 26 and turns off the switches 28 and 29. The secondary battery 14 is charged with the electric power supplied from the power adapter.
制御IC22は、ACアダプター50又はUSBバッテリーチャージャー40からの電力で二次電池14を充電する際は、初期処理を行う必要がないので、CPU24は起動されない。なお、USBバッテリーチャージャー40及びACアダプター50は、AC電源のコンセントに繋がっているものに限らず、DCバッテリーに繋がっているものも含む。 When the control IC 22 charges the secondary battery 14 with the power from the AC adapter 50 or the USB battery charger 40, it is not necessary to perform an initial process, so the CPU 24 is not activated. The USB battery charger 40 and the AC adapter 50 are not limited to those connected to an AC power outlet, but also include those connected to a DC battery.
CPU24に接続されている不揮発性メモリー25には、ホスト装置30と電源供給能力のネゴシエーションを含むエニュメレーションと呼ばれる初期処理を行うためのUSB通信用プログラムが記憶されている。USBコネクター12にホスト装置30の接続が検出された場合、CPU24は初期処理(エニュメレーション)をホスト装置30との間で行う。本実施形態では、CPU24が初期処理の全てを実行するが、初期処理の一部をCPU24が実行し他の一部をASIC又は制御IC22が実行する構成としてもよい。なお、本実施形態では、CPU24により、初期処理の少なくとも一部を実行する処理回路の一例が構成される。 A non-volatile memory 25 connected to the CPU 24 stores a USB communication program for initial processing called enumeration including negotiation of the power supply capability with the host device 30. When connection of the host device 30 to the USB connector 12 is detected, the CPU 24 performs initial processing (enumeration) with the host device 30. In the present embodiment, the CPU 24 executes all of the initial processing, but the CPU 24 may execute a part of the initial processing and the ASIC or the control IC 22 may execute the other part. In the present embodiment, the CPU 24 configures an example of a processing circuit that executes at least a part of the initial processing.
また、図1に示すように、CPU24はタイマー24Aを備えている。タイマー24Aは、例えばCPU24内のカウンターにより構成され、クロック信号のパルスを計数することでタイマーとして機能する。CPU24は、その起動時点からの経過時間を計時時間Tとしてタイマー24Aに計時させる。不揮発性メモリー25には、初期処理が失敗であるか否かを判定する際に用いられる設定タイムアウト時間T1(以下、単に「タイムアウト時間T1」ともいう。)が記憶されている。CPU24は、タイマー24Aの計時時間Tが、ホスト装置30から初期処理完了通知を受信することなく、タイムアウト時間T1に達してタイムアウトになると、制御IC22に指示して電源オフさせることで、初期処理を充電開始前に中止する。一方、CPU24は、タイマー24Aの計時時間Tがタイムアウト時間T1に達する前に、ホスト装置30から初期処理完了通知を受信すると、制御IC22に充電開始を指示して第1スイッチ26をオンさせることで、ホスト装置30からの電源電力で二次電池14を充電する充電処理を開始させる。なお、タイマー24Aは、プログラムにより計時処理を行うソフトウェアで構成されてもよいし、CPU24ではなく、制御IC22又はASICに設けられたものでもよい。 As shown in FIG. 1, the CPU 24 includes a timer 24A. The timer 24A is constituted by a counter in the CPU 24, for example, and functions as a timer by counting clock signal pulses. The CPU 24 causes the timer 24 </ b> A to count the elapsed time from the starting time as the time count T. The non-volatile memory 25 stores a set timeout time T1 (hereinafter, also simply referred to as “timeout time T1”) used when determining whether or not the initial process has failed. When the time T of the timer 24A reaches the timeout time T1 without receiving the initial processing completion notification from the host device 30, the CPU 24 instructs the control IC 22 to turn off the power when the time-out time T reaches the time-out time T1. Stop before charging starts. On the other hand, when the CPU 24 receives the initial processing completion notification from the host device 30 before the time T of the timer 24A reaches the timeout time T1, the CPU 24 instructs the control IC 22 to start charging and turns on the first switch 26. Then, the charging process for charging the secondary battery 14 with the power source from the host device 30 is started. Note that the timer 24 </ b> A may be configured by software that performs timing processing by a program, or may be provided in the control IC 22 or ASIC instead of the CPU 24.
ここで、タイムアウト時間T1は、使用が想定される複数種のホスト装置30のうちBIOS(Basic Input/Output System)起動所要時間が最長であるホスト装置30のBIOS起動所要時間以上、かつこのホスト装置30のBIOS起動所要時間にマージン時間を加えた時間以下の値に設定されている。ここで、マージン時間は、適宜設定できるが、一例としてBIOS起動所要時間の10%以下が好ましい。タイムアウト時間T1は、一例として30〜120秒の範囲内の所定値に設定されている。もちろん、タイムアウト時間T1は、上記の範囲に限らず、BIOS起動所要時間と関連付けて、あるいはBIOS起動所要時間と無関係に、例えば10秒や20秒などのより短い時間、あるいは3分や5分などのより長い時間とすることもできる。 Here, the timeout time T1 is equal to or longer than the BIOS startup time of the host device 30 having the longest BIOS (Basic Input / Output System) startup time among a plurality of types of host devices 30 expected to be used, and this host device. It is set to a value equal to or less than the time required for adding 30 margins to the BIOS startup time. Here, the margin time can be set as appropriate, but as an example, the margin time is preferably 10% or less of the BIOS startup time. As an example, the timeout time T1 is set to a predetermined value within a range of 30 to 120 seconds. Of course, the time-out time T1 is not limited to the above range, but is associated with the BIOS startup time or is independent of the BIOS startup time, for example, a shorter time such as 10 seconds or 20 seconds, or 3 minutes or 5 minutes. It can also be a longer time.
次に図2及び図3を参照して、プリンター11とホスト装置30との通信接続状態を確立するために初期処理として実行されるエニュメレーション及びタイマー24Aによるタイムアウト処理について説明する。なお、図2及び図3では、電源オフ状態の下でUSB接続された際の初期処理の例について説明するが、電源オン状態の下でUSB接続された際の初期処理についても基本的に同様である。但し、タイムアウト時間T1は、電源オフ時の初期処理のときよりも電源オン時の初期処理のときの方が短く設定することが好ましい。 Next, with reference to FIG. 2 and FIG. 3, enumeration executed as an initial process for establishing a communication connection state between the printer 11 and the host device 30 and a timeout process by the timer 24A will be described. 2 and 3, an example of the initial process when the USB connection is made under the power-off state will be described, but the initial process when the USB connection is made under the power-on state is basically the same. It is. However, it is preferable to set the timeout time T1 shorter in the initial process when the power is turned on than in the initial process when the power is turned off.
図2に示すように、プリンター11がホスト装置30との間でUSB接続されると、このUSB接続を検出したホスト装置30とプリンター11との間で初期処理としてエニュメレーションが実行される。 As shown in FIG. 2, when the printer 11 is USB-connected to the host device 30, enumeration is executed as an initial process between the host device 30 that has detected this USB connection and the printer 11.
図2に示すように、エニュメレーションでは、まずプリンター11は、ホスト装置30からエニュメレーション開始に当たりリセット処理(バスリセット)を指示する「USB BusReset」を受信する。次にディスクリプターと呼ばれる構成情報を要求する「GetDescriptor」を受信する。そして、プリンター11はこの要求に応答して構成情報をホスト装置30へ応答する。構成情報には、USBデバイス11Aのクラス情報と、バスパワーかセルフパワーかを示すパワーモード情報と、ホスト装置30に要求する電力の値を示す要求電力値情報とが含まれる。ここで、プリンター11の電源オフ時は、クラス情報は例えば「ヒューマンインターフェイスデバイス(HID)クラス」とされる。また、プリンター11の電源オン時は、クラス情報は例えば「プリンタークラス」とされる。 As shown in FIG. 2, in the enumeration, first, the printer 11 receives “USB BusReset” instructing reset processing (bus reset) from the host device 30 at the start of enumeration. Next, a “GetDescriptor” requesting configuration information called a descriptor is received. In response to this request, the printer 11 returns configuration information to the host device 30. The configuration information includes class information of the USB device 11A, power mode information indicating bus power or self power, and required power value information indicating the value of power required for the host device 30. Here, when the printer 11 is powered off, the class information is, for example, “human interface device (HID) class”. When the printer 11 is powered on, the class information is “printer class”, for example.
本実施形態では、バスパワーを要求する初期処理が、第1初期処理の一例に相当する。また、セルフパワーを要求する初期処理が第2初期処理の一例に相当する。なお、以下の説明中で、バスパワーを要求する初期処理を第1初期処理と称し、セルフパワーを要求する初期処理を第2初期処理と称する場合がある。 In the present embodiment, the initial process for requesting bus power corresponds to an example of the first initial process. Further, the initial process for requesting self-power corresponds to an example of the second initial process. In the following description, an initial process for requesting bus power may be referred to as a first initial process, and an initial process for requesting self power may be referred to as a second initial process.
また、バスパワーを要求する第1初期処理においては、要求電力値情報として、第1電力(保証電力(例えば電流値100mA))よりも大きな第2電力が設定される。要求電力値情報は、所定の電源電圧(例えば5ボルト)の下で電流値を要求する要求電流値情報で示される。第2電力を要求する要求電流値情報は、USB規格で供給可能な最大電力に相当する例えば「500mA」とされる。なお、第2電力は、最大電力に限らず、二次電池14への充電が可能な電力であればよく、第1電力より大きくかつ最大電力未満の電力でもよい。さらに第2電力は、セルフパワーを要求する第2初期処理の完了後にホスト装置30から供給される電力「0(零)」より大きく、かつ最大電力未満の電力であってもよい。 In the first initial processing for requesting bus power, second power larger than the first power (guaranteed power (eg, current value 100 mA)) is set as the required power value information. The required power value information is indicated by required current value information that requests a current value under a predetermined power supply voltage (for example, 5 volts). The requested current value information for requesting the second power is, for example, “500 mA” corresponding to the maximum power that can be supplied by the USB standard. The second power is not limited to the maximum power, but may be any power that can charge the secondary battery 14, and may be a power that is larger than the first power and less than the maximum power. Furthermore, the second power may be greater than the power “0 (zero)” supplied from the host device 30 after the completion of the second initial process requesting self-power and less than the maximum power.
そして、ホスト装置30は、クラス情報(例えば「HIDクラス」)に基づいてUSB接続されたUSBデバイスがヒューマンインターフェイスデバイスであると認識する。また、ホスト装置30は、要求電流値情報(例えば500mA)に基づいて、その要求された第2電力での電源供給が可能であるか否かを判断し、第2電力での電源供給が可能であれば、その構成情報を設定するとともに、初期処理完了通知(設定完了通知)である「SetConfiguration」をプリンター11に送信する。 Then, the host device 30 recognizes that the USB device connected by USB based on the class information (for example, “HID class”) is a human interface device. Further, the host device 30 determines whether or not power supply with the requested second power is possible based on the requested current value information (for example, 500 mA), and power supply with the second power is possible. If so, the configuration information is set, and “SetConfiguration” which is an initial processing completion notification (setting completion notification) is transmitted to the printer 11.
図2に示すように、エニュメレーションにおいてプリンター11から要求した第2電力での電源供給が許可されて初期処理完了通知「SetConfiguration」を受信するまでは、充電不可能な状態にある。そして、初期処理完了通知を受信した場合に、ホスト装置30からプリンター11に、要求した第2電力で電源供給されて二次電池14の充電が可能になる。 As shown in FIG. 2, charging is not possible until the power supply with the second power requested from the printer 11 in the enumeration is permitted and the initial processing completion notification “SetConfiguration” is received. When the initial processing completion notification is received, the power is supplied from the host device 30 to the printer 11 with the requested second power, and the secondary battery 14 can be charged.
本実施形態では、プリンター11の電源オフ状態かつACアダプター50が非接続の状態の下でUSB接続が検出されたときの接続相手がホスト装置30である場合、プリンター11内のCPU24が起動される(充電起動オン)。このCPU24の充電起動とほぼ同時にCPU24はタイマー24Aによる計時を開始させる。CPU24は、その起動時点からの経過時間をタイマー24Aで計時し、その計時時間Tがタイムアウト時間T1に達したか否かを判断する。計時時間Tがタイムアウト時間T1に達する前に初期処理完了通知「SetConfiguration」を受信すれば、ホスト装置30から第2電力(例えば電流値で500mA)での電源供給が開始されるため、その供給される第2電力で二次電池14を充電する。 In this embodiment, when the USB device is detected when the printer 11 is powered off and the AC adapter 50 is not connected, the CPU 24 in the printer 11 is activated when the connection partner is the host device 30. (Charge start-up is on). At substantially the same time as the start of charging of the CPU 24, the CPU 24 starts measuring time by the timer 24A. The CPU 24 measures the elapsed time from the activation time by the timer 24A, and determines whether or not the time T has reached the timeout time T1. If the initial processing completion notification “SetConfiguration” is received before the time T reaches the timeout time T1, power supply at the second power (for example, 500 mA in current value) is started from the host device 30. The secondary battery 14 is charged with the second electric power.
一方、図3に示すように、プリンター11とホスト装置30とのUSB接続が検出され、プリンター11内のCPU24が起動(充電起動オン)されて開始した初期処理において、プリンター11が送信した構成情報がホスト装置30で許可されない場合、プリンター11は初期処理完了通知「SetConfiguration」を受信できない。この場合、プリンター11では、初期処理完了通知を受信することなく、タイマー24Aの計時時間Tが、タイムアウト時間T1に達する。このように初期処理完了通知「SetConfiguration」を受信することなく、計時時間Tがタイムアウト時間T1に達すると、プリンター11は充電を目的に内部的に電源オンさせたCPU24の電源をオフにすることで、充電起動をオフにする(電源オフ)。 On the other hand, as shown in FIG. 3, the configuration information transmitted by the printer 11 in the initial process started when the USB connection between the printer 11 and the host device 30 is detected and the CPU 24 in the printer 11 is activated (charging activation is turned on). Is not permitted by the host device 30, the printer 11 cannot receive the initial processing completion notification “SetConfiguration”. In this case, in the printer 11, the time T of the timer 24A reaches the timeout time T1 without receiving the initial process completion notification. As described above, when the time T reaches the timeout time T1 without receiving the initial process completion notification “SetConfiguration”, the printer 11 turns off the power of the CPU 24 that is internally turned on for the purpose of charging. , Turn off charging start (power off).
ここで、タイムアウト時間T1を経過しても初期処理完了通知を受信できない例として、以下の場合が挙げられる。例えば図4に示すように、ホスト装置30とプリンター11とがバスパワーで動作しているハブ60(分岐装置)を経由して接続されている構成では、ハブ60のポート60aが例えばNポート(図4の例では5ポート)である場合、1ポート当たり500/N(mA)の電流値(図4の例では100mA)でしか電源供給ができない。そのため、プリンター11がクラス情報及び要求電流値情報(例えば500mA)を含む構成情報を送信しても、ホスト装置30はハブ経由であることの認識をもって、第2電力(例えば電流値で500mA)での電源供給ができないと判断する。このため、ホスト装置30は、要求された第2電力での電源供給を許可できないため、構成情報を設定しない。この結果、図3に示すように、ホスト装置30は、初期処理完了通知「SetConfiguration」をプリンター11に送信しない。このため、プリンター11はホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」の受信を待つ待機状態となる。 Here, as an example in which the initial processing completion notification cannot be received even after the time-out period T1 has elapsed, the following cases may be mentioned. For example, as shown in FIG. 4, in a configuration in which the host device 30 and the printer 11 are connected via a hub 60 (branch device) operating with bus power, the port 60a of the hub 60 is, for example, an N port ( In the example of FIG. 4, the power can be supplied only at a current value of 500 / N (mA) per port (100 mA in the example of FIG. 4). Therefore, even if the printer 11 transmits configuration information including class information and requested current value information (for example, 500 mA), the host device 30 recognizes that it is via a hub and uses the second power (for example, a current value of 500 mA). It is determined that the power cannot be supplied. For this reason, since the host device 30 cannot permit the power supply with the requested second power, the configuration information is not set. As a result, as illustrated in FIG. 3, the host device 30 does not transmit the initial processing completion notification “SetConfiguration” to the printer 11. For this reason, the printer 11 enters a standby state waiting for reception of the initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30.
また、ホスト装置30がバッテリー駆動時にUSBデバイス(プリンター11)への電源供給が最大電力(例えば電流値で500mA)未満の所定電力以下に制限する設定がなされている場合がある。このようなホスト装置30では、プリンター11から要求された第2電力での電源供給ができないため、ホスト装置30からプリンター11へ初期処理完了通知「SetConfiguration」が送信されない。この場合も、プリンター11はホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」の受信を待つ待機状態となる。 In some cases, the host device 30 is set to limit power supply to the USB device (printer 11) to a predetermined power less than the maximum power (for example, a current value of 500 mA) when the battery is driven. In such a host device 30, the power supply with the second power requested from the printer 11 cannot be performed, and thus the initial processing completion notification “SetConfiguration” is not transmitted from the host device 30 to the printer 11. Also in this case, the printer 11 is in a standby state waiting for reception of an initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30.
この待機状態においてCPU24は起動状態(充電起動オン状態)で待機するため、二次電池14の電力を消費する。この待機状態においてプリンター11はホスト装置30からUSBケーブル35を通じて第1電力(電流値で例えば100mA)で電源供給を受けるものの、起動中のCPU24が初期処理で消費する電力が、第1電力を上回るため、待機時間の経過と共に二次電池14の残量が徐々に低下してしまう。 In this standby state, the CPU 24 waits in an activated state (charging activation on state), and thus consumes the power of the secondary battery 14. In this standby state, the printer 11 receives power supply from the host device 30 through the USB cable 35 with the first power (current value is, for example, 100 mA), but the power consumed by the activated CPU 24 in the initial processing exceeds the first power. Therefore, the remaining amount of the secondary battery 14 gradually decreases as the standby time elapses.
そこで、本実施形態では、前述のタイムアウト時間T1を設定し、初期処理完了通知を受信することなく計時時間Tがタイムアウト時間T1に達してタイムアウトになると、ホスト装置30に応答した構成情報に含まれる要求が許可されず初期処理を失敗したとみなして、CPU24は電源をオフにする(充電起動オフ)。そして、タイムアウト時間T1を、USBコネクター12への接続が想定される複数種のホスト装置30のうち最長のBIOS起動所要時間に応じた値に設定しているので、ホスト装置30のBIOS起動を待つにほぼ十分な時間を待った後にタイムアウトとなる。このため、待機すれば充電できたにも拘らず短過ぎるタイムアウト時間によりタイムアウトになってしまい、二次電池14の充電ができなくなる不都合を回避し易いタイムアウト時間T1に設定されている。 Therefore, in the present embodiment, the above-described timeout time T1 is set, and when the timing time T reaches the timeout time T1 and times out without receiving the initial processing completion notification, it is included in the configuration information responding to the host device 30. Assuming that the request is not permitted and the initial process has failed, the CPU 24 turns off the power (charge activation off). The timeout time T1 is set to a value corresponding to the longest BIOS startup time among a plurality of types of host devices 30 that are assumed to be connected to the USB connector 12, and the host device 30 waits for BIOS startup. It will time out after waiting for almost enough time. For this reason, the timeout time T1 is set to easily avoid the inconvenience that the secondary battery 14 cannot be charged due to a timeout due to a timeout time that is too short even if the battery can be charged.
タイムアウト時間T1は、電源ON時と電源OFF時とで同じでもよいが、本実施形態では、タイムアウト時間T1を、電源ON時と電源OFF時とで異なる値に設定している。特に本実施形態では、電源ON時のタイムアウト時間T12の方が電源OFF時のタイムアウト時間T11よりも短く設定している(T11>T12)。このように設定するのは以下の理由による。電源OFF中はユーザーがホスト装置30からプリンター11に処理(例えば印刷処理)を指示することがないので、電源OFF時のタイムアウト時間T11がホスト装置30の起動所要時間に応じた多少長めの値に設定されても問題がない。しかし、電源ON時のタイムアウト時間T12は、長くなると、ユーザーがホスト装置30からプリンター11に指示した処理の開始遅れの原因になる。このため、電源OFF中は充電の頻度を高めるために相対的な長めのタイムアウト時間T11を設定し、電源ON中はユーザーがホスト装置30からプリンター11に指示した処理の待ち時間の発生を短く抑えるために相対的な短めのタイムアウト時間T12を設定している。なお、タイムアウト時間を、T11<T12を満たすように設定してもよい。 The timeout time T1 may be the same when the power is turned on and when the power is turned off, but in this embodiment, the timeout time T1 is set to a different value between when the power is turned on and when the power is turned off. In particular, in the present embodiment, the timeout time T12 when the power is turned on is set shorter than the timeout time T11 when the power is turned off (T11> T12). This setting is made for the following reason. Since the user does not instruct the printer 11 from the host device 30 when the power is turned off (for example, print processing), the timeout time T11 when the power is turned off is a slightly longer value corresponding to the required startup time of the host device 30. There is no problem even if it is set. However, if the time-out time T12 when the power is turned on becomes long, it may cause a delay in the start of processing instructed by the user from the host device 30 to the printer 11. For this reason, a relatively long timeout time T11 is set to increase the frequency of charging while the power is off, and the waiting time of processing instructed from the host device 30 to the printer 11 by the user is suppressed while the power is on. Therefore, a relatively short timeout time T12 is set. Note that the timeout time may be set so as to satisfy T11 <T12.
操作スイッチ20Bを操作して表示部21でメニューの下位階層に進むと、図5に示すような、モード設定画面G1が表示される。このモード設定画面G1には、操作スイッチ20Bの操作によって、バスパワーモードを設定する際に選択される第1ボタン71と、セルフパワーモードを設定する際に選択される第2ボタン72とが設けられている。ユーザーが操作スイッチ20Bを操作して第1ボタン71を選択することでバスパワーモードが設定され、第2ボタン72を選択することでセルフパワーモードが設定される。このユーザー設定されたパワーモードは、CPU24により不揮発性メモリー25の所定記憶領域(図6(a)参照)に書き込まれる。 When the operation switch 20B is operated and the display unit 21 moves to a lower level of the menu, a mode setting screen G1 as shown in FIG. 5 is displayed. The mode setting screen G1 includes a first button 71 that is selected when setting the bus power mode by operating the operation switch 20B, and a second button 72 that is selected when setting the self-power mode. It has been. The bus power mode is set when the user operates the operation switch 20B and selects the first button 71, and the self power mode is set when the second button 72 is selected. The user-set power mode is written by the CPU 24 into a predetermined storage area (see FIG. 6A) of the nonvolatile memory 25.
図6に示すように、操作スイッチ20Bの操作で「バスパワーモード」を選択し設定すると、不揮発性メモリー25の第1記憶領域25Aにバスパワーの旨の値(一例として「1」)が記憶される。一方、操作スイッチ20Bの操作で「セルフパワーモード」を選択し設定すると、不揮発性メモリー25の第1記憶領域25Aにセルフパワーの旨(一例として「0」)が記憶される。このようにユーザーはバスパワーかセルフパワーかを選択できる。ユーザーが操作スイッチ20Bを操作して設定したUSB通信モード設定内容(ユーザー設定内容)は、不揮発性メモリー25の第1記憶領域25Aに記憶される。 As shown in FIG. 6, when the “bus power mode” is selected and set by operating the operation switch 20B, a value (1 as an example) indicating the bus power is stored in the first storage area 25A of the nonvolatile memory 25. Is done. On the other hand, when the “self power mode” is selected and set by operating the operation switch 20B, the fact that self power is applied (“0” as an example) is stored in the first storage area 25A of the nonvolatile memory 25. In this way, the user can select bus power or self power. The USB communication mode setting content (user setting content) set by the user by operating the operation switch 20B is stored in the first storage area 25A of the nonvolatile memory 25.
ここで、バスパワーとは、ホスト装置30とUSBケーブル35を通じて接続されたときにホスト装置30からUSBケーブル35のバス線を通じて電力の供給を受ける電力供給モードを指す。一方、セルフパワーとは、ホスト装置30とUSBケーブル35を通じて接続されたときにホスト装置30から電力の供給を受けず電子機器(本例ではプリンター11)が自分で電力を賄う非受電モードを指す。 Here, the bus power refers to a power supply mode in which power is supplied from the host device 30 through the bus line of the USB cable 35 when connected to the host device 30 through the USB cable 35. On the other hand, the self-power refers to a non-power receiving mode in which an electronic device (in this example, the printer 11) does not receive power from the host device 30 when it is connected to the host device 30 through the USB cable 35. .
また、不揮発性メモリー25には、ユーザー設定内容とは別に、バスパワーの要求を含む初期処理(第1初期処理)の成功か失敗かを記憶する第2記憶領域が用意されている。本実施形態では、初期設定がバスパワーであり、ホスト装置とのUSB通信確立のために実行される初期処理に成功すればバスパワーの設定が維持され、初期処理に失敗するとセルフパワーの設定に切り替えられる。このため、図6に示すように、不揮発性メモリー25の第2記憶領域25Bには、前回のバスパワーを要求する初期処理の成否(成功/失敗)に関する情報が記憶される。つまり、バスパワーを要求する初期処理が成功した場合は、図6(a)に示すように第2記憶領域25Bに成功の旨の値(例えば「1」)が書込まれ、その初期処理に失敗した場合は、図6(b)に示すように第2記憶領域25Bに失敗の旨を示す値(例えば「0」)が記憶される。 In addition to the user setting contents, the nonvolatile memory 25 is provided with a second storage area for storing success or failure of the initial process (first initial process) including a request for bus power. In this embodiment, the initial setting is bus power, the bus power setting is maintained if the initial process executed for establishing USB communication with the host device is successful, and the self power setting is set if the initial process fails. Can be switched. Therefore, as shown in FIG. 6, information related to the success or failure (success / failure) of the initial process requesting the previous bus power is stored in the second storage area 25 </ b> B of the nonvolatile memory 25. That is, when the initial process for requesting bus power is successful, a value indicating success (for example, “1”) is written in the second storage area 25B as shown in FIG. In the case of failure, as shown in FIG. 6B, a value (for example, “0”) indicating failure is stored in the second storage area 25B.
CPU24は、第2記憶領域25Bに格納された値に基づき、バスパワーを要求した前回の初期処理(第1初期処理)が成功であれば、今回もバスパワーを要求して第1初期処理を実行し、一方、失敗であれば、今回はセルフパワーを要求する初期処理(第2初期処理)を実行する。第2記憶領域25Bの設定内容は、USBケーブル35がUSBコネクター12から抜かれたことが検出されると、CPU24によりバスパワーの旨の初期設定時の値に書き替えられる。これは、USBケーブル35の接続が維持されている間は相手のホスト装置30が同じであるので、一度成功しているホスト装置30には、今回もバスパワーを要求する初期処理をしても高確率で成功するはずであり、一度失敗しているホスト装置には今回もバスパワーを要求する初期処理をしても高確率で失敗するはずだからである。このような理由から、CPU24は、ホスト装置30とUSB接続が維持されている間は、次回の初期処理を行うタイミングで不揮発性メモリー25のこの前回の成功/失敗の情報を確認し、今回の初期処理時の要求パワーモードを前回が成功であればバスパワーとし、前回が失敗であればセルフパワーとする。なお、不揮発性メモリー25の第2記憶領域25Bに記憶する値は、「1」、「0」である。ここでは、「1」、「0」を、説明の便宜上、成功/失敗の旨を示す値と表記したが、バスパワー/セルフパワーの旨を示す値としても同義である。 Based on the value stored in the second storage area 25B, the CPU 24 requests the bus power again and performs the first initial process if the previous initial process (first initial process) that requested the bus power is successful. On the other hand, if it fails, an initial process (second initial process) for requesting self-power is executed this time. When it is detected that the USB cable 35 is disconnected from the USB connector 12, the setting content of the second storage area 25B is rewritten to the initial setting value indicating the bus power. This is because the host device 30 of the other party is the same while the connection of the USB cable 35 is maintained, so the host device 30 that has once succeeded may be subjected to the initial process of requesting bus power this time. This is because the host device should succeed with high probability, and the host device that has once failed should also fail with high probability even if the initial processing requesting bus power is performed again. For this reason, while the USB connection with the host device 30 is maintained, the CPU 24 checks the previous success / failure information in the nonvolatile memory 25 at the timing of performing the next initial processing, and this time The required power mode at the time of initial processing is set to bus power if the previous time is successful, and to self power if the previous time is unsuccessful. The values stored in the second storage area 25B of the nonvolatile memory 25 are “1” and “0”. Here, “1” and “0” are described as values indicating success / failure for convenience of explanation, but they are also synonymous as values indicating bus power / self power.
また、プリンター11の不揮発性メモリー25には、図7〜図9にフローチャートで示される電源OFF時における充電処理用プログラム、及び図10で示される電源ON時のUSB通信処理用プログラムが記憶されている。なお、このプログラムは制御IC22に書き込まれた部分(ステップS1〜S5)と、不揮発性メモリー25に記憶されてCPU24により実行される部分(ステップS6)とを含んでいる。 Further, the non-volatile memory 25 of the printer 11 stores a charging processing program when the power is turned off as shown in the flowcharts of FIGS. 7 to 9 and a USB communication processing program when the power is turned on as shown in FIG. Yes. This program includes a part written in the control IC 22 (steps S1 to S5) and a part stored in the nonvolatile memory 25 and executed by the CPU 24 (step S6).
次に図7〜図10を参照してプリンター11の作用を説明する。すなわち、プリンター11内の制御IC22及びCPU24が実行する電源OFF時の充電処理(図7〜図9)と、プリンター11内のCPU24が実行する電源ON時のUSB通信処理(図9及び図10)とについて説明する。図7〜図9に示す充電処理は、プリンター11が電源オフ状態にあり、かつACアダプター50が接続されておらずACアダプター50による二次電池14への充電が行われていない状態の下で行われる。 Next, the operation of the printer 11 will be described with reference to FIGS. That is, the charging process when the power is turned off (FIGS. 7 to 9) executed by the control IC 22 and the CPU 24 in the printer 11 and the USB communication process when the power is turned on (FIGS. 9 and 10) executed by the CPU 24 in the printer 11. And will be described. The charging process shown in FIGS. 7 to 9 is performed when the printer 11 is in a power-off state and the AC adapter 50 is not connected and the secondary battery 14 is not charged by the AC adapter 50. Done.
なお、図6(a)に示すように、不揮発性メモリー25(以下、単に「メモリー25」ともいう。)における第1記憶領域25Aには「バスパワー」(例えば値「1」)が設定され、第2記憶領域25Bには「成功(バスパワー)」(例えば値「1」)が設定されているものとする。つまり、第1記憶領域25Aと第2記憶領域25Bの各設定値は、初期設定時の値となっている。このようにユーザー設定としてバスパワーが設定され、初期処理成否情報として成功の旨の値が設定されているものとする。 As shown in FIG. 6A, “bus power” (for example, value “1”) is set in the first storage area 25A in the nonvolatile memory 25 (hereinafter also simply referred to as “memory 25”). It is assumed that “success (bus power)” (for example, value “1”) is set in the second storage area 25B. That is, the setting values of the first storage area 25A and the second storage area 25B are the values at the time of initial setting. As described above, it is assumed that the bus power is set as the user setting, and the success value is set as the initial process success / failure information.
USBコネクター12に何らかのコネクターが接続され、USB接続を検出すると、制御IC22が起動され、図7に示す充電処理が開始される。
まずステップS1では、接続先がホスト装置であるか否かを判断する。すなわち、制御IC22は、接続先がUSBホスト30Aとして機能するホスト装置30であるかUSBバッテリーチャージャー40等の電源アダプターであるかを判断する。例えばデータ線が(D+)≠(D−)である場合は接続先がホスト装置30であると判断し、(D+)=(D−)である場合は接続先が電源アダプターであると判断する。接続先がホスト装置30ではなく電源アダプターであればステップS13に進み、ホスト装置30であればステップS14に進む。
When any connector is connected to the USB connector 12 and USB connection is detected, the control IC 22 is activated and the charging process shown in FIG. 7 is started.
First, in step S1, it is determined whether or not the connection destination is a host device. That is, the control IC 22 determines whether the connection destination is the host device 30 functioning as the USB host 30A or a power adapter such as the USB battery charger 40. For example, when the data line is (D +) ≠ (D−), it is determined that the connection destination is the host device 30, and when (D +) = (D−), it is determined that the connection destination is the power adapter. . If the connection destination is not the host device 30 but the power adapter, the process proceeds to step S13. If the connection destination is the host apparatus 30, the process proceeds to step S14.
ステップS2では、電源アダプターで充電を開始する。本例の場合、USBバッテリーチャージャー40からの電力で二次電池14を充電する。
ステップS3では、二次電池の残量が閾値未満であるか否かを判断する。すなわち、二次電池14の残量が、初期処理を行ううえで十分な残量である閾値未満であるか否かを判断する。二次電池14の残量が閾値未満であればステップS4に進み、閾値未満でなければステップS5に進む。
In step S2, charging is started with the power adapter. In this example, the secondary battery 14 is charged with power from the USB battery charger 40.
In step S3, it is determined whether or not the remaining amount of the secondary battery is less than a threshold value. That is, it is determined whether or not the remaining amount of the secondary battery 14 is less than a threshold value that is sufficient for performing the initial process. If the remaining capacity of the secondary battery 14 is less than the threshold value, the process proceeds to step S4, and if not, the process proceeds to step S5.
ステップS4では、二次電池を第1電力(例えば100mA)で充電する。この第1電力での充電は、二次電池14の残量が閾値に達するまで行われる。そして、二次電池14がその残量が閾値以上になるまで充電されると(S3で否定判定)、ステップS5に進む。 In step S4, the secondary battery is charged with the first power (for example, 100 mA). The charging with the first power is performed until the remaining amount of the secondary battery 14 reaches a threshold value. And if the secondary battery 14 is charged until the remaining amount becomes more than a threshold value (it is negative determination by S3), it will progress to step S5.
ステップS5では、CPUを起動させる(充電起動オン)。すなわち、制御IC22は、第3スイッチ28をオフからオンに切り替えることでCPU24を起動させる。このように二次電池14の充電を開始する前に必要なホスト装置30との初期処理を行わせるためにCPU24を起動させる。 In step S5, the CPU is activated (charging activation is on). That is, the control IC 22 activates the CPU 24 by switching the third switch 28 from off to on. In this way, the CPU 24 is activated in order to perform necessary initial processing with the host device 30 before starting the charging of the secondary battery 14.
ステップS6では、CPUによる充電処理を行う。この充電処理は、CPU24が図8に示す電源OFF時の充電処理ルーチンを実行することにより行われる。以下、図8を参照してCPU24による充電処理ルーチンについて説明する。 In step S6, a charging process by the CPU is performed. This charging process is performed by the CPU 24 executing a charging process routine when the power is turned off as shown in FIG. Hereinafter, the charging process routine by the CPU 24 will be described with reference to FIG.
まずステップS11では、パワーモードに係るユーザー設定を判断する。すなわち、ユーザー設定が、バスパワーであるかセルフパワーであるかを判断する。本例では、ユーザー設定は初期設定でバスパワーとなっており、ユーザーが操作スイッチ20Bの操作でセルフパワーを選択した場合にセルフパワーが設定される。CPU24はメモリー25の第1記憶領域25Aに格納された値に基づいてパワーモードがバスパワーかセルフパワーかを判断する。 First, in step S11, user settings relating to the power mode are determined. That is, it is determined whether the user setting is bus power or self power. In this example, the user setting is bus power in the initial setting, and the self power is set when the user selects the self power by operating the operation switch 20B. The CPU 24 determines whether the power mode is bus power or self power based on the value stored in the first storage area 25A of the memory 25.
ここで、ユーザーがセルフパワーを設定する目的の一つは、ホスト装置30がハブ60を介してプリンター11と接続されて第2電力(電流値で例えば500mA)での電力供給ができない場合でも、セルフパワーで初期処理を行うので、初期処理が失敗することがまずないようにするというものである。例えば電源ON時の初期処理であれば、その後USB通信が確実に確立され、プリンター11がホスト装置30からの印刷データに基づく印刷を行うことができる。但し、本実施形態では、バスパワーを要求する初期処理が、ハブ60を介する等の理由により失敗しても、その失敗を検出してバスパワーからセルフパワーに切り替える制御を採用している。また、ユーザーがセルフパワーを設定する目的は、ホスト装置30がノートパソコン等でバッテリーの電力で動作している場合に、ノートパソコン等のバッテリーの電力がプリンター11に使われずに、長持ちするようにするというものである。ユーザー設定がバスパワーである場合はステップS12に進み、セルフパワーの場合はステップS17に進む。セルフパワーの場合は充電が行われないので、ステップS17では、制御IC22及びCPU24の起動をオフすることで、充電起動をオフする(充電起動オフ)。 Here, one of the purposes for the user to set self-power is that even when the host device 30 is connected to the printer 11 via the hub 60 and cannot supply power at the second power (for example, 500 mA in current value), Since the initial process is performed with self-power, the initial process is unlikely to fail. For example, in the case of the initial processing when the power is turned on, USB communication is thereafter established reliably, and the printer 11 can perform printing based on the print data from the host device 30. However, in the present embodiment, even if the initial process for requesting the bus power fails due to a reason such as via the hub 60, the control for detecting the failure and switching from the bus power to the self power is adopted. The purpose of setting the self power by the user is that the power of the battery of the notebook computer or the like is not used by the printer 11 when the host device 30 is operating with the power of the battery of the notebook computer or the like, so that it lasts for a long time. It is to do. If the user setting is bus power, the process proceeds to step S12. If the user setting is self power, the process proceeds to step S17. Since charging is not performed in the case of self-power, charging activation is turned off by turning off activation of the control IC 22 and the CPU 24 in step S17 (charging activation off).
ステップS12では、メモリー25(第2記憶領域25B)の値が成功であるか否かを判断する。「成功」の旨の値(例えば「1」)であればステップS13に進み、成功の旨の値でなければ(つまり失敗の旨の値(例えば「0」)であれば)、ステップS17に進む。セルフパワーの場合は充電が行われないので、ステップS17では、制御IC22及びCPU24の起動をオフすることで、充電起動をオフする(充電起動オフ)。 In step S12, it is determined whether or not the value of the memory 25 (second storage area 25B) is successful. If it is a value indicating “success” (for example, “1”), the process proceeds to step S13. If it is not a value indicating success (that is, if it is a value indicating failure (for example, “0”)), the process proceeds to step S17. move on. Since charging is not performed in the case of self-power, charging activation is turned off by turning off activation of the control IC 22 and the CPU 24 in step S17 (charging activation off).
ステップS13では、プルアップを行う。すなわち、CPU24は、データ線D+,D−の電圧を変動させてプルアップを行う。このプルアップによりホスト装置30はUSBデバイス11A(プリンター11)の接続を検出し、初期処理(エニュメレーション)(図2、図3を参照)を開始する。 In step S13, pull-up is performed. That is, the CPU 24 performs pull-up by changing the voltages of the data lines D + and D−. By this pull-up, the host device 30 detects the connection of the USB device 11A (printer 11) and starts an initial process (enumeration) (see FIGS. 2 and 3).
ステップS14では、バスパワーを要求する初期処理(第1初期処理)を実行し、その初期処理が成功したか否かを判断する。このステップS14の処理は、CPU24が図9にフローチャートで示す初期処理ルーチンを実行することにより行われ、その詳細は以下のように行われる。 In step S14, an initial process (first initial process) for requesting bus power is executed, and it is determined whether or not the initial process is successful. The processing in step S14 is performed by the CPU 24 executing an initial processing routine shown in the flowchart of FIG. 9, and the details thereof are performed as follows.
まず図9のステップS31において、タイマーの計時を開始する。すなわち、CPU24はタイマー24Aに計時を開始させる。この結果、タイマー24AはCPU24の起動時点(正確にはプルアップ時点)からの経過時間(計時時間T)を計時する。なお、タイマー24Aによる計時開始処理(S31)とプルアップ処理(S13)との順番は逆でもよい。 First, in step S31 of FIG. 9, timer timing is started. That is, the CPU 24 causes the timer 24A to start measuring time. As a result, the timer 24A measures the elapsed time (timed time T) from the starting point of the CPU 24 (more precisely, the pull-up point). Note that the order of the timing start process (S31) and the pull-up process (S13) by the timer 24A may be reversed.
ステップS32では、バスパワーを要求する初期処理(第1初期処理)を行う。ホスト装置30からの要求に対してディスクリプターと呼ばれる構成情報を送信する。構成情報には、USBデバイスのクラスを示すクラス情報と、USBホストに要求するパワーモードの情報(要求パワーモード情報)と、USBホストに要求する電力の情報(要求電力情報)とが含まれる。クラス情報には、プリンタークラス及びヒューマンインターフェイスデバイス(HID)クラスのうち一方が用いられる。電源オフ中は印刷は行われないので、HIDクラスが用いられる。本例のプリンター11は、電源オフ状態での充電モードにおいて、「バスパワー」を要求しそのときの供給電力として第2電力(電流値で例えば500mA)を要求する。このため、プリンター11は、HIDクラスを指定し、バスパワーで第2電力を要求する構成情報をホスト装置30に応答する。なお、電源オン中に行われる初期処理では、構成情報中のクラス情報としてプリンタークラスが用いられ、ホスト装置30は、USBデバイス11Aをプリンターと認識する。また、HIDクラスに替えてマスストレージクラス等の他のクラスを用いてもよい。 In step S32, an initial process (first initial process) for requesting bus power is performed. In response to a request from the host device 30, configuration information called a descriptor is transmitted. The configuration information includes class information indicating the class of the USB device, power mode information requested from the USB host (requested power mode information), and power information requested from the USB host (requested power information). One of the printer class and the human interface device (HID) class is used for the class information. Since printing is not performed while the power is off, the HID class is used. In the charging mode in the power-off state, the printer 11 of this example requests “bus power” and requests second power (for example, 500 mA in current value) as supplied power at that time. For this reason, the printer 11 responds to the host device 30 with configuration information that specifies the HID class and requests the second power with the bus power. In the initial process performed while the power is turned on, the printer class is used as the class information in the configuration information, and the host device 30 recognizes the USB device 11A as a printer. In addition, other classes such as a mass storage class may be used instead of the HID class.
このバスパワーを要求する初期処理は、図2に示すように行われる。プルアップによりUSB接続が検出されると、ホスト装置30とプリンター11との間で初期処理としてエニュメレーションが開始される。まずホスト装置30からプリンター11へバスリセットを指示する「USB BusReset」が送信され、この指示を受信したプリンター11はバスリセットする。次にホスト装置30からプリンター11へ構成情報(ディスクリプター)を要求する「GetDescriptor」が送信される。「GetDescriptor」を受信したプリンター11は、クラス情報(例えば「HID」)、パワーモード情報(「バスパワー」)及び要求電力情報(「第2電力(例えば500mA)」)を含む構成情報を送信する。 The initial processing for requesting the bus power is performed as shown in FIG. When USB connection is detected by pull-up, enumeration is started between the host device 30 and the printer 11 as an initial process. First, “USB BusReset” instructing the bus reset is transmitted from the host device 30 to the printer 11, and the printer 11 that has received this instruction resets the bus. Next, “GetDescriptor” requesting configuration information (descriptor) is transmitted from the host device 30 to the printer 11. The printer 11 that has received “GetDescriptor” transmits configuration information including class information (eg, “HID”), power mode information (“bus power”), and required power information (“second power (eg, 500 mA)”). .
ホスト装置30は、プリンター11から受信した構成情報に基づき、要求された条件でUSB通信接続を許可しうるか否かを判断する。そして、ホスト装置30は、バスパワーかつ第2電力で電源供給が可能と判断すれば、プリンター11の構成情報をメモリーに書き込んでデバイス構成等を設定するとともに、図2に示すように、プリンター11へ初期処理完了の旨の初期処理完了通知「SetConfiguration」を送信する。 Based on the configuration information received from the printer 11, the host device 30 determines whether the USB communication connection can be permitted under the requested conditions. If the host device 30 determines that the power can be supplied with bus power and the second power, the configuration information of the printer 11 is written in the memory to set the device configuration and the printer 11 as shown in FIG. An initial process completion notification “SetConfiguration” is sent to the effect that the initial process is complete.
一方、図4に示すように、ホスト装置30とプリンター11とがバスパワーハブ経由で接続されている場合、プリンター11が、バスパワーかつ第2電力を含む構成情報を送信しても、ホスト装置30はハブ経由との認識から、要求された第2電力での電源供給が不可能と判断し、USB通信の確立を許可しない。この場合、図3に示すように、ホスト装置30からプリンター11へ初期処理完了通知「SetConfiguration」は送信されない。よって、プリンター11内のCPU24は、ホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」を、起動状態のまま待機することになる。この待機中は、起動中(充電起動オン状態)のCPU24が電力を浪費し、二次電池14の残量が低減する。 On the other hand, as shown in FIG. 4, when the host device 30 and the printer 11 are connected via a bus power hub, even if the printer 11 transmits configuration information including bus power and second power, the host device 30 recognizes that it is via the hub and determines that power supply with the requested second power is impossible, and does not permit establishment of USB communication. In this case, as shown in FIG. 3, the initial processing completion notification “SetConfiguration” is not transmitted from the host device 30 to the printer 11. Therefore, the CPU 24 in the printer 11 waits for the initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30 in the activated state. During this standby, the CPU 24 that is being activated (charging activation is on) wastes power, and the remaining amount of the secondary battery 14 is reduced.
また、ホスト装置30がバッテリー駆動時に、USBデバイス11Aへの供給電力が最大電力(電流値で500mA)未満の所定電力以下に制限する設定がなされている場合、プリンター11から要求された第2電力(電流値で500mA)での電源供給ができない。このため、ホスト装置30からプリンター11へ初期処理完了通知「SetConfiguration」が送信されない。この場合も、プリンター11内のCPU24は、ホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」を、起動状態のまま待機することになる。この待機中は、起動中のCPU24により、二次電池14の電力が浪費される。これらの場合、ホスト装置30からUSBケーブル35を通じて第1電力(電流値で100mA)が供給されるものの、起動中のCPU24が初期処理で消費する電力が第1電力を上回る場合、二次電池14の残量が徐々に低下してしまう。 In addition, when the host device 30 is driven by a battery, the second power requested from the printer 11 is set when the power supplied to the USB device 11A is set to be less than or equal to a predetermined power less than the maximum power (current value is 500 mA). The power cannot be supplied at (current value of 500 mA). For this reason, the initial processing completion notification “SetConfiguration” is not transmitted from the host device 30 to the printer 11. Also in this case, the CPU 24 in the printer 11 waits for the initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30 in the activated state. During this standby, the power of the secondary battery 14 is wasted by the activated CPU 24. In these cases, when the first power (100 mA in current value) is supplied from the host device 30 through the USB cable 35, but the power consumed by the starting CPU 24 in the initial process exceeds the first power, the secondary battery 14 The remaining amount of will gradually decrease.
ステップS33では、初期処理完了通知を受信したか否かを判断する。そして、CPU24は、初期処理完了通知を受信しなければステップS34に進み、初期処理完了通知を受信して初期処理が成功すればステップS15(図8)へ進む。 In step S33, it is determined whether an initial processing completion notification has been received. If the CPU 24 does not receive the initial process completion notification, the process proceeds to step S34. If the initial process completion notification is received and the initial process is successful, the CPU 24 proceeds to step S15 (FIG. 8).
ステップS34では、タイムアウトになったか否かを判断する。すなわち、タイマー24Aの計時時間Tがタイムアウト時間T1に達したか否かを判断する。タイムアウトでなければステップS33に戻る。こうして初期処理完了通知を受信するか(S33で肯定判定)、タイムアウトになる(S34で肯定判定)まで、ステップS33,S34の処理を繰り返し実行する。タイムアウトになって初期処理に失敗した場合は、ステップS16(図8)へ進む。 In step S34, it is determined whether or not a timeout has occurred. That is, it is determined whether or not the time T of the timer 24A has reached the timeout time T1. If not timed out, the process returns to step S33. The processes in steps S33 and S34 are repeatedly executed until the initial process completion notification is received in this way (Yes in S33) or until time-out occurs (Yes in S34). If time-out occurs and the initial process fails, the process proceeds to step S16 (FIG. 8).
図8に戻って、上記のステップS14の処理(図9)において、初期処理完了通知を受信して初期処理を成功した場合はステップS15に進み、一方、初期処理完了通知を受信する前にタイムアウトとなって初期処理を失敗した場合はステップS16に進むことになる。 Returning to FIG. 8, in the process of step S14 (FIG. 9), if the initial process completion notification is received and the initial process is successful, the process proceeds to step S15. On the other hand, a timeout occurs before the initial process completion notification is received. If the initial process fails, the process proceeds to step S16.
ステップS15では、二次電池を第2電力(電流値で500mA)で充電する。つまり、ホスト装置30から電源供給される第2電力で二次電池14を充電する。
一方、初期処理に失敗した場合は、ステップS16において、メモリーに失敗の旨の値を書き込む。CPU24はメモリー25の第2記憶領域25Bに、例えば図6(b)に示すように失敗の旨の値(例えば「0」)を書き込む。なお、ステップS14において初期処理に成功した場合は、そのときメモリー25の第2記憶領域25Bには、初期処理成否情報として初期設定時の成功の旨の値(初期値(例えば「1」))が格納されているので、特に書き替えは行わない。もちろん、メモリー25に成功の旨の値を書き込んでもよい。
In step S15, the secondary battery is charged with the second power (current value is 500 mA). That is, the secondary battery 14 is charged with the second power supplied from the host device 30.
On the other hand, if the initial process has failed, a value indicating failure is written in the memory in step S16. The CPU 24 writes a value indicating failure (for example, “0”) in the second storage area 25B of the memory 25 as shown in FIG. 6B, for example. If the initial process is successful in step S14, the value indicating success at the time of initial setting (initial value (eg, “1”)) is stored in the second storage area 25B of the memory 25 as initial process success / failure information. Is stored, so rewriting is not performed. Of course, a value indicating success may be written in the memory 25.
そして、次のステップS17では、CPU24と制御IC22とをオフにすることで、充電起動をオフにする(充電起動オフ)。詳しくは、初期処理完了通知を受信することなく、CPU起動時点からの経過時間である計時時間Tがタイムアウト時間T1に達した場合、起動状態にあるCPU24及び制御IC22の電源を共にオフし、二次電池14の充電をその開始前に中止する。この充電起動オフ処理は、例えばCPU24からのオフ指示に従って制御IC22が、第3スイッチ28をオフにすることでCPU24の電源をオフにし、その後、自身の電源をオフにすることで行われる。こうしてCPU24が初期処理の失敗により送られてくることのない初期処理完了通知を待ち続けることによる電力の浪費及び二次電池14の残量の減少を抑制できる。 In the next step S17, the charging activation is turned off by turning off the CPU 24 and the control IC 22 (charging activation off). Specifically, when the time T, which is the elapsed time from the CPU activation time, reaches the timeout time T1 without receiving the initial process completion notification, the CPU 24 and the control IC 22 in the activated state are both turned off, The charging of the next battery 14 is stopped before the start. This charging start-off process is performed, for example, by the control IC 22 turning off the third switch 28 in accordance with an off instruction from the CPU 24 to turn off the power of the CPU 24 and then turning off its own power. In this way, it is possible to suppress the waste of power and the decrease in the remaining amount of the secondary battery 14 due to the CPU 24 waiting for the initial process completion notification that is not sent due to the failure of the initial process.
このようにバスパワー要求での初期処理に成功した場合は二次電池の充電が行われ、初期処理に失敗した場合は、その失敗の旨をメモリー25に保存したうえで、USB接続検出をトリガーに起動された制御IC22及びCPU24の電源がオフされる。 In this way, when the initial processing is successful in response to the bus power request, the secondary battery is charged, and when the initial processing fails, the failure is stored in the memory 25 and the USB connection detection is triggered. The power supply of the control IC 22 and the CPU 24 that are activated at the time is turned off.
この充電中又は電源オフ中において、CPU24は次の処理を行う。すなわち、充電中においては、ステップS18で電源ON操作があったか否かの判断、ステップS19でUSBケーブルが抜かれたか否かの判断、ステップS20でUSB充電終了条件が成立したか否かの判断を、このうち1つの判断処理で肯定判定が得られるまで繰り返し実行する。例えばステップS18で電源ON操作があれば、ステップS21に進んで電源ON処理を行う。すなわち、電源スイッチ20Aの操作でその操作中のみ第2スイッチ27がオンされ、電源回路23からCPU24に電力が供給されることでCPU24が起動され、CPU24が制御IC22に指示することで第3スイッチ28が接続される。このため、電源スイッチ20Aを押してから手を離しても、CPU24への電力供給が維持される。なお、本実施形態での電源ON処理では、プリンター11の一部のみ起動させている充電起動を一旦オフした後、プリンター11全体を電源ONに切り替える処理を含む。これは一部のみ起動されているときに、残りの他の一部のみを起動させる処理を行うことは、起動中の一部がどれなのか監視する必要があるうえ、停止中の他の一部を選択して起動させる面倒な制御が必要なため、一旦起動中の一部の電源をオフしてからプリンター11全体の電源を入れ直すことで、監視の負担及び制御の負担を軽減できるからである。 During this charging or power off, the CPU 24 performs the following processing. That is, during charging, it is determined whether or not a power-on operation has been performed in step S18, whether or not the USB cable has been disconnected in step S19, and whether or not the USB charging end condition is satisfied in step S20. Of these, one determination process is repeated until an affirmative determination is obtained. For example, if there is a power ON operation in step S18, the process proceeds to step S21 to perform power ON processing. That is, the second switch 27 is turned on only during the operation of the power switch 20A, the CPU 24 is activated when power is supplied from the power circuit 23 to the CPU 24, and the CPU 24 instructs the control IC 22 to switch the third switch. 28 is connected. For this reason, even if the hand is released after pressing the power switch 20A, the power supply to the CPU 24 is maintained. Note that the power-on process in the present embodiment includes a process of temporarily turning off the charging activation that activates only a part of the printer 11 and then switching the entire printer 11 to the power-on. In this case, when only a part is activated, it is necessary to monitor which part is being activated and to perform the process of activating only the other part. This requires troublesome control to select and start a part, so that it is possible to reduce the monitoring burden and the control burden by turning off part of the power supply once turned on and then turning the printer 11 on again. is there.
次のステップS22では、USB再接続処理を行う。すなわち、プルアップ状態を一旦解除する。そして、その処理を電源ON時のUSB通信処理ルーチン(図10)へ移行させる。これによりUSBケーブル35が接続されたまま、電源ON時のUSB通信処理ルーチンにおける後述のステップS43又はS44でプルアップした際に、ホスト装置30のUSBホスト30AがUSBデバイス11Aとの再接続(USB接続)を検出する。このため、再接続によって、ホスト装置30はプリンター11との間で初期処理(S45又はS49)を行うことが可能になる。 In the next step S22, USB reconnection processing is performed. That is, the pull-up state is once released. Then, the processing is shifted to the USB communication processing routine (FIG. 10) when the power is turned on. As a result, when the USB cable 35 is connected and pulled up in step S43 or S44 described later in the USB communication processing routine when the power is turned on, the USB host 30A of the host device 30 reconnects to the USB device 11A (USB Connection). For this reason, the host device 30 can perform initial processing (S45 or S49) with the printer 11 by reconnection.
また、ステップS19で、USBケーブルが抜かれた場合(肯定判定)は、当該ルーチンを終了する。このとき、USBケーブル35が抜かれることで二次電池14への充電は中止される。 In step S19, if the USB cable is disconnected (affirmative determination), the routine ends. At this time, the charging of the secondary battery 14 is stopped by disconnecting the USB cable 35.
さらにステップS20で、USB充電終了条件が成立すると、ステップS23に進んで、CPU24及び制御IC22の電源をオフにすることで、充電起動をオフにする。ここで、USB充電終了条件とは、USBケーブル35を通じたホスト装置30とのUSB接続が維持されたまま二次電池14の充電を終了させる条件を指し、(1)二次電池14が満充電になったこと、(2)ホスト装置30よりも充電の電源として優先されるACアダプター50等の電源アダプターが接続されたことが、その条件として挙げられる。ここで、制御IC22は二次電池14の充電中にその残量を監視し、二次電池14が満充電されると、第1スイッチ26をオフにすることで、二次電池14の充電を終了させる。この二次電池14の満充電の旨は制御IC22からCPU24へ通知される。これらの二条件のうちいずれか一方が成立すると、二次電池14へのUSB充電を中止して、充電起動をオフさせる。例えばACアダプター50が接続された場合、その接続を検出した制御IC22がCPU24の起動を停止させる。そして、電源がUSB経由のホスト装置30からACアダプター50に切り替えられ、以後、ACアダプター50を介して供給される電力で二次電池14への充電が行われる。そして、充電起動オフ後、充電起動オフ中の処理の一つであるステップS26に進む。 Furthermore, when the USB charge termination condition is satisfied in step S20, the process proceeds to step S23, and the power activation of the CPU 24 and the control IC 22 is turned off to turn off the charging activation. Here, the USB charging termination condition refers to a condition for terminating the charging of the secondary battery 14 while maintaining the USB connection with the host device 30 through the USB cable 35. (1) The secondary battery 14 is fully charged. (2) The condition is that a power adapter such as the AC adapter 50 that is prioritized as a power source for charging over the host device 30 is connected. Here, the control IC 22 monitors the remaining amount of the secondary battery 14 during charging, and when the secondary battery 14 is fully charged, the secondary battery 14 is charged by turning off the first switch 26. Terminate. The control IC 22 notifies the CPU 24 that the secondary battery 14 is fully charged. When either one of these two conditions is satisfied, USB charging to the secondary battery 14 is stopped and charging activation is turned off. For example, when the AC adapter 50 is connected, the control IC 22 that detects the connection stops the activation of the CPU 24. Then, the power source is switched from the host device 30 via USB to the AC adapter 50, and thereafter, the secondary battery 14 is charged with power supplied via the AC adapter 50. Then, after the charge activation is turned off, the process proceeds to step S26 which is one of the processes during the charge activation off.
一方、充電起動オフ(S17)後においては、ステップS24で電源ON操作があったか否かの判断と、ステップS25でUSBケーブルが抜かれたか否かの判断と、ステップS26でUSB充電開始条件が成立したか否かの判断とを、このうち1つの判断処理で肯定判定が得られるまで繰り返し実行する。例えばステップS24で電源ON操作があれば、ステップS21に進んで、充電中の電源オン操作時と同様の電源ON処理を行い、さらにステップS22でUSB再接続処理を行った後、その処理を電源ON時のUSB通信処理ルーチンへ移行させる。 On the other hand, after the charging activation is turned off (S17), it is determined whether or not the power is turned on in step S24, whether or not the USB cable is disconnected in step S25, and the USB charging start condition is satisfied in step S26. Is repeatedly executed until an affirmative determination is obtained in one of the determination processes. For example, if there is a power-on operation in step S24, the process proceeds to step S21 to perform the power-on process similar to that during the power-on operation during charging, and after performing the USB reconnection process in step S22, Shift to the USB communication processing routine when ON.
また、ステップS25で、USBケーブルが抜かれた場合(肯定判定)は、ステップS27に進んで、メモリー25を成功の旨の値に書き替え、その後、当該ルーチンを終了する。ここで、メモリー25を成功の旨の値に書き替えるのは、USBケーブル35が抜かれたことで、次にUSB接続されたときのホスト装置30が変更される可能性があるため、ホスト装置30が変更されれば初期処理が成功する可能性が高いので、バスパワーによる初期処理を試行できるようにするためである。 If the USB cable is unplugged in step S25 (positive determination), the process proceeds to step S27, the memory 25 is rewritten with a value indicating success, and then the routine ends. Here, the reason why the memory 25 is rewritten to a value indicating success is that the host device 30 may be changed when the USB connection is made next because the USB cable 35 is disconnected. This is because the initial processing by the bus power can be tried because there is a high possibility that the initial processing will be successful if is changed.
さらにステップS26で、USB充電開始条件が成立すると、ステップS28に進んで、CPU24及び制御IC22の電源をオフにすることで、充電起動をオフにする。ここで、USB充電開始条件とは、USBケーブル35を通じたホスト装置30とのUSB接続が維持されたまま充電起動オフ状態の下で、二次電池14の充電を開始させる条件を指す。このUSB充電開始条件には、(3)二次電池14の残量が満充電より所定レベル少ない値に設定された閾値(例えば満充電の90〜99%の範囲内の所定値(%))を下回ったこと、(4)ホスト装置30よりも充電の電源として優先されるACアダプター50等の電源アダプターの接続が外されたことが、その条件として挙げられる。これらの二条件のうちいずれか一方が成立すると、ステップS28に進む。 Further, when the USB charging start condition is satisfied in step S26, the process proceeds to step S28, and the power activation of the CPU 24 and the control IC 22 is turned off to turn off the charging activation. Here, the USB charging start condition refers to a condition for starting the charging of the secondary battery 14 under the charging start-off state while the USB connection with the host device 30 through the USB cable 35 is maintained. The USB charge start condition includes (3) a threshold value (for example, a predetermined value (%) within a range of 90 to 99% of full charge) where the remaining amount of the secondary battery 14 is set to a value lower than the full charge by a predetermined level. And (4) that the power adapter such as the AC adapter 50, which has priority over the host device 30 as a power source for charging, is disconnected. If one of these two conditions is satisfied, the process proceeds to step S28.
そして、ステップS28では、制御IC22及びCPU24を起動させることで、充電起動をオンさせる(充電起動オン)。この充電起動オンの後、S11に戻る。つまり、当該ルーチンの終了前にCPU24を起動状態にすることで、CPU24が充電開始条件の成立に基づく当該ルーチンを再び開始することができる。このようにUSB充電終了条件の成立後(S20で肯定判定)、USBケーブル35が抜かれることなくホスト装置30との接続を継続する状態で、USB充電開始条件が成立して充電起動し(S26,S28)、次のステップS13でプルアップすることで、プリンター11はホスト装置30と再接続することになる。 In step S28, the control IC 22 and the CPU 24 are activated to turn on the charging activation (charging activation on). After this charging activation is turned on, the process returns to S11. That is, by setting the CPU 24 to the activated state before the end of the routine, the CPU 24 can start the routine again based on the establishment of the charging start condition. As described above, after the USB charging end condition is satisfied (Yes in S20), the USB charging start condition is satisfied and the charging is started in a state where the connection with the host device 30 is continued without disconnecting the USB cable 35 (S26). , S28), and pulling up in the next step S13, the printer 11 is reconnected to the host device 30.
例えばUSBケーブル35を通じたホスト装置30とのUSB接続を維持したまま、メモリー25に失敗の旨の値が書き込まれた状態で、上記の充電処理ルーチンを終了した場合は、次の処理が行われる。すなわち、ステップS12におけるメモリーの値が失敗なので、初期処理(S14)に進むことなく、充電起動をオフする(S17)。 For example, when the above charging processing routine is completed in a state in which a value indicating failure is written in the memory 25 while maintaining the USB connection with the host device 30 through the USB cable 35, the following processing is performed. . That is, since the memory value in step S12 is unsuccessful, the charging activation is turned off without proceeding to the initial process (S14) (S17).
つまりUSBケーブル35が抜かれていない場合は、USB接続の接続相手は、前回の初期処理実施時のホスト装置30と同じになる。そのため、前回失敗であれば、今回も失敗になるので、前回の初期処理で失敗した旨がメモリーに保存されていれば、バスパワーを要求する第1初期処理を行わず充電起動をオフする。このため、無駄な初期処理の実行に伴う電力の浪費及び二次電池14の残量低減を抑制することができる。 That is, when the USB cable 35 is not disconnected, the USB connection partner is the same as the host device 30 at the time of the previous initial processing. Therefore, if the previous failure occurs, this time also fails. If the fact that the previous initial processing has failed is stored in the memory, the charge activation is turned off without performing the first initial processing that requests bus power. For this reason, it is possible to suppress the waste of power and the reduction in the remaining amount of the secondary battery 14 due to the execution of useless initial processing.
一方、USBケーブル35が抜かれた場合は、次にUSB接続の検出時の接続相手は、USBケーブル35が抜かれたときと異なるホスト装置30である可能性がある。仮に前回のホスト装置30で初期処理に失敗していても、USBケーブル35が前回抜かれたときにメモリー25(第2記憶領域25B)の値が「失敗」から「成功」の旨の値に書き替えられる(S27)。このため、その後、当該ルーチン再開後のステップS12で成功の旨の値であることから、プルアップ(S13)を経て進んだステップS14において、バスパワーを要求する第1初期処理を実行することができる。このため、接続相手が前回と異なるホスト装置30であって、バスパワーかつ第2電力が許可されれば、バスパワーで供給された第2電力(電流値で500mA)で二次電池14を充電することができる。 On the other hand, when the USB cable 35 is disconnected, there is a possibility that the connection partner when the USB connection is detected next is the host device 30 different from that when the USB cable 35 is disconnected. Even if the initial processing failed in the previous host device 30, the value of the memory 25 (second storage area 25B) is written from “failure” to “success” when the USB cable 35 is disconnected last time. It is replaced (S27). For this reason, after that, since the value indicates success in step S12 after the routine is restarted, the first initial process for requesting bus power may be executed in step S14 that has proceeded through the pull-up (S13). it can. For this reason, if the connection partner is a host device 30 different from the previous one and the bus power and the second power are permitted, the secondary battery 14 is charged with the second power (500 mA in current value) supplied with the bus power. can do.
また、初期処理を失敗したときのホスト装置30とUSBケーブル35を通じて接続された状態で電源ON操作されてプリンター11が起動したときは、メモリー25(第2記憶領域25B)の値は「失敗」の旨の値のままとなる。また、初期処理を成功したときのホスト装置30とUSBケーブル35を通じて接続された状態で電源ON操作されてプリンター11が起動したときは、メモリー25(第2記憶領域25B)の値は「成功」の旨の値となる。 Further, when the printer 11 is started by turning on the power while being connected to the host device 30 via the USB cable 35 when the initial processing has failed, the value of the memory 25 (second storage area 25B) is “failed”. The value to the effect remains. Further, when the printer 11 is activated by turning on the power while connected to the host device 30 via the USB cable 35 when the initial processing is successful, the value of the memory 25 (second storage area 25B) is “success”. It becomes the value of the effect.
次に図10を参照して、電源ON時のUSB通信処理ルーチンについて説明する。ユーザーが電源スイッチ20Aを操作してUSBケーブル35を介してホスト装置30と接続しているプリンター11の電源をオンした際に、CPU24は図10に示すUSB通信処理ルーチンを実行する。また、プリンター11の電源がオン状態でUSB接続していないときに、USBが接続された際にも、CPU24は図10に示すUSB通信処理ルーチンを実行する。プリンター11が電源オン状態にあるとき、ユーザーはホスト装置30の入力装置(図示せず)を操作して印刷を指示すると、印刷データがホスト装置30からUSBケーブル35を通じてプリンター11へ送信される。但し、ホスト装置からの指示でプリンター11に印刷させるためには、初期処理が成功して両者の間でUSB通信が確立される必要がある。 Next, a USB communication processing routine when the power is turned on will be described with reference to FIG. When the user operates the power switch 20A to turn on the printer 11 connected to the host apparatus 30 via the USB cable 35, the CPU 24 executes the USB communication processing routine shown in FIG. Further, when the printer 11 is powered on and not connected by USB, the CPU 24 also executes the USB communication processing routine shown in FIG. 10 when the USB is connected. When the user operates the input device (not shown) of the host device 30 to instruct printing when the printer 11 is in the power-on state, print data is transmitted from the host device 30 to the printer 11 through the USB cable 35. However, in order to cause the printer 11 to print in accordance with an instruction from the host device, it is necessary that the initial processing is successful and USB communication is established between the two.
まずステップS41〜43は、図8におけるステップS11〜S13と同様の処理である。すなわち、ステップS41で、ユーザー設定が、バスパワーであるかセルフパワーであるかを判断する。詳しくは、CPU24はメモリー25の第1記憶領域25Aに格納された値に基づいてユーザー設定されたパワーモードがバスパワーかセルフパワーかを判断する。ユーザー設定がバスパワーである場合はステップS42に進み、セルフパワーの場合はステップS44に進む。 First, steps S41 to S43 are the same processes as steps S11 to S13 in FIG. That is, in step S41, it is determined whether the user setting is bus power or self power. Specifically, the CPU 24 determines whether the power mode set by the user is bus power or self power based on the value stored in the first storage area 25A of the memory 25. If the user setting is bus power, the process proceeds to step S42. If the user setting is self power, the process proceeds to step S44.
ここで、ユーザーがセルフパワーを設定する目的の一つは、ホスト装置30がハブ60を介してプリンター11と接続されて第2電力(電流値で例えば500mA)での電力供給ができない場合でも、セルフパワーで初期処理を行って、電源ON時にUSB通信を確立し、ホスト装置30からの印刷データに基づく印刷をできるようにすることにある。但し、本実施形態では、ユーザー設定がバスパワーであっても、初期処理の失敗を検出してバスパワーからセルフパワーに切り替える制御を採用している。 Here, one of the purposes for the user to set self-power is that even when the host device 30 is connected to the printer 11 via the hub 60 and cannot supply power at the second power (for example, 500 mA in current value), It is to perform initial processing by self-power, establish USB communication when the power is turned on, and enable printing based on print data from the host device 30. However, in the present embodiment, even when the user setting is bus power, the control for detecting the failure of the initial process and switching from the bus power to the self power is adopted.
ステップS42では、メモリー25(第2記憶領域25B)の値が成功であるか否かを判断する。「成功」の旨の値(例えば「1」)であればステップS43に進み、成功の旨の値でなければ(つまり失敗の旨の値(例えば「0」)であれば)、ステップS44に進む。 In step S42, it is determined whether or not the value of the memory 25 (second storage area 25B) is successful. If the value is “success” (eg, “1”), the process proceeds to step S43. If the value is not success (ie, if the value is failure (eg, “0”)), the process proceeds to step S44. move on.
ステップS43では、プルアップを行う。すなわち、CPU24は、データ線D+,D−の電圧を変動させてプルアップを行う。このプルアップによりホスト装置30はUSBデバイス11A(プリンター11)の接続を検出し、初期処理(エニュメレーション)(図2、図3を参照)を開始する。 In step S43, pull-up is performed. That is, the CPU 24 performs pull-up by changing the voltages of the data lines D + and D−. By this pull-up, the host device 30 detects the connection of the USB device 11A (printer 11) and starts an initial process (enumeration) (see FIGS. 2 and 3).
次のステップS45では、バスパワーを要求する初期処理(第1初期処理)を実行し、その初期処理が成功したか否かを判断する。このステップS45の処理は、CPU24が図9にフローチャートで示す初期処理ルーチンを実行することにより行われ、その詳細は以下のように行われる。 In the next step S45, an initial process (first initial process) for requesting bus power is executed, and it is determined whether or not the initial process is successful. The processing in step S45 is performed by the CPU 24 executing an initial processing routine shown in the flowchart of FIG. 9, and details thereof are performed as follows.
まず図9のステップS31において、タイマーの計時を開始する。すなわち、CPU24はタイマー24Aに計時を開始させる。この結果、タイマー24AはCPU24の起動時点(正確にはプルアップ時点)からの経過時間(計時時間T)を計時する。なお、タイマー24Aによる計時開始処理(S31)とプルアップ処理(S13)との順番は逆でもよい。 First, in step S31 of FIG. 9, timer timing is started. That is, the CPU 24 causes the timer 24A to start measuring time. As a result, the timer 24A measures the elapsed time (timed time T) from the starting point of the CPU 24 (more precisely, the pull-up point). Note that the order of the timing start process (S31) and the pull-up process (S13) by the timer 24A may be reversed.
ステップS32では、バスパワーを要求する初期処理(第1初期処理)を行う。ここで、CPU24は、ホスト装置30からの要求に対してディスクリプターと呼ばれる構成情報を送信する。このとき、プリンター11の電源オン中は印刷が行われることを前提とするため、プリンタークラスが用いられる。CPU24は、プリンタークラスを指定し、バスパワーで第2電力(電流値で例えば500mA)を要求する構成情報をホスト装置30に応答する。ホスト装置30は、構成情報中のクラス情報がプリンタークラスであることから、USBデバイス11Aをプリンターと認識する。このため、ホスト装置30は、印刷要求を受け付ければ、印刷データをUSB通信を通じてプリンター11へ送信する。 In step S32, an initial process (first initial process) for requesting bus power is performed. Here, the CPU 24 transmits configuration information called a descriptor in response to a request from the host device 30. At this time, since it is assumed that printing is performed while the printer 11 is powered on, the printer class is used. The CPU 24 specifies the printer class, and responds to the host device 30 with configuration information for requesting the second power (for example, 500 mA in current value) with the bus power. The host device 30 recognizes the USB device 11A as a printer because the class information in the configuration information is a printer class. For this reason, when receiving a print request, the host device 30 transmits print data to the printer 11 through USB communication.
この第1初期処理は、電源ON時も電源0FF時と同様に、図2に示すように行われる。プルアップによりUSB接続が検出されると、ホスト装置30とプリンター11との間で初期処理としてエニュメレーションが開始される。ホスト装置30から「GetDescriptor」を受信すると、プリンター11は、クラス情報(例えば「プリンター」)、パワーモード情報(「バスパワー」)及び要求電力情報(「第2電力(例えば500mA)」)を含む構成情報(ディスクリプター)を送信する。 This first initial process is performed as shown in FIG. 2 when the power is turned on, as in the case of the power supply 0FF. When USB connection is detected by pull-up, enumeration is started between the host device 30 and the printer 11 as an initial process. Upon receiving “GetDescriptor” from the host device 30, the printer 11 includes class information (eg, “printer”), power mode information (“bus power”), and required power information (“second power (eg, 500 mA)”). Send configuration information (descriptor).
ホスト装置30は、プリンター11から受信した構成情報に基づき、要求された条件でUSB通信接続を許可しうるか否かを判断する。そして、ホスト装置30は、バスパワーかつ第2電力で電源供給が可能と判断すれば、プリンター11の構成情報をメモリーに書き込んでデバイス構成等を設定するとともに、図2に示すように、プリンター11へ初期処理完了通知「SetConfiguration」を送信する。 Based on the configuration information received from the printer 11, the host device 30 determines whether the USB communication connection can be permitted under the requested conditions. If the host device 30 determines that the power can be supplied with bus power and the second power, the configuration information of the printer 11 is written in the memory to set the device configuration and the printer 11 as shown in FIG. An initial processing completion notification “SetConfiguration” is sent to
一方、図4に示すように、ホスト装置30とプリンター11とがバスパワーハブ経由で接続されている場合、プリンター11が、バスパワーかつ第2電力を含む構成情報を送信しても、ホスト装置30はハブ経由との認識から、要求された第2電力での電源供給が不可能と判断し、USB通信の確立を許可しない。この場合、図3に示すように、ホスト装置30からプリンター11へ初期処理完了通知「SetConfiguration」は送信されない。よって、プリンター11は、ホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」を、起動状態のまま待機することになる。この待機中は、起動中のCPU24によって電力が浪費される。 On the other hand, as shown in FIG. 4, when the host device 30 and the printer 11 are connected via a bus power hub, even if the printer 11 transmits configuration information including bus power and second power, the host device 30 recognizes that it is via the hub and determines that power supply with the requested second power is impossible, and does not permit establishment of USB communication. In this case, as shown in FIG. 3, the initial processing completion notification “SetConfiguration” is not transmitted from the host device 30 to the printer 11. Therefore, the printer 11 waits for the initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30 in the activated state. During this standby, power is wasted by the activated CPU 24.
また、ホスト装置30がバッテリー駆動時に、USBデバイス11Aへの供給電力が制限されている場合、プリンター11から要求された第2電力(電流値で500mA)を許可できない。この場合も、プリンター11内のCPU24は、ホスト装置30から送信されることのない初期処理完了通知「SetConfiguration」を起動状態のまま待機することになり、電力を浪費する。これらの場合、初期処理完了通知が送られてくるまでの待機中に、ホスト装置30からUSBケーブル35を通じて第1電力(電流値で100mA)が供給されるものの、起動中のCPU24が初期処理で消費する電力が第1電力を上回る場合、二次電池14の残量が徐々に低下してしまう。 In addition, when the host device 30 is driven by a battery and the power supplied to the USB device 11A is limited, the second power (500 mA in current value) requested from the printer 11 cannot be permitted. Also in this case, the CPU 24 in the printer 11 waits for the initial processing completion notification “SetConfiguration” that is not transmitted from the host device 30 in the activated state, and wastes power. In these cases, the first power (100 mA in current value) is supplied from the host device 30 through the USB cable 35 during standby until the notification of completion of the initial process is sent, but the activated CPU 24 is in the initial process. When the consumed power exceeds the first power, the remaining amount of the secondary battery 14 gradually decreases.
ステップS33では、初期処理完了通知を受信したか否かを判断する。そして、CPU24は、初期処理完了通知を受信しなければステップS34に進み、初期処理完了通知を受信して初期処理が成功すればステップS46(図10)へ進む。 In step S33, it is determined whether an initial processing completion notification has been received. If the CPU 24 does not receive the initial process completion notification, the process proceeds to step S34. If the initial process completion notification is received and the initial process is successful, the CPU 24 proceeds to step S46 (FIG. 10).
ステップS34では、タイムアウトになったか否かを判断する。すなわち、タイマー24Aの計時時間Tがタイムアウト時間T1に達したか否かを判断する。タイムアウトでなければステップS33に戻る。こうして初期処理完了通知を受信して初期処理を成功するか(S33で肯定判定)、タイムアウトになって初期処理を失敗する(S34で肯定判定)まで、ステップS33,S34の処理を繰り返し実行する。タイムアウトになって初期処理に失敗した場合は、ステップS47(図10)へ進む。 In step S34, it is determined whether or not a timeout has occurred. That is, it is determined whether or not the time T of the timer 24A has reached the timeout time T1. If not timed out, the process returns to step S33. The processes in steps S33 and S34 are repeatedly executed until the initial process completion notification is received in this way until the initial process is successful (Yes in S33) or until the time-out occurs and the initial process fails (Yes in S34). If time-out occurs and the initial process fails, the process proceeds to step S47 (FIG. 10).
図10に戻って、上記のステップS45の処理(図9)において、初期処理完了通知を受信して初期処理を成功した場合はステップS46に進み、一方、初期処理完了通知を受信する前にタイムアウトとなって初期処理を失敗した場合はステップS47に進むことになる。 Returning to FIG. 10, in the process of step S45 (FIG. 9), if the initial process completion notification is received and the initial process is successful, the process proceeds to step S46, and on the other hand, a timeout occurs before the initial process completion notification is received. If the initial process fails, the process proceeds to step S47.
ステップS46では、バスパワーでUSB通信処理を行う。ここで、USB通信処理とは、電源オン中のプリンター11がホスト装置30とUSB通信を介して行う処理を指し、例えば印刷処理やインク残量通知を含む各種の通知処理等が含まれる。このとき、バスパワーで供給される第2電力(電流値で500mA)を用いて印刷処理などのUSB通信処理が行われる。なお、第2電力のうちUSB通信処理で使用されない余りの電力があれば、その余りの電力を電源ON中における二次電池14の充電に使用してもよい。 In step S46, USB communication processing is performed with bus power. Here, the USB communication processing refers to processing performed by the printer 11 that is powered on via USB communication with the host device 30 and includes various notification processing including printing processing and ink remaining amount notification, for example. At this time, USB communication processing such as printing processing is performed using second power (current value: 500 mA) supplied by bus power. If there is a surplus power that is not used in the USB communication process in the second power, the surplus power may be used for charging the secondary battery 14 while the power is on.
一方、初期処理に失敗した場合は、ステップS47において、メモリーに失敗の旨の値を書き込み、セルフパワーに切り替える。CPU24はメモリー25の第2記憶領域25Bに、例えば図6(b)に示すように失敗の旨の値(例えば「0」)を書き込む。CPU24は、以後、メモリー25の値を参照して成功か失敗かを判定するので(S42)、このメモリー25の失敗の旨の値への書替えによって、バスパワーからセルフパワーに切り替えられる。なお、ステップS45において初期処理に成功した場合は、そのときメモリー25の第2記憶領域25Bに初期設定時の成功の旨の値(初期値(例えば「1」))が格納されているので、特に書き替えは行わない。もちろん、メモリー25に成功の旨の値を書き込んでもよい。 On the other hand, if the initial process fails, in step S47, a value indicating failure is written in the memory, and the mode is switched to self power. The CPU 24 writes a value indicating failure (for example, “0”) in the second storage area 25B of the memory 25 as shown in FIG. 6B, for example. Thereafter, the CPU 24 refers to the value of the memory 25 to determine success or failure (S42), so that the bus power is switched to the self power by rewriting to the value indicating the failure of the memory 25. If the initial process is successful in step S45, the value indicating the initial setting success (initial value (eg, “1”)) is stored in the second storage area 25B of the memory 25 at that time. There is no particular rewriting. Of course, a value indicating success may be written in the memory 25.
次のステップS48では、USB再接続処理を行う。すなわち、プルアップ状態を一旦解除した後、再びプルアップする。これによりUSBケーブル35が接続されたまま、ホスト装置30のUSBホスト30AがUSBデバイス11Aとの接続(USB接続)を検出する。この結果、ホスト装置30はプリンター11との間で初期処理を行うことが可能になる。 In the next step S48, USB reconnection processing is performed. That is, the pull-up state is once canceled and then pulled up again. As a result, the USB host 30A of the host device 30 detects the connection (USB connection) with the USB device 11A while the USB cable 35 is connected. As a result, the host device 30 can perform initial processing with the printer 11.
こうしてユーザー設定がセルフパワーである場合(S41)、メモリー25の値が失敗の旨の値である場合(S42で否定判定)、バスパワー要求時の初期処理を失敗した場合(S45で否定判定)は、共にプルアップ(S44又はS48)の後、ステップS49に進むことになる。 Thus, when the user setting is self-power (S41), when the value of the memory 25 is a value indicating failure (No determination at S42), when initial processing at the time of bus power request fails (No determination at S45). Are both pulled up (S44 or S48) and then proceed to step S49.
次のステップS49では、セルフパワーを要求する初期処理(第2初期処理)を実行する。
ここで、CPU24は、ホスト装置30からの要求に対して、プリンタークラスを指定し、セルフパワーを要求する構成情報をホスト装置30に応答する。このセルフパワー要求時の初期処理は、バスパワー要求時の初期処理と同様に、図2に示すように行われる。プルアップによりUSB接続が検出されてホスト装置30とプリンター11との間で初期処理が開始されると、プリンター11は、ホスト装置30からの要求「GetDescriptor」に対し、クラス情報「プリンタークラス」、パワーモード情報「セルフパワー」及び要求電力情報(例えば0〜10mAの範囲内の値)を含む構成情報を応答する。
In the next step S49, an initial process for requesting self-power (second initial process) is executed.
Here, the CPU 24 specifies a printer class in response to a request from the host device 30 and responds to the host device 30 with configuration information for requesting self-power. Similar to the initial process at the time of requesting bus power, the initial process at the time of requesting self-power is performed as shown in FIG. When the USB connection is detected by the pull-up and the initial process is started between the host device 30 and the printer 11, the printer 11 responds to the request “GetDescriptor” from the host device 30 with class information “printer class”, It responds with configuration information including power mode information “self power” and required power information (for example, a value in the range of 0 to 10 mA).
ホスト装置30は、プリンター11から受信した構成情報に基づき、要求された条件でUSB通信接続を許可しうるか否かを判断し、セルフパワーなので、USB通信の確立を許可する。ホスト装置30は、プリンター11の構成情報をメモリーに書き込んでデバイス構成等を設定するとともに、図2に示すように、プリンター11へ初期処理完了通知「SetConfiguration」を送信する。この結果、初期処理は成功する。また、ホスト装置30は、構成情報中のクラス情報がプリンタークラスであることから、USBデバイス11Aをプリンターと認識する。このため、ホスト装置30は、印刷要求を受け付ければ、印刷データをプリンター11へ送信する。 Based on the configuration information received from the printer 11, the host device 30 determines whether or not the USB communication connection can be permitted under the requested conditions, and permits the establishment of USB communication because it is self-powered. The host device 30 writes the configuration information of the printer 11 in the memory to set the device configuration and the like, and transmits an initial processing completion notification “SetConfiguration” to the printer 11 as shown in FIG. As a result, the initial process is successful. Further, since the class information in the configuration information is the printer class, the host device 30 recognizes the USB device 11A as a printer. Therefore, the host device 30 transmits print data to the printer 11 when a print request is received.
ステップS50では、セルフパワーでUSB通信処理を行う。セルフパワーなので、ホスト装置30からの電源供給がないものの、ホスト装置30から印刷データを受信すれば、その印刷データに基づく印刷処理をUSB通信処理の一つとして行う。このとき、プリンター11は、ACアダプター50等の電源アダプターと接続されていれば、電源アダプターを通じて供給される電力で印刷動作を行い、電源アダプターと接続されていなければ、二次電池14の電力で印刷動作を行う。 In step S50, USB communication processing is performed with self power. Since it is self-powered, there is no power supply from the host device 30, but if print data is received from the host device 30, a print process based on the print data is performed as one of the USB communication processes. At this time, if the printer 11 is connected to a power adapter such as the AC adapter 50, the printer 11 performs a printing operation with the power supplied through the power adapter, and if not connected to the power adapter, the printer 11 uses the power of the secondary battery 14. Perform the printing operation.
このように、当初、バスパワーを要求する第1初期処理を行って、その初期処理に失敗すれば、セルフパワーに切り替え、セルフパワーを要求する第2初期処理を行うので、プリンター11とホスト装置30とのUSB通信を確立することができる。このため、ユーザーはホスト装置30からの指示でプリンター11に印刷処理を行わせることができる。例えば、第1初期処理を行って初期処理完了通知を受信できず、CPU24が待機状態になった場合、いつまで経ってもUSB通信が接続されないので、ユーザーはホスト装置30からの指示でプリンター11に印刷処理を行わせることができない。 As described above, when the first initial process for requesting the bus power is initially performed and the initial process fails, the self-power is switched to and the second initial process for requesting the self-power is performed. USB communication with 30 can be established. For this reason, the user can cause the printer 11 to perform print processing in accordance with an instruction from the host device 30. For example, when the first initial processing is performed and the initial processing completion notification cannot be received and the CPU 24 is in a standby state, the USB communication is not connected any time, and the user instructs the printer 11 by an instruction from the host device 30. The printing process cannot be performed.
しかし、本実施形態によれば、初期処理の失敗時にセルフパワーに切り替えて、再度、初期処理を行うので、プリンター11とホスト装置30とをより確実にUSB接続させることができる。この結果、印刷できない不都合を回避し、ホスト装置30からの指示でプリンター11に印刷させることができる。 However, according to the present embodiment, when the initial process fails, the self-power is switched and the initial process is performed again, so that the printer 11 and the host device 30 can be more reliably connected by USB. As a result, it is possible to avoid the inconvenience that cannot be printed, and to cause the printer 11 to print according to an instruction from the host device 30.
また、電源OFF中の充電処理でバスパワーを要求する第1初期処理に失敗した場合、その失敗の旨の値をメモリー25に保存し、その後、電源ON時にメモリー25から読み出した値が失敗の旨の値であれば、セルフパワーを要求する第2初期処理を行う。このため、一旦、第1初期処理を行って、失敗したらセルフパワーに切り替えて第2初期処理を再度行う手順をとる場合に比べ、プリンター11とホスト装置30とのUSB通信をより速やかに確立することができる。よって、ユーザーはUSBケーブルを通じてプリンター11とホスト装置30とを接続した後、比較的速やかにホスト装置30から指示した印刷をプリンター11に行わせることができる。 In addition, when the first initial process for requesting bus power fails during the charging process while the power is turned off, a value indicating the failure is stored in the memory 25, and then the value read from the memory 25 when the power is turned on is a failure. If it is the value of the effect, the 2nd initial processing which requests | requires self power is performed. For this reason, the USB communication between the printer 11 and the host device 30 is established more quickly than when the first initial process is performed once and the procedure for switching to the self-power and performing the second initial process again is performed. be able to. Therefore, the user can cause the printer 11 to perform printing instructed from the host device 30 relatively quickly after connecting the printer 11 and the host device 30 via the USB cable.
このUSB通信処理中において、CPU24は次の処理を行う。すなわち、USB通信処理中においては、ステップS51で電源OFF操作があったか否かの判断、ステップS52でUSBケーブルが抜かれたか否かの判断を、このうち1つの判断処理で肯定判定が得られるまで繰り返し実行する。例えばステップS51で電源ON操作があれば、ステップS53に進んで電源OFF処理を行う。すなわち、電源スイッチ20Aの操作で第2スイッチ27のオンを検知すると、CPU24は制御IC22に指示して第3スイッチ28を遮断させる。また、二次電池14を電源としていた場合は、CPU24は制御IC22に指示して第1スイッチ26も遮断させる。この電源OFF処理の終了後、CPU24は、その処理を、電源OFF時の充電処理ルーチンへ移行させる。 During the USB communication process, the CPU 24 performs the following process. That is, during the USB communication process, the determination as to whether or not the power supply has been turned off at step S51 and the determination as to whether or not the USB cable has been disconnected at step S52 are repeated until an affirmative determination is obtained in one of these determination processes. Run. For example, if there is a power ON operation in step S51, the process proceeds to step S53 to perform power OFF processing. That is, when the ON state of the second switch 27 is detected by operating the power switch 20A, the CPU 24 instructs the control IC 22 to shut off the third switch 28. Further, when the secondary battery 14 is used as a power source, the CPU 24 instructs the control IC 22 to cut off the first switch 26 as well. After the end of the power OFF process, the CPU 24 shifts the process to a charging process routine when the power is OFF.
また、ステップS52で、USBケーブルが抜かれた場合(肯定判定)は、ステップS54に進んで、メモリーを「成功」の旨の値に書き替えた後、当該ルーチンを終了する。この後は、プリンター11は、ACアダプター50等の電源アダプターと接続されていれば、電源アダプターを通じて供給される電力で印刷動作を行い、電源アダプターと接続されていなければ、二次電池14の電力で印刷動作を行う。また、このとき、USBケーブル35が抜かれることで、プリンター11とホスト装置30とのUSB通信は遮断される。このため、USBケーブルが抜かれてホスト装置30との接続が途絶えた後に、ホスト装置30とUSB接続されたときには、再開されたUSB通信処理ルーチン(図10)で、メモリーの値が「成功」(S42で肯定判定)なので、バスパワーを要求する第1初期処理(S45)が行われる。 In step S52, if the USB cable is disconnected (affirmative determination), the process proceeds to step S54, the memory is rewritten with a value indicating “success”, and then the routine ends. Thereafter, if the printer 11 is connected to a power adapter such as the AC adapter 50, the printer 11 performs a printing operation with power supplied through the power adapter, and if not connected to the power adapter, the power of the secondary battery 14 is displayed. Perform printing operation with. At this time, the USB communication between the printer 11 and the host device 30 is blocked by disconnecting the USB cable 35. For this reason, when the USB cable is disconnected and the connection with the host device 30 is interrupted and then the USB connection is established with the host device 30, the memory value is set to “success” in the resumed USB communication processing routine (FIG. 10). Since an affirmative determination is made in S42, first initial processing (S45) for requesting bus power is performed.
また、USBケーブル35が抜かれることなくホスト装置30との接続を継続する状態で(S52で否定判定)、電源OFF操作があった場合(S51で肯定判定)は、電源OFF処理(S53)の後に、電源OFF時の充電処理ルーチン(図8)へ移行する。これによりプルアップ(S13)によってホスト装置30とプリンター11とが再接続され、メモリーの値がこの電源OFFになる前の前回の電源オン状態で第1初期処理を完了した「成功」であれば、第1初期処理を行い(S45)、一方、第1初期処理を失敗し第2初期処理を行っていた「失敗」であれば、充電は行われない(S17)。 Further, when the connection with the host device 30 is continued without disconnecting the USB cable 35 (No determination in S52), and there is a power-off operation (Yes determination in S51), the power-off process (S53) is performed. Later, the process proceeds to a charging process routine (FIG. 8) when the power is turned off. As a result, if the host device 30 and the printer 11 are reconnected by the pull-up (S13), and the memory value is “successful” in which the first initial processing is completed in the previous power-on state before the power-off. The first initial process is performed (S45). On the other hand, if the first initial process fails and the second initial process is “failed”, charging is not performed (S17).
バスパワーを要求する初期処理を失敗してセルフパワーで初期処理を行ってUSB通信が確立された状態でUSBケーブル35が接続されたまま電源OFFされた場合、メモリー25には失敗の旨の値が保存されている。このため、図8に示す電源OFF時の充電処理ルーチンにおいて、メモリー25の値が失敗の旨の値なので(S12で否定判定)、充電起動をオフにする(S17)。このとき、プリンター11の電源ON中のUSB通信処理を目的とする初期処理の失敗の旨の情報を利用するので、第1初期処理を試行することなく充電起動をオフさせる。例えば第1初期処理を行った際に、送られてくることのない初期処理完了通知をタイムアウトになるまで待ち続けることによるCPU24の電力の浪費及び二次電池14の残量の低減を抑制することができる。 If the initial process for requesting bus power fails, the initial process is performed with self-power, and the USB cable 35 is connected and the power is turned off while the USB cable 35 is connected, the memory 25 indicates a value indicating failure. Is saved. For this reason, in the charging processing routine at the time of power OFF shown in FIG. 8, since the value of the memory 25 is a value indicating failure (No in S12), the charging activation is turned off (S17). At this time, since the information indicating the failure of the initial processing for the purpose of the USB communication processing while the printer 11 is turned on is used, the charging activation is turned off without trying the first initial processing. For example, when the first initial process is performed, it is possible to suppress the waste of power of the CPU 24 and the reduction of the remaining amount of the secondary battery 14 by continuing to wait for an initial process completion notification that is not sent until a timeout occurs. Can do.
以上詳述した本実施形態によれば、以下に示す効果を得ることができる。
(1)制御回路13は、電源スイッチ20Aがオフ状態でUSBコネクター12が接続している相手がUSBバッテリーチャージャー40(第1の装置の一例)であれば、初期処理(エニュメレーション)を行わずにUSBコネクター12が受け取った電力で二次電池14を充電する。また、USBコネクター12が接続している相手がホスト装置30(第2の装置の一例)であれば、制御回路13は初期処理を行い、初期処理が完了した後に、二次電池14を充電する。一方、USBコネクター12が接続している相手がホスト装置30であり、初期処理に失敗したときは、二次電池14の充電を行わない。よって、電源スイッチ20Aがオフ状態でUSBコネクター12が接続している相手がホスト装置30であり、初期処理に失敗したときは、制御回路13(特にCPU24)の電源をオフすることができ、電池14への充電をその開始前に中止できる。このため、初期処理が失敗しても長時間に亘って制御回路13が起動状態のまま放置されることによる電気の浪費や電池14の残量の低減を抑制することができる。
According to the embodiment described in detail above, the following effects can be obtained.
(1) The control circuit 13 performs initial processing (enumeration) when the power switch 20A is in an OFF state and the other party to which the USB connector 12 is connected is the USB battery charger 40 (an example of the first device). Instead, the secondary battery 14 is charged with the power received by the USB connector 12. If the other party to which the USB connector 12 is connected is the host device 30 (an example of the second device), the control circuit 13 performs an initial process and charges the secondary battery 14 after the initial process is completed. . On the other hand, when the other party to which the USB connector 12 is connected is the host device 30 and the initial process fails, the secondary battery 14 is not charged. Therefore, when the power switch 20A is off and the USB connector 12 is connected to the host device 30 and the initialization process fails, the control circuit 13 (especially the CPU 24) can be turned off, and the battery 14 can be stopped before it starts. For this reason, even if the initial process fails, it is possible to suppress waste of electricity and reduction of the remaining amount of the battery 14 due to the control circuit 13 being left in the activated state for a long time.
(2)制御回路13は、USBコネクター12が接続している相手を判定する制御IC22(判定回路の一例)と、初期処理の少なくとも一部を実行するCPU24(処理回路の一例)とを備える。USBコネクター12が接続している相手がUSBバッテリーチャージャー40(第1の装置の一例)と判定すれば、CPU24を電源オフ状態に維持する。また、USBコネクター12が接続している相手がホスト装置30(第2の装置の一例)と判定すれば、CPU24を電源オン状態に移行させる。このため、電源オン状態に移行したCPU24はホスト装置30との間で初期処理を行うことができる。 (2) The control circuit 13 includes a control IC 22 (an example of a determination circuit) that determines a partner to which the USB connector 12 is connected, and a CPU 24 (an example of a processing circuit) that executes at least a part of the initial processing. If it is determined that the other party to which the USB connector 12 is connected is the USB battery charger 40 (an example of the first device), the CPU 24 is maintained in a power-off state. If it is determined that the other party to which the USB connector 12 is connected is the host device 30 (an example of a second device), the CPU 24 is shifted to the power-on state. Therefore, the CPU 24 that has shifted to the power-on state can perform initial processing with the host device 30.
(3)初期状態において電源スイッチ20Aがオン状態でUSBコネクター12がホスト装置30と接続した場合に、制御回路13は、第2初期処理(セルフパワーを要求する初期処理)よりも大きな供給電力の要求を含む第1初期処理(バスパワーを要求する初期処理)を行う。第1初期処理が完了(成功)したのちに、二次電池14に充電を行う。この充電は、第1初期処理が完了したのちに供給される相対的に大きな電力(第2電力)で行われる。つまり、この充電は、第2初期処理が完了したのちに供給される相対的に小さな電力(供給電力が零の場合も含む)よりも大きな電力(第2電力)の供給を受けて行われる。一方、制御回路13は、第1初期処理を完了できず失敗したときは、より小さな供給電力を要求する第2初期処理を行う。よって、第1初期処理に失敗したときでも、第2初期処理を完了することができる。従って、制御回路13は、USBコネクター12を介してホスト装置30と通信を確立することができる。また、第2初期処理を完了できた後は、その小さな供給電力を用いて二次電池14の充電は行われないので、供給電力が小さな割にプリンター11が印刷処理等の処理を行う電力が比較的確保され易い。 (3) In the initial state, when the power switch 20A is on and the USB connector 12 is connected to the host device 30, the control circuit 13 has a larger supply power than the second initial process (initial process requiring self-power). The first initial processing including the request (initial processing for requesting bus power) is performed. After the first initial process is completed (successful), the secondary battery 14 is charged. This charging is performed with relatively large power (second power) supplied after the completion of the first initial processing. That is, this charging is performed by receiving a supply of electric power (second electric power) larger than relatively small electric power (including the case where the supplied electric power is zero) supplied after the completion of the second initial process. On the other hand, when the control circuit 13 fails because the first initial process cannot be completed, the control circuit 13 performs a second initial process for requesting smaller supply power. Therefore, the second initial process can be completed even when the first initial process fails. Therefore, the control circuit 13 can establish communication with the host device 30 via the USB connector 12. In addition, since the secondary battery 14 is not charged using the small supply power after the second initial process is completed, the power for the printer 11 to perform processing such as the printing process is small although the supply power is small. It is relatively easy to secure.
(4)制御回路13は、第2初期処理を行った後、ホスト装置30との接続が継続している場合には、第1初期処理を行わずに第2初期処理を行う。一方、第2初期処理を行った後、ホスト装置30との接続が途絶えた後にホスト装置30と接続した場合には、初期状態に戻って第1初期処理を開始する。このようにそのホスト装置30が第1初期処理を一度失敗している同じ接続相手である場合、第1初期処理は行われず、第2初期処理が行われる。このため、制御回路13が第1初期処理を一度失敗している同じホスト装置30と行うことによる電力の浪費を抑制できる。一方、制御回路13は、第2初期処理を行った後、ホスト装置30との接続が途絶えた後にホスト装置30と接続した場合は、初期状態に戻って第1初期処理を行う。このように制御回路13の接続相手が第1初期処理を一度失敗したホスト装置と異なるホスト装置30である可能性がある場合は、初期状態に戻って第1初期処理が行われる。このとき、第1初期処理に成功すれば、ホスト装置30からの供給電力で二次電池14の充電を行うことができる。よって、二次電池14が充電される頻度を高めることができる。 (4) After performing the second initial process, the control circuit 13 performs the second initial process without performing the first initial process when the connection with the host device 30 is continued. On the other hand, after the second initial process is performed, when the connection with the host apparatus 30 is interrupted after the connection with the host apparatus 30 is interrupted, the process returns to the initial state and the first initial process is started. In this way, when the host device 30 is the same connection partner that has failed the first initial processing once, the first initial processing is not performed and the second initial processing is performed. For this reason, it is possible to suppress the waste of power due to the control circuit 13 performing the first initial process with the same host device 30 that has once failed. On the other hand, if the control circuit 13 is connected to the host device 30 after the connection with the host device 30 is interrupted after performing the second initial processing, the control circuit 13 returns to the initial state and performs the first initial processing. As described above, when there is a possibility that the connection partner of the control circuit 13 is the host device 30 different from the host device that has once failed the first initial processing, the first initial processing is performed after returning to the initial state. At this time, if the first initial process is successful, the secondary battery 14 can be charged with the power supplied from the host device 30. Therefore, the frequency with which the secondary battery 14 is charged can be increased.
(5)制御回路13は、第1初期処理を完了した後に、ホスト装置30との接続が継続された状態で、電源スイッチ20Aがオフされた場合は、第1初期処理を行い、第1初期処理が完了したのちに、二次電池14の充電を行う。このように電源オン状態で第1初期処理を成功した同じホスト装置30とは電源オフ後に第1初期処理を行う。このため、第1初期処理を完了すれば、二次電池14が充電され、第1初期処理を失敗すれば、二次電池14の充電は行われない。一方、制御回路13は、第2初期処理を行った後に、ホスト装置30との接続が継続された状態で、電源スイッチ20Aがオフされた場合は、第1初期処理を行わず、二次電池14の充電は行われない。このように電源オン状態で第1初期処理に失敗し、第2初期処理を行った場合は、第1初期処理を失敗した同じホスト装置30と電源オフ後に第1初期処理を行わないことで、二次電池14の充電は行われない。よって、電源スイッチ20Aがオフされた際に、制御回路13が第1初期処理を一度失敗している同じホスト装置30と第1初期処理を行うことによる電力の浪費を抑制できる。 (5) When the power switch 20A is turned off in a state where the connection with the host device 30 is continued after completing the first initial processing, the control circuit 13 performs the first initial processing and performs the first initial processing. After the processing is completed, the secondary battery 14 is charged. In this way, the first initial process is performed after the power is turned off with the same host device 30 that has successfully performed the first initial process in the power-on state. For this reason, if the first initial process is completed, the secondary battery 14 is charged, and if the first initial process fails, the secondary battery 14 is not charged. On the other hand, when the power switch 20 </ b> A is turned off in a state where the connection with the host device 30 is continued after performing the second initial process, the control circuit 13 does not perform the first initial process and does not perform the first initial process. 14 is not charged. In this way, when the first initial process fails in the power-on state and the second initial process is performed, the first initial process is not performed after powering off with the same host device 30 that failed the first initial process. The secondary battery 14 is not charged. Therefore, when the power switch 20A is turned off, it is possible to suppress waste of power due to the control circuit 13 performing the first initial process with the same host device 30 that has once failed the first initial process.
(6)制御回路13は、電源スイッチ20Aがオンされる前のオフ状態で行われた第1初期処理を完了できた成功か、第1初期処理を完了できず第2初期処理を行った失敗かを示す値を不揮発性メモリー25に記憶する。電源スイッチ20Aがオンされた後、不揮発性メモリー25の第2記憶領域25Bの記憶内容が成功の旨の値であれば、第1初期処理を行う。一方、不揮発性メモリー25の第2記憶領域25Bの記憶内容が失敗の旨の値であれば、第1初期処理を行わずに第2初期処理が行われ、二次電池14の充電は行われない。よって、第1初期処理を失敗した後に、ホスト装置30との接続が継続された状態で、電源スイッチ20Aがオンされた場合に、制御回路13が電源オフ状態で一度失敗している同じホスト装置30と第1初期処理を行うことによる電力の浪費を抑制することができる。 (6) The control circuit 13 has succeeded in completing the first initial process performed in the off state before the power switch 20A is turned on, or failed in completing the first initial process without completing the first initial process. A value indicating this is stored in the nonvolatile memory 25. After the power switch 20A is turned on, if the stored content of the second storage area 25B of the nonvolatile memory 25 is a value indicating success, the first initial processing is performed. On the other hand, if the stored content of the second storage area 25B of the nonvolatile memory 25 is a value indicating failure, the second initial process is performed without performing the first initial process, and the secondary battery 14 is charged. Absent. Therefore, when the power switch 20A is turned on in a state in which the connection with the host device 30 is continued after the failure of the first initial processing, the same host device in which the control circuit 13 has failed once in the power-off state. It is possible to suppress waste of electric power by performing the first initial processing with 30.
(7)初期状態においてUSBコネクター12がホスト装置30と接続した場合に、制御回路13は、第1初期処理を行い、第1初期処理が完了したのちに、二次電池14に充電を行う。第1初期処理に失敗したときは、二次電池14に充電を行わない。また、第1初期処理が完了してホスト装置30との接続が継続している状態でホスト装置30と再接続を行う場合には、第1初期処理を行い、第1初期処理が完了したのちに、二次電池14に充電が行われる。一方、第1初期処理が失敗してホスト装置30との接続が継続している状態でホスト装置30と再接続を行う場合には、第1初期処理を行わず、電池に充電を行わない。よって、第1初期処理を失敗している同じホスト装置30と再接続する場合に、制御回路13が第1初期処理を失敗している同じホスト装置30と第1初期処理を行うことによる電力の浪費を抑制できる。 (7) When the USB connector 12 is connected to the host device 30 in the initial state, the control circuit 13 performs the first initial process, and charges the secondary battery 14 after the first initial process is completed. When the first initial process fails, the secondary battery 14 is not charged. Further, when reconnecting to the host device 30 in a state where the first initial processing is completed and the connection with the host device 30 is continued, the first initial processing is performed and the first initial processing is completed. In addition, the secondary battery 14 is charged. On the other hand, when reconnecting to the host device 30 in a state where the first initial processing fails and the connection with the host device 30 is continued, the first initial processing is not performed and the battery is not charged. Therefore, when reconnecting to the same host device 30 in which the first initial processing has failed, the control circuit 13 generates power by performing the first initial processing with the same host device 30 in which the first initial processing has failed. Waste can be suppressed.
(8)制御回路13は、ホスト装置30との接続が途絶えた後にホスト装置30と接続した場合には、ホスト装置30との接続が途絶える前に第1初期処理が完了(成功)したか失敗したかに関わらず、初期状態に戻って、第1初期処理を開始する。よって、ホスト装置30との接続が途絶えた後にホスト装置30と接続した場合は、その接続相手は、接続が途絶える前のホスト装置30と異なる可能性(第1初期処理が成功する可能性)があるので、初期状態に戻って第1初期処理が行われる。第1初期処理に成功すれば、二次電池14への充電が可能になる。例えば第1初期処理を失敗したホスト装置30と接続が途絶え、次に接続したホスト装置30がそれまでのホスト装置と異なる可能性があるにも拘らず、第1初期処理を行わず、充電の機会を逸することを回避できる。よって、二次電池14が充電される頻度を高めることができる。 (8) When the control circuit 13 is connected to the host device 30 after the connection with the host device 30 is interrupted, the first initial process is completed (successful) or the failure before the connection with the host device 30 is interrupted. Regardless of whether or not, the process returns to the initial state and the first initial process is started. Therefore, when connecting to the host device 30 after the connection with the host device 30 is interrupted, there is a possibility that the connection partner is different from the host device 30 before the connection is interrupted (the first initial process may be successful). As a result, the process returns to the initial state and the first initial processing is performed. If the first initial process is successful, the secondary battery 14 can be charged. For example, although the connection with the host device 30 that has failed the first initial processing is disconnected, and the next connected host device 30 may be different from the previous host device, the first initial processing is not performed and the charging is not performed. You can avoid missing opportunities. Therefore, the frequency with which the secondary battery 14 is charged can be increased.
(9)制御回路13は、プリンター11の電源がオン状態であれば、プリンター(第1種の装置の一例)である旨のクラス情報(プリンタークラス(第1のクラス))の通知をすることで、プリンターとして第1初期処理を行う。一方、プリンター11の電源がオフ状態であれば、プリンターと異なるヒューマンインターフェイスデバイス(HID)(第2種の装置の一例)である旨のクラス情報(HIDクラス(第2のクラス))の通知をすることで、HIDとして第1初期処理を行う。よって、ホスト装置30は、電源オン状態にあるプリンター11をプリンターと認識し、プリンターとして扱う。一方、ホスト装置30は、電源オフ状態にあるプリンター11をHIDと認識し、HIDとして扱う。よって、電源オン状態にあるプリンター11をHIDと認識して印刷ができなくなる不都合や、電源オフ状態にあるプリンター11をプリンターと認識して電源オフ中であるにも拘らず印刷データを送信するなどの不都合を回避できる。 (9) If the power of the printer 11 is on, the control circuit 13 notifies the class information (printer class (first class)) that the printer is an example of the first type device. Then, the first initial processing is performed as the printer. On the other hand, if the printer 11 is turned off, a notification of class information (HID class (second class)) indicating that the printer is a human interface device (HID) (an example of the second type device) different from the printer is sent. Thus, the first initial processing is performed as HID. Therefore, the host device 30 recognizes the printer 11 in the power-on state as a printer and treats it as a printer. On the other hand, the host device 30 recognizes the printer 11 in the power-off state as HID and treats it as HID. Therefore, the printer 11 in the power-on state is recognized as HID and printing cannot be performed, or the printer 11 in the power-off state is recognized as a printer and print data is transmitted even though the power is off. The inconvenience can be avoided.
(10)制御回路13は、プリンター11の電源がオン状態の下で行った第1初期処理に失敗したときに、第1初期処理よりも小さい電力要求を含む第2初期処理を行う。第2初期処理が完了してホスト装置30との接続が継続している状態で、ホスト装置30と再接続を行う場合には、プリンター11の電源がオン状態であれば、第1初期処理を行わずに第2初期処理を行う。よって、第2初期処理が完了してホスト装置30との接続が継続している状態でホスト装置30と再接続を行う場合は、同じホスト装置30と一度失敗した第1初期処理を行わず第2初期処理を行う。よって、一度失敗している第1初期処理を行うことによる制御回路13の電力の浪費を抑制できるうえ、第1初期処理を省く分だけ早期に印刷開始可能状態となり、再接続後の印刷を早期に開始させることができる。 (10) The control circuit 13 performs a second initial process including a power request smaller than that of the first initial process when the first initial process performed with the printer 11 powered on fails. When reconnecting to the host device 30 in a state where the second initial processing is completed and the connection with the host device 30 is continued, if the printer 11 is powered on, the first initial processing is performed. The second initial processing is performed without performing it. Therefore, when reconnecting to the host device 30 in a state where the second initial processing is completed and the connection with the host device 30 is continued, the first initial processing that has failed once with the same host device 30 is not performed. 2 Perform initial processing. Therefore, it is possible to suppress the waste of power of the control circuit 13 due to the first initial processing that has failed once, and to be able to start printing as soon as the first initial processing is omitted, and early printing after reconnection is performed. Can be started.
(11)制御回路13は、ホスト装置30との初期処理においてタイムアウトが発生した場合に、第1初期処理に失敗したと判断する。このため、タイムアウトを考慮することなく初期処理完了通知を受信するまで待機する構成である場合に比べ、早期に第2初期処理を行うことができるので、ホスト装置30とプリンター11との通信を早期に確立することができる。 (11) The control circuit 13 determines that the first initial process has failed when a timeout occurs in the initial process with the host device 30. For this reason, since the second initial processing can be performed earlier than in the case of waiting until the initial processing completion notification is received without considering the timeout, the communication between the host device 30 and the printer 11 can be performed earlier. Can be established.
(12)制御回路13は、タイムアウトと判定する際に用いるタイムアウト時間T1を、ホスト装置30のBIOS起動所要時間(起動所要時間の一例)に応じて設定する。よって、USBコネクター12が接続しているホスト装置30が起動途中の状態にあっても、その起動後のホスト装置30と初期処理を行ってホスト装置30からの電源供給により第2電力(例えば電流値500mA)で二次電池14を充電することができる。このため、ホスト装置30の起動所要時間に合っていない短過ぎるタイムアウト時間が設定されているために、ホスト装置30の起動途中でタイムアウトと判定されてしまい、少し待てば充電できたにも拘らず少し早くに失敗としたために充電されない不都合を減らすことができる。従って、二次電池14が充電される頻度を高めることができる。 (12) The control circuit 13 sets the timeout time T1 used when determining the timeout, according to the BIOS startup required time (an example of the startup required time) of the host device 30. Therefore, even when the host device 30 to which the USB connector 12 is connected is in the middle of starting, the second power (for example, current) is supplied by supplying power from the host device 30 after performing initial processing with the host device 30 after the startup. The secondary battery 14 can be charged at a value of 500 mA). For this reason, a timeout time that is too short that does not match the required startup time of the host device 30 is set, so that the timeout is determined during the startup of the host device 30 and charging is performed a little while waiting for a while. It is possible to reduce the inconvenience that the battery is not charged due to failure early. Therefore, the frequency with which the secondary battery 14 is charged can be increased.
(13)特にタイムアウト時間T1を、接続が想定される複数種のホスト装置30の起動所要時間のうち最長時間のものに所定のマージン時間を加えて設定している。よって、少し待てば充電できたにも拘らず短過ぎるタイムアウト時間によりホスト装置30の起動途中でタイムアウトになって第1初期処理が失敗と判断されたために、二次電池14を充電できなくなる事態を極力抑えることができる。このため、二次電池14が充電される頻度を一層高めることができる。 (13) In particular, the timeout time T1 is set by adding a predetermined margin time to the longest time required for starting up the plurality of types of host apparatuses 30 to be connected. Therefore, the secondary battery 14 cannot be charged because the first initial process is determined to have failed due to a timeout during the start-up of the host device 30 due to a too short timeout time even though charging was possible after a short wait. It can be suppressed as much as possible. For this reason, the frequency with which the secondary battery 14 is charged can be further increased.
(14)電源OFF時の初期処理におけるタイムアウト時間T11よりも、電源ON時のタイムアウト時間T12の方を短く設定している。よって、電源OFF中は二次電池14の充電の頻度を高めることができ、電源ON中はユーザーがホスト装置30からプリンター11に指示した処理の開始遅れを短く抑えることができる。 (14) The timeout time T12 when the power is turned on is set shorter than the timeout time T11 during the initial process when the power is turned off. Therefore, the frequency of charging the secondary battery 14 can be increased while the power is off, and the start delay of the process instructed by the user from the host device 30 to the printer 11 can be suppressed while the power is on.
(第2実施形態)
次に図11を参照して第2実施形態を説明する。本実施形態では、タイムアウトに加え、他の方法によっても、CPU24が第1初期処理を失敗と判断する。なお、プリンター11の構成は第1実施形態と同様であり、CPU24が実行する初期処理の失敗の判定方法が一部異なるだけなので、第1実施形態と共通の構成及び共通の処理については同一の符号を用いてその説明を省略し、特に異なる部分についてのみ説明する。
(Second Embodiment)
Next, a second embodiment will be described with reference to FIG. In the present embodiment, the CPU 24 determines that the first initial process has failed by another method in addition to the timeout. The configuration of the printer 11 is the same as that of the first embodiment, and only the method for determining failure of the initial process executed by the CPU 24 is partially different. Therefore, the same configuration and common processes as those of the first embodiment are the same. The description will be omitted using reference numerals, and only different parts will be described.
本実施形態では、初期処理の失敗を、第1実施形態と同様のタイムアウトの発生に加え、ホスト装置30のサスペンド状態(一時停止状態)への移行によっても判断する。ホスト装置30の種類によってはUSB接続中においてSOF(スタートオブフレーム)信号を定期的(例えば1ミリ秒未満の所定時間毎)にプリンター11に送信する。SOF信号は、例えば10マイクロ秒〜1ミリ秒の範囲内の一定時間Toの間隔毎にホスト装置30からプリンター11へ送信される信号である。 In the present embodiment, the failure of the initial process is determined not only by the occurrence of a timeout similar to the first embodiment but also by the transition of the host device 30 to the suspended state (paused state). Depending on the type of the host device 30, an SOF (start of frame) signal is transmitted to the printer 11 periodically (for example, every predetermined time of less than 1 millisecond) during USB connection. The SOF signal is a signal transmitted from the host device 30 to the printer 11 at intervals of a predetermined time To within a range of 10 microseconds to 1 millisecond, for example.
このため、初期処理中においてもホスト装置30からプリンター11へSOF信号が送信される。そして、ホスト装置30は、第1初期処理においてプリンター11から受信した構成情報に含まれるバスパワーでの要求電力(第2電力)を許可できない場合、構成情報の設定を行わず、サスペンド状態に移行する。このサスペンド状態への移行の際、ホスト装置30は、プリンター11へのSOF信号の送信を停止する。 For this reason, the SOF signal is transmitted from the host device 30 to the printer 11 even during the initial processing. When the host device 30 cannot permit the required power (second power) at the bus power included in the configuration information received from the printer 11 in the first initial process, the host device 30 does not set the configuration information and shifts to the suspended state. To do. During the transition to the suspended state, the host device 30 stops transmitting the SOF signal to the printer 11.
プリンター11内の制御回路13を構成するCPU24は、ホスト装置30とのUSB接続中においてホスト装置30から送られてくるはずのSOF信号が途絶えて送られてこなくなると、ホスト装置30がサスペンド状態へ移行し、第1初期処理が失敗したとみなす。電源OFF時の充電処理においては、CPU24は、ホスト装置30から送られてくるはずのSOF信号が設定時間T2の間、途絶えて送られてこなくなると、ホスト装置30がサスペンド状態へ移行して第1初期処理が失敗したとみなす。 When the SOF signal that should have been sent from the host device 30 during the USB connection with the host device 30 is interrupted, the CPU 24 that constitutes the control circuit 13 in the printer 11 stops the host device 30 from being suspended. It is assumed that the first initial process has failed. In the charging process when the power is turned off, the CPU 24 shifts to the suspended state when the SOF signal that should be sent from the host device 30 is not sent for the set time T2 and stops. 1 Assume that initial processing has failed.
この場合、電源OFF時の充電処理(図8)中であれば、第1初期処理を失敗すると、その失敗の旨を不揮発性メモリー25に書き込んだ(S16)後、CPU24の電源をオフにする(S17の充電起動オフ)。また、電源ON時のUSB通信処理(図10)中であれば、第1初期処理を失敗すると、その失敗の旨を不揮発性メモリー25に書き込んでセルフパワーに切り替えるとともに(S47)、再接続処理(S48)を行った後、セルフパワーを要求する第2初期処理を実行する(S49)。 In this case, if the first initial process fails during the charging process when the power is turned off (FIG. 8), the failure is written in the nonvolatile memory 25 (S16), and then the power of the CPU 24 is turned off. (Charging start-off in S17). If the first initial process fails during the USB communication process when the power is turned on (FIG. 10), the failure is written in the nonvolatile memory 25 and switched to self power (S47), and the reconnection process is performed. After performing (S48), a second initial process for requesting self-power is executed (S49).
設定時間T2は、例えば1〜10ミリ秒の範囲内でかつT2>Toを満たす一定時間に設定されている。つまり、SOF信号が途絶えて設定時間T2以上アイドル状態になった時点で、第1初期処理を失敗したと判断する。 The set time T2 is set to, for example, a certain time that satisfies T2> To in a range of 1 to 10 milliseconds. That is, it is determined that the first initial processing has failed when the SOF signal is interrupted and becomes idle for the set time T2.
次に図11を参照して、本実施形態のプリンター11の作用を説明する。図11においてステップS31〜S34の各処理は、第1実施形態における図9で示されたステップS31〜S34の各処理と同様である。 Next, the operation of the printer 11 of the present embodiment will be described with reference to FIG. In FIG. 11, each process of step S31-S34 is the same as each process of step S31-S34 shown in FIG. 9 in 1st Embodiment.
ステップS31でタイマーの計時を開始する。ステップS32では、バスパワーを要求する初期処理(第1初期処理)を行い、ホスト装置30からの要求に対してクラス情報(例えば「HID」)と、パワーモード情報(「バスパワー」)と、要求電力情報(第2電力(電流値で500mA))とが含まれる構成情報を送信する。 In step S31, the timer starts counting. In step S32, initial processing (first initial processing) for requesting bus power is performed, and class information (for example, “HID”), power mode information (“bus power”), and a request from the host device 30, The configuration information including the required power information (second power (500 mA in current value)) is transmitted.
ステップS33では、初期処理完了通知を受信したか否かを判断する。ここで、ホスト装置30は、初期処理において受信した構成情報中で要求された第2電力での電源供給を許可できるか否かを判断する。ホスト装置30は、第2電力での電源供給を許可できる場合は、その構成情報を設定するとともに初期処理完了通知「SetConfiguration」をプリンター11に送信する。そして、プリンター11のCPU24は、初期処理完了通知を受信しなければステップS34に進み、初期処理完了通知を受信して第1初期処理を成功すれば、ステップS15(図8の充電処理ルーチン)又はS46(図10のUSB通信処理ルーチン)に進む。 In step S33, it is determined whether an initial processing completion notification has been received. Here, the host device 30 determines whether or not the power supply with the second power requested in the configuration information received in the initial process can be permitted. If the power supply with the second power can be permitted, the host device 30 sets the configuration information and transmits an initial processing completion notification “SetConfiguration” to the printer 11. If the CPU 24 of the printer 11 does not receive the initial process completion notification, the process proceeds to step S34. If the initial process completion notification is received and the first initial process is successful, the CPU 24 proceeds to step S15 (charging process routine in FIG. 8) or The process proceeds to S46 (USB communication processing routine of FIG. 10).
初期処理完了通知を受信しない場合(S33で否定判定)は、ステップS34において、タイムアウトか否かを判断する。すなわち、タイマー24Aの計時時間Tがタイムアウト時間T1に達したか否かを判断する。タイムアウトでなければステップS35に進み、一方、タイムアウトであれば、第1初期処理の失敗とみなし、ステップS16(図8の充電処理ルーチン)又はS47(図10のUSB通信処理ルーチン)に進む。 If the initial process completion notification is not received (No in S33), it is determined in step S34 whether a timeout has occurred. That is, it is determined whether or not the time T of the timer 24A has reached the timeout time T1. If it is not time-out, the process proceeds to step S35, and if it is time-out, the first initial process is regarded as a failure, and the process proceeds to step S16 (charging process routine in FIG. 8) or S47 (USB communication processing routine in FIG. 10).
ステップS35では、SOF信号の受信が設定時間T2以上ないか否かを判断する。つまり、CPU24は、USB接続中はホスト装置30から送られてくるはずのSOF信号の受信が設定時間T2以上途絶えたアイドル状態になったか否かを判断する。SOF信号の受信が途切れたアイドル状態が設定時間T2に達していなければステップS33に戻り、そのアイドル状態が設定時間T2以上継続すれば、第1初期処理の失敗とみなし、ステップS16(図8)又はS47(図10)に進む。 In step S35, it is determined whether or not the SOF signal is received for a set time T2 or longer. That is, the CPU 24 determines whether or not the reception of the SOF signal that should have been sent from the host device 30 during the USB connection has been idle for a set time T2 or longer. If the idle state in which reception of the SOF signal is interrupted does not reach the set time T2, the process returns to step S33. If the idle state continues for the set time T2 or longer, it is considered that the first initial process has failed, and step S16 (FIG. 8). Alternatively, the process proceeds to S47 (FIG. 10).
こうして初期処理完了通知を受信するか(S33)、タイムアウトになるか(S34)、SOF信号の受信が設定時間T2以上ないか(S35)の各判定処理のうちいずれか1つが成立するまで、ステップS33,S34,S35の各処理を繰り返す。 Steps until one of the determination processes is established, whether the initial process completion notification is received (S33), the time-out is reached (S34), or the SOF signal is not received for the set time T2 (S35). Each process of S33, S34, and S35 is repeated.
タイムアウトになる前(S34で否定判定)に、SOF信号の受信が設定時間T2以上途切れることなく(S35で否定判定)、初期処理完了通知を受信すれば(S33で肯定判定)、第1初期処理が完了し、これをもって第1初期処理の成功とする。第1初期処理が成功した場合、電源OFF時の充電処理中であれば、ステップS15に進んで、第2電力で二次電池14を充電する。一方、電源ON時のUSB通信処理中であれば、ステップS46に進んで、USB通信処理と充電とを行う。 If the SOF signal reception is not interrupted for more than the set time T2 (determined negative in S35) before the timeout is reached (determined negative in S35), and if an initial process completion notification is received (positive determination in S33), the first initial process Is completed, and this is regarded as the success of the first initial processing. If the first initial process is successful and the charging process is in progress when the power is turned off, the process proceeds to step S15 to charge the secondary battery 14 with the second power. On the other hand, if the USB communication process is being performed when the power is turned on, the process proceeds to step S46, where the USB communication process and charging are performed.
一方、タイムアウトになる前(S34で否定判定)に、初期処理完了通知を受信することなく(S33で否定判定)、SOF信号の受信が設定時間T2以上途切れると(S35で肯定判定)、第1初期処理が失敗したとみなす。また、初期処理完了通知を受信することなく(S33で否定判定)、かつSOF信号の受信が設定時間T2以上途切れることなく(S35で否定判定)、タイムアウトになると(S34で肯定判定)、第1初期処理が失敗したとみなす。第1初期処理が失敗した場合、電源OFF時の充電処理(図8)中であれば、不揮発性メモリー25に失敗の旨を書き込んだうえ(S16)、CPU24の充電起動をオフする(S17)。一方、電源ON時のUSB通信処理(図10)中であれば、ステップS46に進んで、USB通信処理と充電とを行う。 On the other hand, before receiving the initial processing completion notification (determination is negative in S33) before timeout (determination in S34), if reception of the SOF signal is interrupted for a set time T2 or more (determination is positive in S35), the first Consider initial processing failed. In addition, when the initial processing completion notification is not received (No determination in S33), and the reception of the SOF signal is not interrupted for more than the set time T2 (No determination in S35), and when a timeout occurs (Yes determination in S34), the first Consider initial processing failed. If the first initial process fails, if the charging process during power-off (FIG. 8) is in progress, the fact that the failure has occurred is written in the nonvolatile memory 25 (S16), and the charging activation of the CPU 24 is turned off (S17). . On the other hand, if the USB communication process at the time of power ON (FIG. 10) is in progress, the process proceeds to step S46 to perform the USB communication process and charging.
この第2実施形態によれば、第1実施形態と同様の効果が得られるうえ、更に以下に示す効果が得られる。
(15)プリンター11のCPU24は、USB接続中はホスト装置30から定期的に送られてくるはずのSOF信号が設定時間T2以上なくなると、第1初期処理が失敗したと判断する。このため、CPU24の起動時点からタイムアウト時間T1を待つことなく、第1初期処理の失敗をほぼリアルタイムに検出できる。このため、電源0FF時の充電処理においては、タイムアウトを待つことなく第1初期処理の失敗を早期に検出し、失敗の検出時点でCPU24等の充電起動を早期にオフさせることができる。このため、タイムアウトをもって第1初期処理の失敗とする構成に比べ、CPU24等の電力の浪費を一層抑制することができる。例えば制御回路13が起動状態に放置されることによる二次電池14の残量の低減を一層抑制できる。また、電源ON時のUSB通信処理においては、タイムアウトを待つことなく第1初期処理の失敗を早期に検出し、セルフパワーを要求する初期処理(第2初期処理)を早期に開始できる。この結果、タイムアウトのみを失敗とする前記第1実施形態の構成に比べ、プリンター11が早期にUSB通信処理を開始できる。例えばユーザーがホスト装置30から指示した印刷をプリンター11に早期に開始させることができる。
According to the second embodiment, the same effects as those of the first embodiment can be obtained, and the following effects can be further obtained.
(15) The CPU 24 of the printer 11 determines that the first initial process has failed when the SOF signal that should be periodically sent from the host device 30 during the USB connection does not exceed the set time T2. For this reason, the failure of the first initial processing can be detected almost in real time without waiting for the timeout time T1 from the time when the CPU 24 is activated. For this reason, in the charging process at the time of power supply 0FF, the failure of the first initial process can be detected at an early stage without waiting for a timeout, and the charging activation of the CPU 24 and the like can be turned off at an early stage when the failure is detected. For this reason, compared with the structure which makes the 1st initial process failure by timeout, the waste of electric power of CPU24 etc. can be suppressed further. For example, a reduction in the remaining amount of the secondary battery 14 due to the control circuit 13 being left in the activated state can be further suppressed. Further, in the USB communication process when the power is turned on, the failure of the first initial process can be detected early without waiting for a timeout, and the initial process (second initial process) for requesting self power can be started early. As a result, the printer 11 can start the USB communication process earlier than the configuration of the first embodiment in which only the timeout is failed. For example, it is possible to cause the printer 11 to start printing instructed by the user from the host device 30 at an early stage.
(16)第1初期処理の失敗の判定方法として、ホスト装置30から定期的に送られてくるはずのSOF信号が設定時間T2以上ないか否かの判定と、CPU24の起動時点からタイムアウト時間T1を経過したか否かの判定との複数種の判定方法を用いている。よって、SOF信号を送信する機能を有するホスト装置が接続相手である場合、第1初期処理の失敗をほぼリアルタイムに検出でき、SOF信号を送信する機能を有しないホスト装置であっても、タイムアウトをもって第1初期処理の失敗を検出できる。 (16) As a determination method of the failure of the first initial process, it is determined whether or not the SOF signal that should be periodically sent from the host device 30 is equal to or longer than the set time T2, and the time-out time T1 from the activation point of the CPU 24. A plurality of types of determination methods are used for determining whether or not the process has passed. Therefore, when the host device having the function of transmitting the SOF signal is the connection partner, the failure of the first initial processing can be detected almost in real time, and even the host device having no function of transmitting the SOF signal has a timeout. The failure of the first initial process can be detected.
なお、上記各実施形態は以下のような形態に変更したり、これらを組み合わせたりすることもできる。
・ユーザーの動作環境に応じてタイムアウト時間を変更できるようにしてもよい。データの入力のために操作される操作部の一例としての操作スイッチ20Bを備え、制御回路13は、タイムアウトと判定する際に用いるタイムアウト時間T1を、操作スイッチ20Bの操作による入力結果に基づき設定できる構成としてもよい。この場合、操作スイッチ20Bの操作によりタイムアウト時間T1を数値で入力設定してもよいし、タイムアウト時間T1の選択肢の中から所望の一つを選択する構成としてもよい。この構成によれば、操作スイッチ20Bを操作した入力結果に基づき、ユーザーが使用環境に合った適切なタイムアウト時間T1を設定することができる。よって、使用されるホスト装置30のBIOS起動所要時間に合っていない短過ぎるタイムアウト時間が変更不能な状態で設定されているために、少し待てば充電できるにも拘らず、少し早くに失敗としたためにホスト装置30の起動途中でタイムアウトと判断されてしまい充電されない不都合を低減できる。この結果、二次電池14が充電される頻度を高めることができる。
In addition, each said embodiment can also be changed into the following forms, or can also combine these.
-You may enable it to change timeout time according to a user's operating environment. An operation switch 20B is provided as an example of an operation unit operated for data input, and the control circuit 13 can set a timeout time T1 used when determining a timeout based on an input result obtained by operating the operation switch 20B. It is good also as a structure. In this case, the timeout time T1 may be input and set as a numerical value by operating the operation switch 20B, or a desired one may be selected from the options of the timeout time T1. According to this configuration, it is possible for the user to set an appropriate timeout time T1 suitable for the use environment based on the input result of operating the operation switch 20B. Therefore, because the timeout time that is too short that does not match the BIOS startup time of the host device 30 to be used is set in an unchangeable state, the failure is made a little earlier even though it can be charged after a while. It is possible to reduce the inconvenience that the host device 30 is determined to have timed out during the startup and is not charged. As a result, the frequency with which the secondary battery 14 is charged can be increased.
・タイムアウト時間T1を一定値としたが可変としてもよい。制御回路13は、USBコネクター12が接続している相手が第2の装置の一例であるホスト装置30であるときは、ホスト装置30から起動所要時間情報を取得するか、又はホスト装置30の起動所要時間を制御回路13内のタイマーで計時するかして取得し、その取得した起動所要時間に応じてタイムアウト時間T1を設定してもよい。この構成によれば、制御回路13は、取得した起動所要時間に応じたタイムアウト時間T1を設定できるので、ユーザーの使用環境に合った適切なタイムアウト時間T1を設定することができる。このため、ホスト装置30の起動所要時間に合っていない短過ぎるタイムアウト時間が設定されているために、ホスト装置30の起動途中でタイムアウトと判断されてしまい、もう少し待てば充電できたにも拘らず、少し早くにタイムアウト(失敗)になったために、充電されない不都合を減らすことができる。この結果、電池14が充電される頻度を高めることができる。また、制御回路13は、最大M個の起動所要時間のデータをメモリー25に記憶し、新規の起動所要時間を取得する度にM個を超える過去のデータのうち一番旧いデータを消去し、M個のうち最も長い起動所要時間に応じてタイムアウト時間を設定する。また、過去M個のうち予め設定された最長設定時間を超えるデータは採用せず、最長設定時間以下の起動所要時間のデータのうち最も長い起動所要時間に応じてタイムアウト時間T1を設定してもよい。これらの構成であれば、ユーザーがたまたま1回だけ起動所要時間の非常に長いホスト装置30をプリンター11に接続したために、そのホスト装置30の非常に長い起動所要時間に基づく長過ぎるタイムアウト時間が設定されることを回避し、適切なタイムアウト時間T1を設定できる。 Although the timeout time T1 is a constant value, it may be variable. When the partner to which the USB connector 12 is connected is the host device 30 which is an example of the second device, the control circuit 13 acquires the required start time information from the host device 30 or starts the host device 30. The required time may be acquired by measuring with a timer in the control circuit 13, and the timeout time T1 may be set according to the acquired required start time. According to this configuration, the control circuit 13 can set the timeout time T1 according to the acquired required startup time, and thus can set an appropriate timeout time T1 suitable for the use environment of the user. For this reason, a timeout time that is too short that does not match the required startup time of the host device 30 is set, so that the timeout is determined during the startup of the host device 30 and charging can be performed after waiting for a while. Since the timeout (failure) occurred a little earlier, the inconvenience of not being charged can be reduced. As a result, the frequency with which the battery 14 is charged can be increased. In addition, the control circuit 13 stores the data of the maximum M required startup times in the memory 25, and erases the oldest data among the past data exceeding M each time a new startup required time is acquired. A timeout time is set according to the longest required startup time among the M. In addition, data exceeding the preset maximum set time among the past M pieces is not adopted, and the timeout time T1 is set according to the longest required start time among the data of the required start time less than the maximum set time. Good. With these configurations, since the host device 30 that happens to have a very long startup time is connected to the printer 11 only once, an excessively long timeout time based on the very long startup time of the host device 30 is set. Thus, an appropriate timeout time T1 can be set.
・制御回路13は、二次電池14の残量又は残量の変化を示す値を計測し、二次電池14の残量又は残量の変化を示す値が閾値を超えると、初期処理に失敗したと判断してもよい。この場合、二次電池の残量の変化を示す値は、変化量でもよいし変化率でもよい。この構成によれば、制御回路13は、二次電池14の残量又は残量の変化を示す値(例えば変化量又は変化率)が閾値を超えたことをもって、初期処理に失敗したと判断する。このため、タイマー等の計時手段を用いなくても初期処理の失敗を判定することができる。また、残量の変化率を用いた場合、二次電池14の残量が相対的に少ないときは相対的に早めに初期処理の失敗と判断され、二次電池14の残量が相対的に多いときは相対的に遅めに初期処理の失敗と判断される。このため、二次電池14の残量が少ないにも拘らず、初期処理の失敗の判断が遅れて残量が極めて少なくなる事態を回避し易い。また、二次電池14の残量に応じてタイムアウト時間T1を設定した場合、例えば二次電池14の残量が閾値未満と少ない場合はタイムアウト時間T1を相対的に短く設定し、その残量が多い場合はタイムアウト時間T1を相対的に長く設定してもよい。 The control circuit 13 measures a value indicating the remaining amount of the secondary battery 14 or a change in the remaining amount, and if the value indicating the remaining amount of the secondary battery 14 or the change in the remaining amount exceeds a threshold value, the initial process fails. You may judge that you did. In this case, the value indicating the change in the remaining amount of the secondary battery may be a change amount or a change rate. According to this configuration, the control circuit 13 determines that the initial process has failed when a value indicating the remaining amount of the secondary battery 14 or a change in the remaining amount (for example, a change amount or a change rate) exceeds a threshold value. . For this reason, it is possible to determine the failure of the initial process without using a timer such as a timer. Further, when the remaining rate of change is used, when the remaining amount of the secondary battery 14 is relatively small, it is determined that the initial process has failed relatively early, and the remaining amount of the secondary battery 14 is relatively If there are many, it is determined that the initial processing has failed relatively late. For this reason, although the remaining amount of the secondary battery 14 is small, it is easy to avoid a situation where the determination of the failure of the initial process is delayed and the remaining amount becomes extremely small. Further, when the timeout time T1 is set according to the remaining amount of the secondary battery 14, for example, when the remaining amount of the secondary battery 14 is less than the threshold, the timeout time T1 is set relatively short, and the remaining amount is If there are many, the timeout time T1 may be set relatively long.
・タイムアウト時間T1は、接続が想定される複数種のホスト装置30のうち最も長い起動所要時間(BIOS起動所要時間)に応じた値に設定することが好ましいが、ホスト装置のBIOS起動所要時間と同じ時間又はBIOS起動所要時間よりも短い時間を設定してもよい。例えばBIOS起動所要時間の1/2又は1/3の時間でもよい。また、BIOS起動所要時間を考慮しないタイムアウト時間T1を設定してもよい。例えばタイムアウト時間T1をエニュメレーション所要時間以上、エニュメレーション所要時間に所定のマージン時間(例えば1〜10秒)を加えた時間以下の値に設定してもよい。 The timeout time T1 is preferably set to a value corresponding to the longest startup required time (BIOS startup required time) among a plurality of types of host devices 30 that are assumed to be connected. The same time or a time shorter than the BIOS startup time may be set. For example, it may be 1/2 or 1/3 of the BIOS startup time. Moreover, you may set timeout time T1 which does not consider BIOS starting required time. For example, the timeout time T1 may be set to a value not less than the enumeration required time and not more than a time obtained by adding a predetermined margin time (for example, 1 to 10 seconds) to the enumeration required time.
・計時時間Tの計時開始時期は、CPUの起動時点(充電起動オン時点)に限定されない。例えばUSB接続時点(例えばUSB接続検出時点)に、タイマー24Aの計時を開始してもよい。この場合、例えば制御IC22内のタイマー(例えばカウンター)により計時を行えば、CPUの起動前であっても計時を開始できる。また、CPU起動時点から所定時間経過時点にタイマーの計時を開始させてもよい。例えば構成情報の送信時点からタイマーによる計時を開始してもよい。 The timing for starting the timing T is not limited to the time when the CPU is activated (the time when charging is activated). For example, the timer 24A may start timing at the time of USB connection (for example, when USB connection is detected). In this case, for example, if the time is measured by a timer (for example, a counter) in the control IC 22, the time can be started even before the CPU is activated. Alternatively, the timer may be started when a predetermined time elapses from the CPU activation time. For example, a timer may be started from the time when the configuration information is transmitted.
・第2実施形態において、ホスト装置30が、USB接続中に定期的にSOF信号をUSBデバイス11Aに送信することが前提であれば、図11に示すフローチャートにおいてタイムアウトであるか否かを判断する処理(S34)を廃止してもよい。 In the second embodiment, if it is assumed that the host device 30 periodically transmits an SOF signal to the USB device 11A during the USB connection, it is determined whether or not a timeout has occurred in the flowchart shown in FIG. The process (S34) may be abolished.
・初期状態がバスパワーであれば、操作スイッチ20Bの操作でパワーモードを設定するユーザー設定は無くてもよい。また、第1初期処理の成功/失敗の旨を不揮発性メモリーに保存する構成は廃止してもよい。この場合、初期処理はまず第1初期処理を行い、第1初期処理に失敗したら、第2初期処理を行う。 If the initial state is bus power, there is no user setting for setting the power mode by operating the operation switch 20B. Further, the configuration for storing the success / failure of the first initial process in the nonvolatile memory may be eliminated. In this case, the initial process first performs the first initial process, and if the first initial process fails, the second initial process is performed.
・図10において、電源ON中にUSB通信処理と充電とを行ったが、充電を行わない構成としてもよい。
・前記各実施形態では、第1初期処理がバスパワー、第2初期処理がセルフパワーをそれぞれ要求する構成としたが、第1初期処理及び第2初期処理が共にバスパワーを要求し、かつ第2初期処理が第1初期処理よりも小さな供給電力の要求を含むものであってもよい。例えば第1初期処理がバスパワーかつ500mAで、第2初期処理がバスパワーかつ100mAであってもよい。
In FIG. 10, USB communication processing and charging are performed while the power is on, but a configuration in which charging is not performed may be employed.
In each of the embodiments, the first initial process requires bus power and the second initial process requires self power. However, both the first initial process and the second initial process require bus power, and The two initial processes may include a request for smaller power supply than the first initial process. For example, the first initial processing may be bus power and 500 mA, and the second initial processing may be bus power and 100 mA.
・電子機器が外部装置から供給を受けた電力は、二次電池14の充電への使用に限定されない。電子機器が例えばプリンターである場合、外部装置から供給された電力を、例えば印刷機構16の印刷動作に使用してもよい。また、電子機器が例えばスキャナー装置である場合、外部装置から供給された電力を、例えば原稿の読取り動作に使用してもよい。 The electric power supplied from the external device to the electronic device is not limited to use for charging the secondary battery 14. When the electronic device is a printer, for example, power supplied from an external device may be used for a printing operation of the printing mechanism 16, for example. When the electronic device is a scanner device, for example, power supplied from an external device may be used for, for example, a document reading operation.
・電源がONからOFFへ、又はOFFからONへ切り換えられた場合、仮に制御回路が外部装置との接続を継続していても初期状態に戻してもよい。
・USB規格はUSB2.0に限定されることなく、USB3.0、USB3.1に適用してもよい。また、USB1.0やUSB1.1に適用してもよい。また、USB規格に限定されず、他の通信規格に適用してもよい。要するに、ホスト装置と電子機器との間で初期処理が行われ、初期処理完了通知(USB規格の「Set Configuration」に相当する通知)の受信をトリガーにして初期処理が完了し、この初期処理の完了をもってホスト装置から充電に必要な電力の供給を受ける構成であれば、他の通信規格でもよい。例えばIEEE1394、SCSI(Small Computer System Interface)、ATA(Advanced Technology Attachment)でもよい。また、通信方式は有線通信方式に限定されず、ホスト装置から電子機器への電源供給が可能な限りにおいて無線通信方式でもよい。
When the power source is switched from ON to OFF or from OFF to ON, the control circuit may return to the initial state even if the control circuit continues to connect to the external device.
The USB standard is not limited to USB 2.0, but may be applied to USB 3.0 and USB 3.1. Moreover, you may apply to USB1.0 or USB1.1. Further, the present invention is not limited to the USB standard, and may be applied to other communication standards. In short, the initial processing is performed between the host device and the electronic device, and the initial processing is completed by receiving the initial processing completion notification (notification corresponding to “Set Configuration” of the USB standard) as a trigger. Any other communication standard may be used as long as it is configured to receive power necessary for charging from the host device upon completion. For example, IEEE 1394, SCSI (Small Computer System Interface), or ATA (Advanced Technology Attachment) may be used. The communication method is not limited to the wired communication method, and may be a wireless communication method as long as power can be supplied from the host device to the electronic device.
・電源スイッチ20Aは、プッシュ式に限定されず、トグル式でもよい。その他、電源のオンとオフを切り替え可能に操作されるスイッチであればよい。また、センサー式の電源スイッチでもよく、接触センサー式又は非接触センサー式の電源スイッチでもよい。 The power switch 20A is not limited to the push type, and may be a toggle type. In addition, any switch that can be operated so as to be able to switch the power on and off may be used. Further, a sensor type power switch may be used, and a contact sensor type or non-contact sensor type power switch may be used.
・制御回路を、ハードウェアで構成される制御IC22と、プログラムを実行するCPUによるソフトウェアとを備えた構成としたが、制御IC22やASIC等の電子回路によりハードウェアで実現したり、ソフトウェアのみにより実現したりしてもよい。 The control circuit is configured to include a control IC 22 configured by hardware and software by a CPU that executes a program. However, the control circuit may be realized by hardware using an electronic circuit such as the control IC 22 or ASIC, or only by software. It may be realized.
・プリンター(印刷装置)は、印刷専用機に限らず、コピー機能やスキャナー機能を備えた複合機であってもよい。さらに、プリンターは、シリアルプリンター、ラインプリンターの他、ページプリンターのいずれであってもよい。また、プリンターは、携帯型、小型、中型プリンター及び大型プリンターでもよい。例えばビジネス用プリンターや大判プリンターでもよい。 The printer (printing apparatus) is not limited to a dedicated printing machine, but may be a multifunction machine having a copy function and a scanner function. Furthermore, the printer may be any of a page printer in addition to a serial printer and a line printer. The printer may be a portable type, a small size, a medium size printer, or a large size printer. For example, a business printer or a large format printer may be used.
・電子機器は、プリンター(複合機を含む。)に限らず、スキャナー、プロジェクター、デジタルカメラ(撮影装置)、デジタルオーディオ装置(音響機器)などであってもよい。 The electronic device is not limited to a printer (including a multifunction device) but may be a scanner, a projector, a digital camera (imaging device), a digital audio device (acoustic device), or the like.
11…電子機器の一例としてのプリンター、12…通信回路の一例としてのUSBコネクター、13…制御回路、14…充電式の電池の一例としての二次電池、15…駆動回路、16…印刷機構、20A…電源スイッチ、20B…操作部の一例としての操作スイッチ、22…判定回路の一例としての制御IC、23…電源回路、24…処理回路の一例としてのCPU、25…メモリー、26…第1スイッチ、30…外部装置及び第2の装置の一例としてのホスト装置、35…通信ケーブルの一例としてのUSBケーブル、40…外部装置及び第1の装置の一例としてのUSBバッテリーチャージャー、T1…タイムアウト時間の一例としての設定タイムアウト時間、T2…設定時間。 DESCRIPTION OF SYMBOLS 11 ... Printer as an example of an electronic device, 12 ... USB connector as an example of a communication circuit, 13 ... Control circuit, 14 ... Secondary battery as an example of a rechargeable battery, 15 ... Drive circuit, 16 ... Printing mechanism, 20A ... Power switch, 20B ... Operation switch as an example of an operation unit, 22 ... Control IC as an example of a determination circuit, 23 ... Power supply circuit, 24 ... CPU as an example of a processing circuit, 25 ... Memory, 26 ... First Switch, 30... Host device as an example of external device and second device, 35... USB cable as an example of communication cable, 40... USB battery charger as an example of external device and first device, T1. Setting timeout time as an example, T2... Setting time.
Claims (12)
制御回路と、
電源スイッチと、を備え、
初期状態において前記通信回路が外部装置と接続した場合に、前記制御回路は、
第1初期処理を行い、前記第1初期処理が完了したのちに、前記外部装置から電力供給を受け、
前記第1初期処理に失敗したときは、前記外部装置から電力供給を受けず、
前記第1初期処理が完了して前記外部装置との接続が継続している状態で前記外部装置と再接続を行う場合には、第1初期処理を行い、前記第1初期処理が完了したのちに、前記外部装置から電力供給を受け、
前記第1初期処理が失敗して前記外部装置との接続が継続している状態で前記外部装置と再接続を行う場合には、第1初期処理を行わず、前記外部装置から電力供給を受けない、ことを特徴とする電子機器。 A communication circuit connected to an external device for communication and receiving power supply;
A control circuit;
A power switch, and
When the communication circuit is connected to an external device in an initial state, the control circuit
The first initial process is performed, and after the first initial process is completed, power is supplied from the external device,
When the first initial process fails, no power is supplied from the external device,
When reconnecting with the external device in a state where the first initial processing is completed and the connection with the external device is continued, the first initial processing is performed and the first initial processing is completed. Receiving power supply from the external device,
When reconnecting with the external device while the first initial processing fails and the connection with the external device is continued, the first initial processing is not performed and power is supplied from the external device. No electronic equipment characterized by that.
前記制御回路が前記タイムアウトの発生を判定する際に用いるタイムアウト時間は、前記操作部の操作に基づいて設定されることを特徴とする請求項5、7、8のいずれか一項に記載の電子機器。 It has an operation unit that is operated to input data,
9. The electronic device according to claim 5, wherein a timeout time used when the control circuit determines occurrence of the timeout is set based on an operation of the operation unit. machine.
Priority Applications (4)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014126058A JP2016004516A (en) | 2014-06-19 | 2014-06-19 | Electronic device |
CN201510266645.4A CN105278650B (en) | 2014-05-28 | 2015-05-22 | Electronic equipment |
CN201811060864.7A CN109308111B (en) | 2014-05-28 | 2015-05-22 | Electronic device |
US14/724,493 US9665150B2 (en) | 2014-05-28 | 2015-05-28 | Electronic device with a control circuit to detect and establish a connection to host device |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
JP2014126058A JP2016004516A (en) | 2014-06-19 | 2014-06-19 | Electronic device |
Publications (1)
Publication Number | Publication Date |
---|---|
JP2016004516A true JP2016004516A (en) | 2016-01-12 |
Family
ID=55223721
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
JP2014126058A Pending JP2016004516A (en) | 2014-05-28 | 2014-06-19 | Electronic device |
Country Status (1)
Country | Link |
---|---|
JP (1) | JP2016004516A (en) |
Cited By (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017187976A1 (en) * | 2016-04-27 | 2017-11-02 | ソニー株式会社 | Electronic device, electronic device power supply method, electronic device power receiving method, and interface cable |
JP2019119207A (en) * | 2017-12-27 | 2019-07-22 | ブラザー工業株式会社 | Information processing device, method for controlling information processing device, and program |
JP2020166486A (en) * | 2019-03-29 | 2020-10-08 | ブラザー工業株式会社 | Information processing device, control method of information processing device, and program |
JP2021125906A (en) * | 2020-01-31 | 2021-08-30 | キヤノン株式会社 | Electronic apparatus, recording device, and method for controlling electronic apparatus |
-
2014
- 2014-06-19 JP JP2014126058A patent/JP2016004516A/en active Pending
Cited By (10)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
WO2017187976A1 (en) * | 2016-04-27 | 2017-11-02 | ソニー株式会社 | Electronic device, electronic device power supply method, electronic device power receiving method, and interface cable |
JPWO2017187976A1 (en) * | 2016-04-27 | 2019-02-28 | ソニー株式会社 | Electronic device, power supply method for electronic device, power reception method for electronic device, and interface cable |
US11604500B2 (en) | 2016-04-27 | 2023-03-14 | Sony Corporation | Electronic equipment, power supply method of electronic equipment, power reception method of electronic equipment, and interface cable |
JP2019119207A (en) * | 2017-12-27 | 2019-07-22 | ブラザー工業株式会社 | Information processing device, method for controlling information processing device, and program |
JP7156001B2 (en) | 2017-12-27 | 2022-10-19 | ブラザー工業株式会社 | Information processing device, control method for information processing device, and program |
JP2020166486A (en) * | 2019-03-29 | 2020-10-08 | ブラザー工業株式会社 | Information processing device, control method of information processing device, and program |
JP7338195B2 (en) | 2019-03-29 | 2023-09-05 | ブラザー工業株式会社 | Information processing device, control method for information processing device, and program |
JP2021125906A (en) * | 2020-01-31 | 2021-08-30 | キヤノン株式会社 | Electronic apparatus, recording device, and method for controlling electronic apparatus |
JP7413050B2 (en) | 2020-01-31 | 2024-01-15 | キヤノン株式会社 | Electronic equipment, control methods and programs |
JP7608590B2 (en) | 2020-01-31 | 2025-01-06 | キヤノン株式会社 | Electronic device, control method, and program |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN105278650B (en) | Electronic equipment | |
US11226670B2 (en) | Information processing apparatus, method of controlling the same, and non-transitory storage medium storing program executable by the information processing apparatus | |
US9395781B2 (en) | Electronic device to perform enumeration without power request to an external device when electronic device is on | |
US20200358919A1 (en) | Information processing apparatus having at least one interface for electric power transfer, method of controlling information processing apparatus to transfer electric power to an external device, and non-transitory computer-readable recording medium | |
JP2015174375A (en) | Image forming device and control method for the same, and program | |
US11209881B2 (en) | Information processing apparatus, control method of information processing apparatus, and program to transmit a power request to an external device | |
JP2016004516A (en) | Electronic device | |
US20130061079A1 (en) | Image processing apparatus, method for controlling the same and storage medium | |
JP2018006998A (en) | Communication device, control method, and program | |
US11093183B2 (en) | Information processing apparatus, control method of information processing apparatus, and program | |
JP6277866B2 (en) | Charging device and electronic device | |
JP6364991B2 (en) | Electronics | |
JP2021026343A (en) | Electronic device | |
JP2015189025A (en) | printer | |
US20180267811A1 (en) | Electronic apparatus and control method of the same | |
JP2018137921A (en) | Power supply device, power management method, and program | |
JP6586832B2 (en) | Information processing device | |
US11515720B2 (en) | Information processing apparatus and charging method therefor | |
JP2025006050A (en) | Printer | |
JP2015214113A (en) | Image formation apparatus | |
JP2006011809A (en) | Print system | |
JPH08186942A (en) | Portable electronic device and portable facsimile apparatus | |
JP2005227924A (en) | Print system | |
CN113459686A (en) | Printing apparatus | |
JP2019208187A (en) | Image forming apparatus |