The board support code is only used for self-contained examples and testing. It is not used when TinyUSB is part of a larger project. It is responsible for getting the MCU started and the USB peripheral clocked with minimal of on-board devices
- One LED : for status
- One Button : to get input from user
- One UART : optional for device, but required for host examples
This code base already had supported for a handful of following boards
- Adafruit Circuit Playground Express
- Adafruit Feather M0 Express
- Adafruit Metro M0 Express
- Adafruit Feather M4 Express
- Adafruit Metro M4 Express
- Adafruit Feather nRF52840 Express
- Adafruit Circuit Playground Bluefruit
- Nordic nRF52840 Development Kit (aka pca10056)
- Nordic nRF52840 Dongle (aka pca10059)
- LPCXpresso 11u37
- LPCXpresso 11u68
- LPCXpresso 1347
- ARM mbed LPC1768
- LPCXpresso 1769
- Keil MCB1800 Evaluation Board
- Embedded Artists LPC4088 Quick Start board
- NGX LPC4330-Xplorer
- Embedded Artists LPC4357 Developer Kit
- LPCXpresso 51U68
- LPCXpresso 54114
- LPCXpresso 55s69 EVK
- Adafruit Feather STM32F405
- Micro Python PyBoard v1.1
- STM32 L035c8 Discovery
- STM32 F070rb Nucleo
- STM32 F072rb Discovery
- STM32 F103c Blue Pill
- STM32 F207zg Nucleo
- STM32 F303vc Discovery
- STM32 F407vg Discovery
- STM32 F411ve Discovery
- STM32 F412zg Discovery
- STM32 F767zi Nucleo
- STM32 H743zi Nucleo
If you don't possess any of supported board above. Don't worry you can easily implemented your own one by following this guide as long as the mcu is supported.
- Create new makefile for your board at
hw/bsp/<board name>/board.mk
and linker file as well if needed. - Create new source file for your board at
hw/bsp/<board name>/<board name>.c
and implement following APIs
Is responsible for starting the MCU, setting up the USB clock and USB pins. It is also responsible for initializing LED and button pins. One useful clock debugging technique is to set up a PWM output at a known value such as 500hz based on the USB clock so that you can verify it is correct with a logic probe or oscilloscope. Setup your USB in a crystal-less mode when available. That makes the code easier to port across boards.
Set the pin corresponding to the led to output a value that lights the LED when state
is true.
Return current state of button, a 1
means active (pressed), a 0
means inactive.
The function returns the elapsed number of milliseconds since startup. On ARM this is commonly done with SysTick or Timer. This provide examples a way to measure time to blink LED or delay properly. It is only required when run examples without RTOS CFG_TUSB_OS == OPT_OS_NONE
.
Get characters from UART peripheral.
Send characters to UART peripheral.