1.. _mm_swiftio:
2
3MadMachine SwiftIO
4##################
5
6Overview
7********
8
9The SwiftIO board, designed by MadMachine is the world's first board
10designed with support for the modern `Swift language
11<https://docs.swift.org/swift-book/>`_.  Zephyr provides basic
12low-level capabilities for the SwiftIO board. Swift application would
13run on top of Zephyr. More information about the board can be found
14at:
15
16- `MadMachine Homepage`_
17- `SwiftIO API Reference`_
18
19
20
21.. image:: mm_swiftio.jpg
22   :align: center
23   :alt: SwiftIO Board
24
25Hardware
26********
27
28- i.MX RT1052 Cortex-M7 processor at 600MHz
29- 8MB QSPI Flash, 32MB SDRAM
30- On-board DAPLink debugger with serial port
31- User RGB LED, USB 2.0 Connector, microSD slot
32
33
34
35Supported Features
36==================
37
38The mm_swiftio board configuration supports the following hardware
39features:
40
41+-----------+------------+-------------------------------------+
42| Interface | Controller | Driver/Component                    |
43+===========+============+=====================================+
44| NVIC      | on-chip    | nested vector interrupt controller  |
45+-----------+------------+-------------------------------------+
46| SYSTICK   | on-chip    | systick                             |
47+-----------+------------+-------------------------------------+
48| DISPLAY   | on-chip    | display                             |
49+-----------+------------+-------------------------------------+
50| GPIO      | on-chip    | gpio                                |
51+-----------+------------+-------------------------------------+
52| I2C       | on-chip    | i2c                                 |
53+-----------+------------+-------------------------------------+
54| SPI       | on-chip    | spi                                 |
55+-----------+------------+-------------------------------------+
56| UART      | on-chip    | serial port-polling;                |
57|           |            | serial port-interrupt               |
58+-----------+------------+-------------------------------------+
59| USB       | on-chip    | USB device                          |
60+-----------+------------+-------------------------------------+
61
62
63
64Connections and IOs
65===================
66
67Note:
68The following SwiftIO pinout diagram is used for Swift programming.
69The Swift ID is not the same as the Zephyr driver ID.
70
71+-----------+---------------+----------+---------------+--------------------------+
72| Name                      | GPIO                     | Other peripherals        |
73+===========+===============+==========+===============+==========+===============+
74| Swift ID  | Pin name      | Swift ID | Zephyr driver | Swift ID | Zephyr driver |
75+-----------+---------------+----------+---------------+----------+---------------+
76| P0        | GPIO_AD_B1_03 | D0       | GPIO1_IO19    |          |               |
77+-----------+---------------+----------+---------------+ UART0    | UART_2        |
78| P1        | GPIO_AD_B1_02 | D1       | GPIO1_IO18    |          |               |
79+-----------+---------------+----------+---------------+----------+---------------+
80| P2        | GPIO_AD_B0_03 | D2       | GPIO1_IO03    |          |               |
81+-----------+---------------+----------+---------------+ UART1    | UART_6        |
82| P3        | GPIO_AD_B0_02 | D3       | GPIO1_IO02    |          |               |
83+-----------+---------------+----------+---------------+----------+---------------+
84| P4        | GPIO_B1_14    | D4       | GPIO2_IO30    |          |               |
85+-----------+---------------+----------+---------------+----------+---------------+
86| P5        | GPIO_B1_15    | D5       | GPIO2_IO31    |          |               |
87+-----------+---------------+----------+---------------+----------+---------------+
88| P6        | GPIO_B0_03    | D6       | GPIO2_IO03    |          |               |
89+-----------+---------------+----------+---------------+          |               |
90| P7        | GPIO_B0_02    | D7       | GPIO2_IO02    |          |               |
91+-----------+---------------+----------+---------------+ SPI0     | SPI_4         |
92| P8        | GPIO_B0_01    | D8       | GPIO2_IO01    |          |               |
93+-----------+---------------+----------+---------------+          |               |
94| P9        | GPIO_B0_00    | D9       | GPIO2_IO00    |          |               |
95+-----------+---------------+----------+---------------+----------+---------------+
96| P10       | GPIO_B1_03    | D10      | GPIO2_IO19    |          |               |
97+-----------+---------------+----------+---------------+----------+---------------+
98| P11       | GPIO_B1_02    | D11      | GPIO2_IO18    |          |               |
99+-----------+---------------+----------+---------------+----------+---------------+
100| P12       | GPIO_B1_01    | D12      | GPIO2_IO17    |          |               |
101+-----------+---------------+----------+---------------+ UART2    | UART_4        |
102| P13       | GPIO_B1_00    | D13      | GPIO2_IO16    |          |               |
103+-----------+---------------+----------+---------------+----------+---------------+
104| P14       | GPIO_AD_B1_15 | D14      | GPIO1_IO31    |          |               |
105+-----------+---------------+----------+---------------+          |               |
106| P15       | GPIO_AD_B1_14 | D15      | GPIO1_IO30    |          |               |
107+-----------+---------------+----------+---------------+ SPI1     | SPI_3         |
108| P16       | GPIO_AD_B1_13 | D16      | GPIO1_IO29    |          |               |
109+-----------+---------------+----------+---------------+          |               |
110| P17       | GPIO_AD_B1_12 | D17      | GPIO1_IO28    |          |               |
111+-----------+---------------+----------+---------------+----------+---------------+
112| P18       | GPIO_AD_B1_11 | D18      | GPIO1_IO27    |          |               |
113+-----------+---------------+----------+---------------+ UART3    | UART_8        |
114| P19       | GPIO_AD_B1_10 | D19      | GPIO1_IO26    |          |               |
115+-----------+---------------+----------+---------------+----------+---------------+
116| P20       | GPIO_AD_B1_09 | D20      | GPIO1_IO25    |          |               |
117+-----------+---------------+----------+---------------+----------+---------------+
118| P21       | GPIO_AD_B1_08 | D21      | GPIO1_IO24    |          |               |
119+-----------+---------------+----------+---------------+----------+---------------+
120| P22       | GPIO_AD_B1_05 | D22      | GPIO1_IO21    |          |               |
121+-----------+---------------+----------+---------------+----------+---------------+
122| P23       | GPIO_AD_B1_04 | D23      | GPIO1_IO20    |          |               |
123+-----------+---------------+----------+---------------+----------+---------------+
124| P24       | GPIO_AD_B0_15 | D24      | GPIO1_IO15    |          |               |
125+-----------+---------------+----------+---------------+----------+---------------+
126| P25       | GPIO_AD_B0_14 | D25      | GPIO1_IO14    |          |               |
127+-----------+---------------+----------+---------------+----------+---------------+
128| P26       | GPIO_B0_04    | D26      | GPIO2_IO04    |          |               |
129+-----------+---------------+----------+---------------+----------+---------------+
130| P27       | GPIO_B0_05    | D27      | GPIO2_IO05    |          |               |
131+-----------+---------------+----------+---------------+----------+---------------+
132| P28       | GPIO_B0_06    | D28      | GPIO2_IO06    |          |               |
133+-----------+---------------+----------+---------------+----------+---------------+
134| P29       | GPIO_B0_07    | D29      | GPIO2_IO07    |          |               |
135+-----------+---------------+----------+---------------+----------+---------------+
136| P30       | GPIO_B0_08    | D30      | GPIO2_IO08    |          |               |
137+-----------+---------------+----------+---------------+----------+---------------+
138| P31       | GPIO_B0_09    | D31      | GPIO2_IO09    |          |               |
139+-----------+---------------+----------+---------------+----------+---------------+
140| P32       | GPIO_B0_10    | D32      | GPIO2_IO10    |          |               |
141+-----------+---------------+----------+---------------+----------+---------------+
142| P33       | GPIO_B0_11    | D33      | GPIO2_IO11    |          |               |
143+-----------+---------------+----------+---------------+----------+---------------+
144| P34       | GPIO_B0_12    | D34      | GPIO2_IO12    |          |               |
145+-----------+---------------+----------+---------------+----------+---------------+
146| P35       | GPIO_B0_13    | D35      | GPIO2_IO13    |          |               |
147+-----------+---------------+----------+---------------+----------+---------------+
148| P36       | GPIO_B0_14    | D36      | GPIO2_IO14    |          |               |
149+-----------+---------------+----------+---------------+----------+---------------+
150| P37       | GPIO_B0_15    | D37      | GPIO2_IO15    |          |               |
151+-----------+---------------+----------+---------------+----------+---------------+
152| P38       | GPIO_B1_11    | D38      | GPIO2_IO27    |          |               |
153+-----------+---------------+----------+---------------+----------+---------------+
154| P39       | GPIO_B1_10    | D39      | GPIO2_IO26    |          |               |
155+-----------+---------------+----------+---------------+----------+---------------+
156| P40       | GPIO_B1_9     | D40      | GPIO2_IO25    |          |               |
157+-----------+---------------+----------+---------------+----------+---------------+
158| P41       | GPIO_B1_8     | D41      | GPIO2_IO24    |          |               |
159+-----------+---------------+----------+---------------+----------+---------------+
160| P42       | GPIO_B1_7     | D42      | GPIO2_IO23    |          |               |
161+-----------+---------------+----------+---------------+----------+---------------+
162| P43       | GPIO_B1_6     | D43      | GPIO2_IO22    |          |               |
163+-----------+---------------+----------+---------------+----------+---------------+
164| P44       | GPIO_B1_5     | D44      | GPIO2_IO21    |          |               |
165+-----------+---------------+----------+---------------+----------+---------------+
166| P45       | GPIO_B1_4     | D45      | GPIO2_IO20    |          |               |
167+-----------+---------------+----------+---------------+----------+---------------+
168|           | GPIO_AD_B1_07 |          |               |          |               |
169+-----------+---------------+----------+---------------+ I2C0     | I2C_3         |
170|           | GPIO_AD_B1_06 |          |               |          |               |
171+-----------+---------------+----------+---------------+----------+---------------+
172|           | GPIO_AD_B1_00 |          |               |          |               |
173+-----------+---------------+----------+---------------+ I2C1     | I2C_1         |
174|           | GPIO_AD_B1_01 |          |               |          |               |
175+-----------+---------------+----------+---------------+----------+---------------+
176
177
178Programming and Flash
179*************************
180
181Build  applications as usual (see :ref:`build_an_application` for more details).
182
183Configuring a Debug Probe
184=========================
185
186This board is configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`,
187however the :ref:`pyocd-debug-host-tools` do not yet support programming the
188external flashes on this board so you must flash the device by copying files
189
190Configuring a Console
191=====================
192
193Regardless of your choice in debug probe, we will use the OpenSDA
194microcontroller as a USB-to-serial adapter for the serial console.
195
196Connect a USB cable from your PC to Serial of SwiftIO.
197
198Use the following settings with your serial terminal of choice (minicom, putty,
199etc.):
200
201- Speed: 115200
202- Data: 8 bits
203- Parity: None
204- Stop bits: 1
205
206Flashing
207========
208
209Here is an example for the :ref:`hello_world` application.
210
211Connect a USB cable from your PC to "Serial" port of SwiftIO.
212On Ubuntu, DAPLink debug probes appear on the host
213computer as a USB disk mounted to ``/media/<user>/SWIFTIODBGR/``,
214where ``<user>`` is your login name.
215
216.. code-block:: console
217
218    west build -b mm_swiftio samples/hello_world
219    cp build/zephyr/zephyr.bin /media/<user>/SWIFTIODBGR/
220
221
222Open a serial terminal, reset the board (press the "reset" button), and you should
223see the following message in the terminal:
224
225.. code-block:: console
226
227   ***** Booting Zephyr OS v2.1.0-rc1 *****
228   Hello World! mm_swiftio
229
230
231.. _MadMachine Homepage:
232   https://madmachine.io
233
234.. _SwiftIO API Reference:
235   https://madmachineio.github.io/SwiftIO/documentation/swiftio/
236