1.. _adafruit_grand_central_m4_express:
2
3Adafruit Grand Central M4 Express
4#################################
5
6Overview
7********
8
9The Adafruit Grand Central M4 Express is an ARM development board with the
10form factor of an Arduino Mega.
11It features 70 GPIO pins, a microSDHC slot and 8MiB of QSPI Flash.
12
13.. figure:: img/adafruit_grand_central_m4_express.webp
14   :width: 800px
15   :align: center
16   :alt: Adafruit Grand Central M4 Express
17
18   Adafruit Grand Central M4 Express (Credit: Kattni Rembor / Adafruit)
19
20Hardware
21********
22
23- ATSAMD51P20A ARM Cortex-M4F processor at 120 MHz
24- 1024 KiB of flash memory and 256 KiB of RAM
25- 8 MiB of QSPI flash
26- A red user LED
27- A RGB "NeoPixel" / WS2812B LED
28- A microSDHC slot (connected via SPI)
29- Native USB port
30
31Supported Features
32==================
33
34The adafruit_grand_central_m4_express board configuration supports the following
35hardware features:
36
37+-----------+------------+------------------------------------------+
38| Interface | Controller | Driver/Component                         |
39+===========+============+==========================================+
40| NVIC      | on-chip    | Nested vector interrupt controller       |
41+-----------+------------+------------------------------------------+
42| SYSTICK   | on-chip    | SysTick                                  |
43+-----------+------------+------------------------------------------+
44| WDT       | on-chip    | Watchdog                                 |
45+-----------+------------+------------------------------------------+
46| GPIO      | on-chip    | I/O ports, User LED                      |
47+-----------+------------+------------------------------------------+
48| UART      | on-chip    | Serial ports, Console                    |
49+-----------+------------+------------------------------------------+
50| SPI       | on-chip    | SPI ports, microSDHC slot                |
51+-----------+------------+------------------------------------------+
52| TRNG      | on-chip    | True Random Number Generator             |
53+-----------+------------+------------------------------------------+
54| RTC       | on-chip    | Real-Time Counter                        |
55+-----------+------------+------------------------------------------+
56| USB       | on-chip    | USB device                               |
57+-----------+------------+------------------------------------------+
58| WDT       | on-chip    | Watchdog Timer                           |
59+-----------+------------+------------------------------------------+
60
61Other hardware features are not currently supported by Zephyr.
62
63The default configuration can be found in the Kconfig file
64:zephyr_file:`boards/adafruit/grand_central_m4_express/adafruit_grand_central_m4_express_defconfig`.
65
66Connections and IOs
67===================
68
69The `Adafruit Learning System`_ has detailed information about
70the board including `pinouts`_ and the `schematics`_.
71
72System Clock
73============
74
75The SAMD51 MCU is configured to use the 32.768 kHz external oscillator
76with the on-chip PLL generating the 120 MHz system clock.
77
78Serial Port
79===========
80
81The SAMD51 MCU has 8 SERCOM based UARTs. On the Grand Central, SERCOM0 is
82the Zephyr console and is available on RX(PB25) and TX(PB24).
83
84SPI Port
85========
86
87The SAMD51 MCU has 8 SERCOM based SPIs. On the Grand Central, SERCOM7 has been
88set into SPI mode to connect to devices over the SCK(PD09), MOSI(PD08), and MISO(PD11) pins.
89Additionally SERCOM2 has been configured as SPI to access the microSDHC card.
90
91I2C Port
92========
93
94The SAMD51 MCU has 8 SERCOM based I2Cs. On the Grand Central, SERCOM3 has been
95configured as I2C to connect to devices over the SCL(PB21) and SDA(PB20) pins.
96
97USB Device Port
98===============
99
100The SAMD51 MCU has a USB device port that can be used to communicate
101with a host PC.  See the :ref:`usb-samples` sample applications for
102more, such as the :zephyr:code-sample:`usb-cdc-acm` sample which sets up a virtual
103serial port that echos characters back to the host PC.
104
105Programming and Debugging
106*************************
107
108The Grand Central ships with a BOSSA compatible UF2 bootloader.
109The bootloader can be entered by quickly tapping the reset button twice.
110
111Flashing
112========
113
114#. Build the Zephyr kernel and the :ref:`hello_world` sample application:
115
116   .. zephyr-app-commands::
117      :zephyr-app: samples/hello_world
118      :board: adafruit_grand_central_m4_express
119      :goals: build
120      :compact:
121
122#. Connect the Grand Central to your host computer using USB.
123
124#. Connect a 3.3 V USB to serial adapter to the board and to the
125   host.  See the `Serial Port`_ section above for the board's pin
126   connections.
127
128#. Run your favorite terminal program to listen for output. Under Linux the
129   terminal should be :code:`/dev/ttyUSB0`. For example:
130
131   .. code-block:: console
132
133      $ minicom -D /dev/ttyUSB0 -o
134
135   The -o option tells minicom not to send the modem initialization
136   string. Connection should be configured as follows:
137
138   - Speed: 115200
139   - Data: 8 bits
140   - Parity: None
141   - Stop bits: 1
142
143#. Tap the reset button twice quickly to enter bootloader mode
144
145#. Flash the image:
146
147   .. zephyr-app-commands::
148      :zephyr-app: samples/hello_world
149      :board: adafruit_grand_central_m4_express
150      :goals: flash
151      :compact:
152
153   You should see "Hello World! adafruit_grand_central_m4_express" in your terminal.
154
155Debugging
156=========
157
158In addition to the built-in bootloader, the Grand Central can be flashed and
159debugged using a SWD probe such as the Segger J-Link.
160
161#. Connect the probe to the board using the 10-pin SWD interface.
162
163#. Flash the image:
164
165   .. zephyr-app-commands::
166      :zephyr-app: samples/hello_world
167      :board: adafruit_grand_central_m4_express
168      :goals: flash
169      :flash-args: -r openocd
170      :compact:
171
172#. Start debugging:
173
174   .. zephyr-app-commands::
175      :zephyr-app: samples/hello_world
176      :board: adafruit_grand_central_m4_express
177      :goals: debug
178      :compact:
179
180References
181**********
182
183.. target-notes::
184
185.. _Adafruit Learning System:
186    https://learn.adafruit.com/adafruit-grand-central
187
188.. _pinouts:
189    https://learn.adafruit.com/adafruit-grand-central/pinouts
190
191.. _schematics:
192    https://learn.adafruit.com/adafruit-grand-central/downloads
193
194.. _J-Link:
195    https://www.segger.com/products/debug-probes/j-link/technology/interface-description/
196