1.. zephyr:board:: adafruit_trinket_m0 2 3Overview 4******** 5 6The Adafruit Trinket M0 is a tiny (27 mm x 15 mm) ARM development 7board with an onboard RGB LED, USB port, and range of I/O broken out 8onto 5 pins. 9 10Hardware 11******** 12 13- ATSAMD21E18A ARM Cortex-M0+ processor at 48 MHz 14- 256 KiB flash memory and 32 KiB of RAM 15- Internal trimmed 8 MHz oscillator 16- A user LED 17- An RGB DotStar LED 18- Native USB port 19- One reset button 20 21Supported Features 22================== 23 24The adafruit_trinket_m0 board configuration supports the following hardware 25features: 26 27+-----------+------------+------------------------------------------+ 28| Interface | Controller | Driver/Component | 29+===========+============+==========================================+ 30| NVIC | on-chip | nested vector interrupt controller | 31+-----------+------------+------------------------------------------+ 32| Flash | on-chip | Can be used with LittleFS to store files | 33+-----------+------------+------------------------------------------+ 34| SYSTICK | on-chip | systick | 35+-----------+------------+------------------------------------------+ 36| WDT | on-chip | Watchdog | 37+-----------+------------+------------------------------------------+ 38| GPIO | on-chip | I/O ports | 39+-----------+------------+------------------------------------------+ 40| PWM | on-chip | Pulse Width Modulation | 41+-----------+------------+------------------------------------------+ 42| USART | on-chip | Serial ports | 43+-----------+------------+------------------------------------------+ 44| SPI | on-chip | Serial Peripheral Interface ports | 45+-----------+------------+------------------------------------------+ 46| USB | on-chip | USB device | 47+-----------+------------+------------------------------------------+ 48 49Other hardware features are not currently supported by Zephyr. 50 51The default configuration can be found in the Kconfig file 52:zephyr_file:`boards/adafruit/trinket_m0/adafruit_trinket_m0_defconfig`. 53 54Connections and IOs 55=================== 56 57The `Adafruit Trinket M0 Learn site`_ has detailed information about 58the board including `pinouts`_ and the `schematic`_. 59 60System Clock 61============ 62 63The SAMD21 MCU is configured to use the 8 MHz internal oscillator 64with the on-chip PLL generating the 48 MHz system clock. The internal 65APB and GCLK unit are set up in the same way as the upstream Arduino 66libraries. 67 68Serial Port 69=========== 70 71The SAMD21 MCU has 6 SERCOM based USARTs. On the Trinket, SERCOM0 is 72the Zephyr console and is available on pins 3 (RX) and 4 (TX). 73SERCOM2 is available on pins 2 (RX) and 0 (TX). 74 75PWM 76=== 77 78The SAMD21 MCU has 3 TCC based PWM units with up to 4 outputs each and a period 79of 24 bits or 16 bits. If :code:`CONFIG_PWM_SAM0_TCC` is enabled then LED0 is 80driven by TCC0 instead of by GPIO. 81 82SPI Port 83======== 84 85The SAMD21 MCU has 6 SERCOM based SPIs. On the Trinket, SERCOM1 is 86used to drive the DotStar RGB LED. SERCOM0 can be put into SPI mode 87and used to connect to devices over pin 2 (MISO), pin 4 (MOSI), and 88pin 3 (SCK). 89 90USB Device Port 91=============== 92 93The SAMD21 MCU has a USB device port that can be used to communicate 94with a host PC. See the :zephyr:code-sample-category:`usb` sample applications for 95more, such as the :zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual 96serial port that echos characters back to the host PC. 97 98Programming and Debugging 99************************* 100 101The Trinket M0 ships the BOSSA compatible UF2 bootloader. The 102bootloader can be entered by quickly tapping the reset button twice. 103 104Additionally, if :code:`CONFIG_USB_CDC_ACM` is enabled then the bootloader 105will be entered automatically when you run :code:`west flash`. 106 107Flashing 108======== 109 110#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application: 111 112 .. zephyr-app-commands:: 113 :zephyr-app: samples/hello_world 114 :board: adafruit_trinket_m0 115 :goals: build 116 :compact: 117 118#. Connect the Trinket M0 to your host computer using USB 119 120#. Connect a 3.3 V USB to serial adapter to the board and to the 121 host. See the `Serial Port`_ section above for the board's pin 122 connections. 123 124#. Run your favorite terminal program to listen for output. Under Linux the 125 terminal should be :code:`/dev/ttyACM0`. For example: 126 127 .. code-block:: console 128 129 $ minicom -D /dev/ttyACM0 -o 130 131 The -o option tells minicom not to send the modem initialization 132 string. Connection should be configured as follows: 133 134 - Speed: 115200 135 - Data: 8 bits 136 - Parity: None 137 - Stop bits: 1 138 139#. Tap the reset button twice quickly to enter bootloader mode 140 141#. Flash the image: 142 143 .. zephyr-app-commands:: 144 :zephyr-app: samples/hello_world 145 :board: adafruit_trinket_m0 146 :goals: flash 147 :compact: 148 149 You should see "Hello World! adafruit_trinket_m0" in your terminal. 150 151References 152********** 153 154.. target-notes:: 155 156.. _Adafruit Trinket M0 Learn site: 157 https://learn.adafruit.com/adafruit-trinket-m0-circuitpython-arduino 158 159.. _pinouts: 160 https://learn.adafruit.com/assets/49778 161 162.. _schematic: 163 https://learn.adafruit.com/assets/45723 164