TinyUSB is Awesome! And tutorial about how to use it in SAMD21 board

Unlike the Arduino Uno and Arduino Nano, the Seeeduino XIAO onboard USB is not supported by the common USB-to-serial chip. These chips are usually FT232, CP2102, CH340, and etc. The main chip ATSAMD21 of Seeeduino XIAO is natively supporting the USB protocol stack. This feature means that the USB function can be changed by the code. 

Other boards with natively USB support:

  • ATMEGA32U4 chip:
    • Arduino Micro
  • ATSAMD21
    • Seeeduino XIAO
    • Adafruit Feather M0
  • ATSAMD51
    • Wio Terminal
    • Adafruit Feather M4.

With this feature, Seeeduino XIAO is very suitable as the controller of DIY USB devices, such as the DIY mechanical keyboard, it is time to say goodbye to the slow 8-bit ATMEGA32U4 development board.

Next, we use Seeeduino XIAO to try to run the powerful and popular TinyUSB software stack

First, go to TinyUSB GitHub repository: https://github.com/hathach/tinyusb

For ATSAMD21 based development board like Seeeduino XIAO, we can use this Arduino TinyUSB library by Adafruit: https://github.com/adafruit/Adafruit_TinyUSB_Arduino

Download the Zip files, and include it in Arduino IDE

Let’s try to run this example, Adafruit TinyUSB Library → MassStorage → msc_ramdisk

Then, change the USB Stack of Arduino IDE from “Arduino” to “TinyUSB”

Hit Download button:

And the MassStorage Disk appeared !!

There is a README.txt inside.

Let us see what can we do with this powerful TinyUSB library:

  • Human Interface Device (HID): Generic (In & Out), Keyboard, Mouse, Gamepad, etc …
  • Mass Storage Class (MSC): with multiple LUNs
  • Musical Instrument Digital Interface (MIDI)
  • WebUSB with vendor-specific class

About Author

Calendar

April 2020
M T W T F S S
 12345
6789101112
13141516171819
20212223242526
27282930