44.9. TINYUSB HOST CDC MSC HID FREERTOS

44.9.1. Overview

This example project shows USB CDC MSC HID HOST

44.9.2. Board Setting

  • Connect a USB port on PC to the PWR DEBUG port on the development board with a USB Type-C cable

  • Connect a USB port on the development board USB0 to cdc, hid or msc device with a USB Type-C convert Type-A cable

44.9.3. Running the example

  • Download the program to the development board to run, and use the serial port debugging assistant to view the output log

44.9.3.1. Connected with a keyboard

  • When the USB port0 of the development board is connected with a keyboard, the serial port debugging assistant will display the following data:

TinyUSB Host CDC MSC HID Example
HID device address = 1, instance = 0 is mounted
HID Interface Protocol = Keyboard
HID device address = 1, instance = 1 is mounted
HID Interface Protocol = None
HID has 2 reports
  • When the keyboard is pressed, the data sent by the keyboard will be displayed, for example, input “hpmicro”:

hpmicro

44.9.3.2. Connected with a mouse

  • When the USB port0 of the development board is connected with a mouse, the serial port debugging assistant will display the following data:

TinyUSB Host CDC MSC HID Example
HID device address = 1, instance = 0 is mounted
HID Interface Protocol = Mouse
  • When moving or clicking the mouse, the data sent by the mouse will be displayed:

(-25 -68 0)
(-18 -44 0)
(-12 -27 0)
(-7 -16 0)
(-1 -1 0)
(1 -2 0)
(5 -5 0)

44.9.3.3. Connected with a U disk

  • When the USB port0 of the development board is connected with a U disk, the serial port debugging assistant will display the U disk information data:

TinyUSB Host CDC MSC HID Example
A MassStorage device is mounted
A device with address 1 is mounted
IS917    innostor rev 1.00
Disk Size: 7500 MB
Block Count = 15360000, Block Size: 512

44.9.3.4. Connected with a CDC-ACM device

  • When the USB port0 of the development board is connected with a CDC-ACM device (the CDC ACM Device sample path is: samples/cherryusb/device/cdc_acm/cdc_acm_vcom), the serial port debugging assistant will display the following data:

TinyUSB Host CDC MSC HID Example
CDC Interface is mounted: address = 1, itf_num = 0
  Baudrate: 115200, Stop Bits : 0
  Parity  : 0, Data Width: 8
  • When you type any characters in the Host’s console, the Host will send them to the CDC device via the CDC ACM protocol. The CDC device will send the data back to the Host after receiving it, and the Host will print the received data in the console. The expected test result: the Host Console can echo back the input characters.