last update: 2024/10
Demo Sample Application Folder:
Application └ _Exclude ├ USBH ..... USB Host各種クラス機能のデモサンプル
Sample | 説明 |
---|---|
USBH_Printer_Start | プリンタクラスドライバのデモサンプル |
USBH_MTP_Start | USBホストのMTPクラスドライバの使用方法を示すデモサンプル |
USBH_HID_Start | 標準HIDキーボード・マウスデバイス用デモサンプル |
USBH_FT232_Start | FTDI FT232クラスドライバのデモサンプル |
USBH_CreateInterfaceList | USBポートに接続されているデバイスのステータス及びデバイス情報をIOコンソールに表示します |
USBH_CDC_Start | USBホストのCDC-ACMクラスドライバのデモサンプル |
USBH_CCID_Start | CCID通信デバイスクラスドライバのデモサンプル |
USBH_BULK_Start | BULK(VENDOR)クラスドライバのデモサンプル |
USBH_AUDIO_ScanDevices | USBポートにAUDIOクラスデバイスが接続された時にデバイスのベンダ・コンフィグレーション情報を表示します |
USBH_AUDIO_Microphone | AUDIO(マイクロフォンデバイス)クラスドライバのデモサンプル |
BSP |- BSP_USB.c .......... ボード依存の初期化設定ファイル(USB-HOST) | |- Setup |- USBH_Config_Renesas_EK_RX261.c ........ USB-HOSTドライバ設定ファイル Config |- USBH_Conf.h ............... コンフィグレーション設定ファイル | |- IO | |- USBH_ConfigIO.c ....... デバッグコンソールIOインターフェース設定ファイル | |- OS |- lib_embOSLayer_RXv3_L.lib ..... OSインターフェース設定ファイル
プロジェクト設定では「\Application\_Exclude\USBH」フォルダはビルド対象外に設定しています。以下のどちらかの方法で動作確認を行うサンプルアプリケーションを選択します。
各テストアプリケーションの動作確認方法はテストサンプルアプリケーションのヘッダのコメント情報を参照ください。
プロジェクトを再ビルドし、EK-RX261評価ボードに接続してデバッグセッションを開始します。
テストアプリケーションの要件に合わせてUSBホストボードにデバイスを接続してプログラムを実行します。デバッガのIOコンソールのログ画面から結果を確認します。
評価ボードのジャンパー設定でJ20 USBポートをHOSTモードに変更します。
操作手順:プログラム起動してUSBポートにUSBデバイスを挿入します。対象デバイスのクラス、Vendor情報はログウインドウから確認します。以下、LANアダプタ及びUSBディスク接続の事例です。
Debug IO Console:
SEGGER Software Evaluation Sample Eval Board: EK-RX261 (32-bit RXv3 @64MHz) RTOS: SEGGER embOS ---------------------------------------------- 0:022 MainTask - INIT: emUSB-Host Init started. Version 2.36.5 0:023 MainTask - INIT: ********************************************************************* 0:024 MainTask - INIT: * emUSB-Host Configuration * 0:025 MainTask - INIT: ********************************************************************* 0:026 MainTask - INIT: * External hubs are ALLOWED 0:027 MainTask - INIT: * Time before communicating with a newly connected device: 300 ms 0:028 MainTask - INIT: ********************************************************************* 0:029 MainTask - INIT: Init completed 0:030 MainTask - INIT: Enumeration of devices enabled 0:031 USBH_Task - INIT: USBH_Task started 0:132 USBH_isr - INIT: USBH_ISRTask started 18:440 USBH_Task - APP: **** Device added [1] 18:533 MainTask - APP: **** Device information for interface with ID 1 18:534 MainTask - APP: Device ID: 1 18:535 MainTask - APP: Vendor ID: 0x0411 18:536 MainTask - APP: Product ID: 0x023A 18:537 MainTask - APP: BCD device version: 0x110 18:538 MainTask - APP: Interface number: 0 18:539 MainTask - APP: Device class: 0x8 18:540 MainTask - APP: Device subclass: 0x6 18:542 MainTask - APP: Device protocol: 0x50 18:543 MainTask - APP: Number of open handles: 0 18:544 MainTask - APP: Exclusive state: 0 18:545 MainTask - APP: Speed: FullSpeed 18:547 MainTask - APP: Manufacturer name: BUFFALO 18:549 MainTask - APP: Product name: USB Flash Disk 18:551 MainTask - APP: Serial number: 0708411D9C20BD43 18:552 MainTask - APP: connected to port 1 of controller 0 24:596 USBH_Task - APP: **** Device removed [1] 24:653 MainTask - APP: No devices found. 29:043 USBH_Task - APP: **** Device added [2] 29:054 MainTask - APP: **** Device information for interface with ID 2 29:055 MainTask - APP: Device ID: 2 29:056 MainTask - APP: Vendor ID: 0x0B95 29:057 MainTask - APP: Product ID: 0x7720 29:058 MainTask - APP: BCD device version: 0x1 29:059 MainTask - APP: Interface number: 0 29:060 MainTask - APP: Device class: 0xFF 29:061 MainTask - APP: Device subclass: 0xFF 29:062 MainTask - APP: Device protocol: 0x0 29:063 MainTask - APP: Number of open handles: 0 29:064 MainTask - APP: Exclusive state: 0 29:065 MainTask - APP: Speed: FullSpeed 29:070 MainTask - APP: Manufacturer name: ASIX Elec. Corp. 29:074 MainTask - APP: Product name: AX88x72A 29:077 MainTask - APP: Serial number: E54DF0 29:079 MainTask - APP: Configuration description: 0 29:082 MainTask - APP: Interface description: 0 29:084 MainTask - APP: connected to port 1 of controller 0 36:779 USBH_Task - APP: **** Device removed [2] 36:785 MainTask - APP: No devices found.
操作手順:プログラム起動してUSBポートにHID キーボードデバイスを挿入します。キーボードデバイスからキーを入力してレスポンスをログコンソールから確認します。
Debug IO Console:
SEGGER Software Evaluation Sample Eval Board: EK-RX261 (32-bit RXv3 @64MHz) RTOS: SEGGER embOS ---------------------------------------------- 0:022 MainTask - INIT: emUSB-Host Init started. Version 2.36.5 0:023 MainTask - INIT: ********************************************************************* 0:024 MainTask - INIT: * emUSB-Host Configuration * 0:025 MainTask - INIT: ********************************************************************* 0:026 MainTask - INIT: * External hubs are ALLOWED 0:027 MainTask - INIT: * Time before communicating with a newly connected device: 300 ms 0:028 MainTask - INIT: ********************************************************************* 0:029 MainTask - INIT: Init completed 0:030 MainTask - INIT: Enumeration of devices enabled 0:031 USBH_Task - INIT: USBH_Task started 0:132 USBH_isr - INIT: USBH_ISRTask started 27:105 USBH_Task - APP: **** Device added [0] 27:126 USBH_Task - APP: **** Device added [1] 37:396 MainTask - APP: Keyboard: Key e/E - pressed 37:458 MainTask - APP: Keyboard: Key e/E - released 37:856 MainTask - APP: Keyboard: Key m/M - pressed 37:911 MainTask - APP: Keyboard: Key m/M - released 38:446 MainTask - APP: Keyboard: Key LeftShift - pressed 38:780 MainTask - APP: Keyboard: Key u/U - pressed 38:827 MainTask - APP: Keyboard: Key u/U - released 38:946 MainTask - APP: Keyboard: Key s/S - pressed 39:049 MainTask - APP: Keyboard: Key s/S - released 39:185 MainTask - APP: Keyboard: Key b/B - pressed 39:264 MainTask - APP: Keyboard: Key b/B - released 39:327 MainTask - APP: Keyboard: Key LeftShift - released 39:501 MainTask - APP: Keyboard: Key Spacebar - pressed 39:548 MainTask - APP: Keyboard: Key Spacebar - released 39:650 MainTask - APP: Keyboard: Key LeftShift - pressed 39:744 MainTask - APP: Keyboard: Key h/H - pressed 39:782 MainTask - APP: Keyboard: Key h/H - released 39:869 MainTask - APP: Keyboard: Key LeftShift - released 40:579 MainTask - APP: Keyboard: Key LeftShift - pressed 40:680 MainTask - APP: Keyboard: Key o/O - pressed 40:758 MainTask - APP: Keyboard: Key o/O - released 40:908 MainTask - APP: Keyboard: Key s/S - pressed 41:010 MainTask - APP: Keyboard: Key s/S - released 41:080 MainTask - APP: Keyboard: Key t/T - pressed 41:158 MainTask - APP: Keyboard: Key t/T - released 41:332 MainTask - APP: Keyboard: Key LeftShift - released 50:576 MainTask - APP: Keyboard: Key LeftShift - pressed 50:671 MainTask - APP: Keyboard: Key t/T - pressed 50:726 MainTask - APP: Keyboard: Key t/T - released 50:765 MainTask - APP: Keyboard: Key LeftShift - released 50:962 MainTask - APP: Keyboard: Key e/E - pressed 51:001 MainTask - APP: Keyboard: Key e/E - released 51:320 MainTask - APP: Keyboard: Key s/S - pressed 51:321 MainTask - APP: Keyboard: Key s/S - released 51:424 MainTask - APP: Keyboard: Key t/T - pressed 51:487 MainTask - APP: Keyboard: Key t/T - released 54:133 USBH_Task - *** Warning *** HID: _SubmitInBuffer: SubmitUrb USBH_STATUS_DEVICE_REMOVED 54:134 USBH_Task - APP: **** Device removed [0] 54:135 USBH_Task - APP: **** Device removed [1]
操作手順:プログラム起動してUSBポートにFTD UARTチップセットのUSB-UART変換アダプタデバイスを挿入します。UARTポートをパソコンに接続してTeraTermなど起動してCOMポートコンソールを開きます。COMポートコンソールから文字を入力してログコンソールからECHOレスポンスを確認します。
Debug IO Console:
6:223 USBH_Task - APP: **** Device added [0] 6:233 MainTask - APP: Vendor Id = 0x0403 6:234 MainTask - APP: Product Id = 0x6001 6:235 MainTask - APP: bcdDevice = 0x0400 58:543 MainTask - APP: Received: "F" 58:730 MainTask - APP: Received: "T" 61:443 MainTask - APP: Received: "2" 61:982 MainTask - APP: Received: "3" 62:393 MainTask - APP: Received: "2" 64:387 MainTask - APP: Received: "C" 64:829 MainTask - APP: Received: "l" 64:968 MainTask - APP: Received: "a" 65:315 MainTask - APP: Received: "s" 65:486 MainTask - APP: Received: "s" 66:393 MainTask - APP: Received: "T" 66:559 MainTask - APP: Received: "e" 66:806 MainTask - APP: Received: "s" 66:898 MainTask - APP: Received: "t"
操作手順:USB AUDIOデバイス(スピーカー・ヘッドセットなど)を挿入してプログラムを実行します。ログコンソールからAUDIOデバイスの情報を確認します。
Debug IO Console:
SEGGER Software Evaluation Sample Eval Board: EK-RX261 (32-bit RXv3 @64MHz) RTOS: SEGGER embOS ---------------------------------------------- 0:022 MainTask - INIT: emUSB-Host Init started. Version 2.36.5 0:023 MainTask - INIT: ********************************************************************* 0:024 MainTask - INIT: * emUSB-Host Configuration * 0:025 MainTask - INIT: ********************************************************************* 0:026 MainTask - INIT: * External hubs are ALLOWED 0:027 MainTask - INIT: * Time before communicating with a newly connected device: 300 ms 0:028 MainTask - INIT: ********************************************************************* 0:029 MainTask - INIT: Init completed 0:030 MainTask - INIT: Enumeration of devices enabled 0:032 USBH_Task - INIT: USBH_Task started 0:133 USBH_isr - INIT: USBH_ISRTask started 23:664 USBH_Task - APP: **** AUDIO Interface added [0] 23:665 USBH_Task - APP: **** AUDIO Interface added [1] 23:666 USBH_Task - APP: **** AUDIO Interface added [2] 23:684 MainTask - APP: AUDIO control interface found (DevId 1): 23:686 MainTask - APP: Vendor 1038, Product 12EC, Version 1.0 23:691 MainTask - APP: Manuf.: SteelSeries 23:696 MainTask - APP: Prod. : Arctis Nova 3 23:697 MainTask - APP: Input terminal 3 23:698 MainTask - APP: Terminal type 201 23:699 MainTask - APP: Output terminal 5, Source 9 23:700 MainTask - APP: Terminal type 101 23:701 MainTask - APP: Input terminal 4 23:702 MainTask - APP: Terminal type 101 23:703 MainTask - APP: Output terminal 6, Source 8 23:704 MainTask - APP: Terminal type 302 23:706 MainTask - APP: Feature Unit 7, Source 3 23:707 MainTask - APP: Control channel 0, mask = 1 23:708 MainTask - APP: Control channel 1, mask = 2 23:717 MainTask - APP: Volume: Cur = 0, Min = FFFFEE60, Max = 0, Res = 60 23:718 MainTask - APP: Control channel 2, mask = 2 23:727 MainTask - APP: Volume: Cur = 0, Min = FFFFEE60, Max = 0, Res = 60 23:728 MainTask - APP: Feature Unit 8, Source 4 23:729 MainTask - APP: Control channel 0, mask = 1 23:730 MainTask - APP: Control channel 1, mask = 2 23:740 MainTask - APP: Volume: Cur = 0, Min = FFFFBE60, Max = 0, Res = 60 23:741 MainTask - APP: Control channel 2, mask = 2 23:750 MainTask - APP: Volume: Cur = 0, Min = FFFFBE60, Max = 0, Res = 60 23:751 MainTask - APP: AUDIO streaming interface found (DevId 1): 23:752 MainTask - APP: Found streaming IN EP on AltSetting 1 23:753 MainTask - APP: Terminal Link 5 23:754 MainTask - APP: Channels=2, Frame=2, Resolution=16 23:755 MainTask - APP: Sampling Frequencies: 23:756 MainTask - APP: 44100 Hz 23:757 MainTask - APP: Found streaming IN EP on AltSetting 2 23:758 MainTask - APP: Terminal Link 5 23:759 MainTask - APP: Channels=2, Frame=3, Resolution=24 23:760 MainTask - APP: Sampling Frequencies: 23:761 MainTask - APP: 44100 Hz 23:762 MainTask - APP: Found streaming IN EP on AltSetting 3 23:763 MainTask - APP: Terminal Link 5 23:765 MainTask - APP: Channels=2, Frame=2, Resolution=16 23:766 MainTask - APP: Sampling Frequencies: 23:767 MainTask - APP: 48000 Hz 23:768 MainTask - APP: Found streaming IN EP on AltSetting 4 23:769 MainTask - APP: Terminal Link 5 23:770 MainTask - APP: Channels=2, Frame=3, Resolution=24 23:771 MainTask - APP: Sampling Frequencies: 23:772 MainTask - APP: 48000 Hz 23:773 MainTask - APP: AUDIO streaming interface found (DevId 1): 23:774 MainTask - APP: Found streaming OUT EP on AltSetting 1 23:775 USBH_Task - APP: **** AUDIO Interface removed [0] 23:776 USBH_Task - APP: **** AUDIO Interface removed [1] 23:777 USBH_Task - APP: **** AUDIO Interface removed [2] 23:778 MainTask - APP: Terminal Link 4 23:779 MainTask - APP: Channels=2, Frame=2, Resolution=16 23:780 MainTask - APP: Sampling Frequencies: 23:781 MainTask - APP: 44100 Hz 26:484 USBH_Task - APP: **** AUDIO Interface added [0] 26:485 USBH_Task - APP: **** AUDIO Interface added [1] 26:486 USBH_Task - APP: **** AUDIO Interface added [2] 26:532 MainTask - APP: AUDIO control interface found (DevId 2): 26:533 MainTask - APP: Vendor 1038, Product 12EC, Version 1.0 26:538 MainTask - APP: Manuf.: SteelSeries 26:542 MainTask - APP: Prod. : Arctis Nova 3 26:543 MainTask - APP: Input terminal 3 26:544 MainTask - APP: Terminal type 201 26:545 MainTask - APP: Output terminal 5, Source 7 26:546 MainTask - APP: Terminal type 101 26:547 MainTask - APP: Input terminal 4 26:548 MainTask - APP: Terminal type 101 26:549 MainTask - APP: Output terminal 6, Source 8 26:550 MainTask - APP: Terminal type 302 26:551 MainTask - APP: Feature Unit 7, Source 3 26:552 MainTask - APP: Control channel 0, mask = 1 26:553 MainTask - APP: Control channel 1, mask = 2 26:562 MainTask - APP: Volume: Cur = 0, Min = FFFFEE60, Max = 0, Res = 60 26:563 MainTask - APP: Control channel 2, mask = 2 26:572 MainTask - APP: Volume: Cur = 0, Min = FFFFEE60, Max = 0, Res = 60 26:573 MainTask - APP: Feature Unit 8, Source 4 26:574 MainTask - APP: Control channel 0, mask = 1 26:575 MainTask - APP: Control channel 1, mask = 2 26:584 MainTask - APP: Volume: Cur = 0, Min = FFFFBE60, Max = 0, Res = 60 26:585 MainTask - APP: Control channel 2, mask = 2 26:594 MainTask - APP: Volume: Cur = 0, Min = FFFFBE60, Max = 0, Res = 60 26:595 MainTask - APP: AUDIO streaming interface found (DevId 2): 26:596 MainTask - APP: Found streaming IN EP on AltSetting 1 26:597 MainTask - APP: Terminal Link 5 26:598 MainTask - APP: Channels=2, Frame=2, Resolution=16 26:599 MainTask - APP: Sampling Frequencies: 26:600 MainTask - APP: 48000 Hz 26:602 MainTask - APP: AUDIO streaming interface found (DevId 2): 26:603 MainTask - APP: Found streaming OUT EP on AltSetting 1 26:604 MainTask - APP: Terminal Link 4 26:605 MainTask - APP: Channels=2, Frame=2, Resolution=16 26:606 MainTask - APP: Sampling Frequencies: 26:607 MainTask - APP: 44100 Hz 26:608 MainTask - APP: Found streaming OUT EP on AltSetting 2 26:609 MainTask - APP: Terminal Link 4 26:610 MainTask - APP: Channels=2, Frame=3, Resolution=24 26:611 MainTask - APP: Sampling Frequencies: 26:612 MainTask - APP: 44100 Hz 26:613 MainTask - APP: Found streaming OUT EP on AltSetting 3 26:614 MainTask - APP: Terminal Link 4 26:615 MainTask - APP: Channels=2, Frame=2, Resolution=16 26:616 MainTask - APP: Sampling Frequencies: 26:617 MainTask - APP: 48000 Hz 26:618 MainTask - APP: Found streaming OUT EP on AltSetting 4 26:619 MainTask - APP: Terminal Link 4 26:620 MainTask - APP: Channels=2, Frame=3, Resolution=24 26:621 MainTask - APP: Sampling Frequencies: 26:622 MainTask - APP: 48000 Hz
操作手順:AUDIO SPEAKERデバイスを挿入してプログラムを実行します。スピーカーから音声「It simply works」を確認します。
Debug IO Console:
0:969 USBH_Task - APP: **** AUDIO Interface added [0] 0:970 USBH_Task - APP: **** AUDIO Interface added [1] 0:971 USBH_Task - APP: **** AUDIO Interface added [2] 0:982 MainTask - APP: AUDIO device: 0:983 MainTask - APP: Vendor 0B0E, Product 0420, Version 1.0 0:985 MainTask - APP: Prod. : Jabra SPEAK 510 USB 0:986 MainTask - APP: Found streaming OUT, Channels=2, Frame=2, Resolution=16 0:987 MainTask - APP: Sampling Frequencies: 0:988 MainTask - APP: 8000 Hz 0:989 MainTask - APP: 16000 Hz 0:990 MainTask - APP: 48000 Hz 0:991 MainTask - APP: Configure Audio device... 0:992 MainTask - APP: SetAltInterface to 1 0:994 MainTask - APP: SetSampleFreq to 48000 Hz 0:999 MainTask - APP: Feature unit 2, Source 1 1:000 MainTask - APP: Unmute Unit 2, control 0 1:004 MainTask - APP: Get volume unit 2, control 0 1:009 MainTask - APP: Volume[0] = FFFFE800, FFFFDC00, 800, 400 1:010 MainTask - APP: Set volume to 30 % (E933) 1:016 MainTask - APP: Feature unit 5, Source 4 1:017 MainTask - APP: Unmute Unit 5, control 0 1:019 MainTask - APP: Get volume unit 5, control 0 1:024 MainTask - APP: Volume[0] = FFFFFA00, FFFFF400, 900, 300 1:025 MainTask - APP: Set volume to 30 % (FA4C) 1:032 MainTask - APP: Open streaming channel 1:033 MainTask - APP: Playing .... 3:517 MainTask - APP: End
セキュリティ機能の評価