1.. zephyr:board:: adafruit_feather_m4_express
2
3Overview
4********
5
6The Adafruit Feather M4 Express is a compact, lightweight
7ARM development board with an onboard mini NeoPixel, 2 MiB
8of SPI flash, charging status indicator and user LEDs, USB
9connector, 21 GPIO pins and a small prototyping area.
10
11Hardware
12********
13
14- ATSAMD51J19A ARM Cortex-M4 processor at 120 MHz
15- 512 KiB of flash memory and 192 KiB of RAM
16- 2 MiB of SPI flash
17- Internal trimmed 8 MHz oscillator
18- A user LED
19- An RGB NeoPixel LED
20- Native USB port
21- One reset button
22
23Supported Features
24==================
25
26.. zephyr:board-supported-hw::
27
28Zephyr can use the default Cortex-M SYSTICK timer or the SAM0 specific RTC.
29To use the RTC, set :code:`CONFIG_CORTEX_M_SYSTICK=n` and set
30:code:`CONFIG_SYS_CLOCK_TICKS_PER_SEC` to no more than 32 kHZ divided by 7,
31i.e. no more than 4500.
32
33Connections and IOs
34===================
35
36The `Adafruit Learning System`_ has detailed information about
37the board including `pinouts`_ and the `schematic`_.
38
39System Clock
40============
41
42The SAMD51 MCU is configured to use the 32 kHz internal oscillator
43with the on-chip PLL generating the 120 MHz system clock.
44
45Serial Port
46===========
47
48The SAMD51 MCU has 6 SERCOM based USARTs.  On the Feather, SERCOM5 is
49the Zephyr console and is available on pins 0 (RX) and 1 (TX).
50
51SPI Port
52========
53
54The SAMD51 MCU has 6 SERCOM based SPIs. On the Feather, SERCOM1 can be put
55into SPI mode and used to connect to devices over the SCK (SCLK), MO (MOSI), and
56MI (MISO) pins.
57
58PWM
59===
60
61The SAMD51 has three PWM generators with up to six channels each.  :code:`TCC_0`
62has a resolution of 24 bits and all other generators are 16 bit.  :code:`TCC_1`
63pin 2 is mapped to PA18 (D7) and pin 3 is mapped to PA19 (D9).
64
65USB Device Port
66===============
67
68The SAMD51 MCU has a USB device port that can be used to communicate
69with a host PC.  See the :ref:`usb` sample applications for
70more, such as the :zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual
71serial port that echos characters back to the host PC.
72
73Programming and Debugging
74*************************
75
76The Feather ships with a the BOSSA compatible UF2 bootloader.  The
77bootloader can be entered by quickly tapping the reset button twice.
78
79Additionally, if :kconfig:option:`CONFIG_USB_CDC_ACM` is enabled then the
80bootloader will be entered automatically when you run :code:`west flash`.
81
82Flashing
83========
84
85#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application:
86
87   .. zephyr-app-commands::
88      :zephyr-app: samples/hello_world
89      :board: adafruit_feather_m4_express
90      :goals: build
91      :compact:
92
93#. Connect the feather to your host computer using USB
94
95#. Connect a 3.3 V USB to serial adapter to the board and to the
96   host.  See the `Serial Port`_ section above for the board's pin
97   connections.
98
99#. Run your favorite terminal program to listen for output. Under Linux the
100   terminal should be :code:`/dev/ttyUSB0`. For example:
101
102   .. code-block:: console
103
104      $ minicom -D /dev/ttyUSB0 -o
105
106   The -o option tells minicom not to send the modem initialization
107   string. Connection should be configured as follows:
108
109   - Speed: 115200
110   - Data: 8 bits
111   - Parity: None
112   - Stop bits: 1
113
114#. Tap the reset button twice quickly to enter bootloader mode
115
116#. Flash the image:
117
118   .. zephyr-app-commands::
119      :zephyr-app: samples/hello_world
120      :board: adafruit_feather_m4_express
121      :goals: flash
122      :compact:
123
124   You should see "Hello World! adafruit_feather_m4_express" in your terminal.
125
126Debugging
127=========
128
129In addition to the built-in bootloader, the Feather can be flashed and
130debugged using a SWD probe such as the Segger J-Link.
131
132#. Connect the board to the probe by connecting the :code:`SWCLK`,
133   :code:`SWDIO`, :code:`RESET`, :code:`GND`, and :code:`3V3` pins on the
134   Feather to the :code:`SWCLK`, :code:`SWDIO`, :code:`RESET`, :code:`GND`,
135   and :code:`VTref` pins on the `J-Link`_.
136
137#. Flash the image:
138
139   .. zephyr-app-commands::
140      :zephyr-app: samples/hello_world
141      :board: adafruit_feather_m4_express
142      :goals: flash
143      :flash-args: -r openocd
144      :compact:
145
146#. Start debugging:
147
148   .. zephyr-app-commands::
149      :zephyr-app: samples/hello_world
150      :board: adafruit_feather_m4_express
151      :goals: debug
152      :compact:
153
154References
155**********
156
157.. target-notes::
158
159.. _Adafruit Learning System:
160    https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51
161
162.. _pinouts:
163    https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/pinouts
164
165.. _schematic:
166    https://learn.adafruit.com/adafruit-feather-m4-express-atsamd51/downloads
167
168.. _J-Link:
169    https://www.segger.com/products/debug-probes/j-link/technology/interface-description/
170