1.. _mimxrt1020_evk:
2
3NXP MIMXRT1020-EVK
4##################
5
6Overview
7********
8
9The i.MX RT1020 expands the i.MX RT crossover processor families by providing
10high-performance feature set in low-cost LQFP packages, further simplifying
11board design and layout for customers. The i.MX RT1020 runs on the Arm®
12Cortex®-M7 core at 500 MHz.
13
14.. image:: mimxrt1020_evk.jpg
15   :align: center
16   :alt: MIMXRT1020-EVK
17
18Hardware
19********
20
21- MIMXRT1021DAG5A MCU
22
23- Memory
24
25  - 256 Mbit SDRAM
26  - 64 Mbit QSPI Flash
27  - TF socket for SD card
28
29- Connectivity
30
31  - 10/100 Mbit/s Ethernet PHY
32  - Micro USB host and OTG connectors
33  - CAN transceivers
34  - Arduino interface
35
36- Audio
37
38  - Audio Codec
39  - 4-pole audio headphone jack
40  - Microphone
41  - External speaker connection
42
43- Power
44
45  - 5 V DC jack
46
47- Debug
48
49  - JTAG 20-pin connector
50  - OpenSDA with DAPLink
51
52For more information about the MIMXRT1020 SoC and MIMXRT1020-EVK board, see
53these references:
54
55- `i.MX RT1020 Website`_
56- `i.MX RT1020 Datasheet`_
57- `i.MX RT1020 Reference Manual`_
58- `MIMXRT1020-EVK Website`_
59- `MIMXRT1020-EVK User Guide`_
60- `MIMXRT1020-EVK Design Files`_
61
62Supported Features
63==================
64
65The mimxrt1020_evk board configuration supports the hardware features listed
66below.  For additional features not yet supported, please also refer to the
67:ref:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family.
68NXP prioritizes enabling the superset board with NXP's Full Platform Support for
69Zephyr.  Therefore, the mimxrt1064_evk board may have additional features
70already supported, which can also be re-used on this mimxrt1020_evk board:
71
72+-----------+------------+-------------------------------------+
73| Interface | Controller | Driver/Component                    |
74+===========+============+=====================================+
75| NVIC      | on-chip    | nested vector interrupt controller  |
76+-----------+------------+-------------------------------------+
77| SYSTICK   | on-chip    | systick                             |
78+-----------+------------+-------------------------------------+
79| FLASH     | on-chip    | QSPI flash                          |
80+-----------+------------+-------------------------------------+
81| GPIO      | on-chip    | gpio                                |
82+-----------+------------+-------------------------------------+
83| SPI       | on-chip    | spi                                 |
84+-----------+------------+-------------------------------------+
85| I2C       | on-chip    | i2c                                 |
86+-----------+------------+-------------------------------------+
87| SDHC      | on-chip    | disk access                         |
88+-----------+------------+-------------------------------------+
89| UART      | on-chip    | serial port-polling;                |
90|           |            | serial port-interrupt               |
91+-----------+------------+-------------------------------------+
92| ENET      | on-chip    | ethernet                            |
93+-----------+------------+-------------------------------------+
94| USB       | on-chip    | USB device                          |
95+-----------+------------+-------------------------------------+
96| ADC       | on-chip    | adc                                 |
97+-----------+------------+-------------------------------------+
98| GPT       | on-chip    | gpt                                 |
99+-----------+------------+-------------------------------------+
100| TRNG      | on-chip    | entropy                             |
101+-----------+------------+-------------------------------------+
102| FLEXSPI   | on-chip    | flash programming                   |
103+-----------+------------+-------------------------------------+
104
105The default configuration can be found in the defconfig file:
106``boards/arm/mimxrt1020_evk/mimxrt1020_evk_defconfig``
107
108Other hardware features are not currently supported by the port.
109
110Connections and I/Os
111====================
112
113The MIMXRT1020 SoC has five pairs of pinmux/gpio controllers.
114
115+---------------+-----------------+---------------------------+
116| Name          | Function        | Usage                     |
117+===============+=================+===========================+
118| GPIO_AD_B0_05 | GPIO            | LED                       |
119+---------------+-----------------+---------------------------+
120| GPIO_AD_B0_06 | LPUART1_TX      | UART Console              |
121+---------------+-----------------+---------------------------+
122| GPIO_AD_B0_07 | LPUART1_RX      | UART Console              |
123+---------------+-----------------+---------------------------+
124| GPIO_AD_B1_08 | LPUART2_TX      | UART BT HCI               |
125+---------------+-----------------+---------------------------+
126| GPIO_AD_B1_09 | LPUART2_RX      | UART BT HCI               |
127+---------------+-----------------+---------------------------+
128| GPIO_AD_B1_14 | LPI2C1_SCL      | I2C                       |
129+---------------+-----------------+---------------------------+
130| GPIO_AD_B1_15 | LPI2C1_SDA      | I2C                       |
131+---------------+-----------------+---------------------------+
132| GPIO_SD_B1_02 | LPI2C4_SCL      | I2C                       |
133+---------------+-----------------+---------------------------+
134| GPIO_SD_B1_03 | LPI2C4_SDA      | I2C                       |
135+---------------+-----------------+---------------------------+
136| WAKEUP        | GPIO            | SW0                       |
137+---------------+-----------------+---------------------------+
138| GPIO_AD_B0_04 | ENET_RST        | Ethernet                  |
139+---------------+-----------------+---------------------------+
140| GPIO_AD_B0_08 | ENET_REF_CLK    | Ethernet                  |
141+---------------+-----------------+---------------------------+
142| GPIO_AD_B0_09 | ENET_RX_DATA01  | Ethernet                  |
143+---------------+-----------------+---------------------------+
144| GPIO_AD_B0_10 | ENET_RX_DATA00/LPSPI1_SCK | Ethernet/SPI    |
145+---------------+-----------------+---------------------------+
146| GPIO_AD_B0_11 | ENET_RX_EN/LPSPI1_PCS0 | Ethernet/SPI       |
147+---------------+-----------------+---------------------------+
148| GPIO_AD_B0_12 | ENET_RX_ER/LPSPI1_SDO | Ethernet/SPI        |
149+---------------+-----------------+---------------------------+
150| GPIO_AD_B0_13 | ENET_TX_EN/LPSPI1_SDI | Ethernet/SPI        |
151+---------------+-----------------+---------------------------+
152| GPIO_AD_B0_14 | ENET_TX_DATA00  | Ethernet                  |
153+---------------+-----------------+---------------------------+
154| GPIO_AD_B0_15 | ENET_TX_DATA01  | Ethernet                  |
155+---------------+-----------------+---------------------------+
156| GPIO_AD_B1_06 | ENET_INT        | Ethernet                  |
157+---------------+-----------------+---------------------------+
158| GPIO_EMC_41   | ENET_MDC        | Ethernet                  |
159+---------------+-----------------+---------------------------+
160| GPIO_EMC_40   | ENET_MDIO       | Ethernet                  |
161+---------------+-----------------+---------------------------+
162| GPIO_AD_B1_07 | USDHC1_VSELECT  | SD Card                   |
163+---------------+-----------------+---------------------------+
164| GPIO_SD_B0_02 | USDHC1_CMD      | SD Card                   |
165+---------------+-----------------+---------------------------+
166| GPIO_SD_B0_03 | USDHC1_CLK      | SD Card                   |
167+---------------+-----------------+---------------------------+
168| GPIO_SD_B0_04 | USDHC1_DATA0    | SD Card                   |
169+---------------+-----------------+---------------------------+
170| GPIO_SD_B0_05 | USDHC1_DATA1    | SD Card                   |
171+---------------+-----------------+---------------------------+
172| GPIO_SD_B0_00 | USDHC1_DATA2    | SD Card                   |
173+---------------+-----------------+---------------------------+
174| GPIO_SD_B0_01 | USDHC1_DATA3    | SD Card                   |
175+---------------+-----------------+---------------------------+
176| GPIO_SD_B0_06 | USDHC1_CD_B     | SD Card                   |
177+---------------+-----------------+---------------------------+
178| GPIO_AD_B1_10 | ADC             | ADC1 Channel 10           |
179+---------------+-----------------+---------------------------+
180| GPIO_AD_B1_11 | ADC             | ADC1 Channel 11           |
181+---------------+-----------------+---------------------------+
182
183System Clock
184============
185
186The MIMXRT1020 SoC is configured to use SysTick as the system clock source,
187running at 500MHz.
188
189When power management is enabled, the 32 KHz low frequency
190oscillator on the board will be used as a source for the GPT timer to
191generate a system clock. This clock enables lower power states, at the
192cost of reduced resolution
193
194
195Serial Port
196===========
197
198The MIMXRT1020 SoC has eight UARTs. ``LPUART1`` is configured for the console,
199``LPUART2`` for the Bluetooth Host Controller Interface (BT HCI), and the
200remaining are not used.
201
202Programming and Debugging
203*************************
204
205Build and flash applications as usual (see :ref:`build_an_application` and
206:ref:`application_run` for more details).
207
208Configuring a Debug Probe
209=========================
210
211A debug probe is used for both flashing and debugging the board. This board is
212configured by default to use the :ref:`opensda-daplink-onboard-debug-probe`,
213however the :ref:`pyocd-debug-host-tools` do not yet support programming the
214external flashes on this board so you must reconfigure the board for one of the
215following debug probes instead.
216
217Option 1: :ref:`opensda-jlink-onboard-debug-probe` (Recommended)
218----------------------------------------------------------------
219
220Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
221path.
222
223Follow the instructions in :ref:`opensda-jlink-onboard-debug-probe` to program
224the `OpenSDA J-Link MIMXRT1020-EVK Firmware`_. Check that jumpers J27 and J28
225are **on** (they are on by default when boards ship from the factory) to ensure
226SWD signals are connected to the OpenSDA microcontroller.
227
228Option 2: :ref:`jlink-external-debug-probe`
229-------------------------------------------
230
231Install the :ref:`jlink-debug-host-tools` and make sure they are in your search
232path.
233
234Attach a J-Link 20-pin connector to J16. Check that jumpers J27 and J28 are
235**off** (they are on by default when boards ship from the factory) to ensure
236SWD signals are disconnected from the OpenSDA microcontroller.
237
238Configuring a Console
239=====================
240
241Regardless of your choice in debug probe, we will use the OpenSDA
242microcontroller as a usb-to-serial adapter for the serial console. Check that
243jumpers J25 and J26 are **on** (they are on by default when boards ship from
244the factory) to connect UART signals to the OpenSDA microcontroller.
245
246Connect a USB cable from your PC to J23.
247
248Use the following settings with your serial terminal of choice (minicom, putty,
249etc.):
250
251- Speed: 115200
252- Data: 8 bits
253- Parity: None
254- Stop bits: 1
255
256Flashing
257========
258
259Here is an example for the :ref:`hello_world` application.
260
261.. zephyr-app-commands::
262   :zephyr-app: samples/hello_world
263   :board: mimxrt1020_evk
264   :goals: flash
265
266Open a serial terminal, reset the board (press the SW5 button), and you should
267see the following message in the terminal:
268
269.. code-block:: console
270
271   ***** Booting Zephyr OS v1.14.0-rc1 *****
272   Hello World! mimxrt1020_evk
273
274Debugging
275=========
276
277Here is an example for the :ref:`hello_world` application.
278
279.. zephyr-app-commands::
280   :zephyr-app: samples/hello_world
281   :board: mimxrt1020_evk
282   :goals: debug
283
284Open a serial terminal, step through the application in your debugger, and you
285should see the following message in the terminal:
286
287.. code-block:: console
288
289   ***** Booting Zephyr OS v1.14.0-rc1 *****
290   Hello World! mimxrt1020_evk
291
292.. _MIMXRT1020-EVK Website:
293   https://www.nxp.com/support/developer-resources/run-time-software/i.mx-developer-resources/i.mx-rt1020-evaluation-kit:MIMXRT1020-EVK
294
295.. _MIMXRT1020-EVK User Guide:
296   https://www.nxp.com/webapp/Download?colCode=MIMXRT1020EVKHUG
297
298.. _MIMXRT1020-EVK Design Files:
299   https://www.nxp.com/webapp/Download?colCode=MIMXRT1020-EVK-Design-Files
300
301.. _i.MX RT1020 Website:
302   https://www.nxp.com/products/processors-and-microcontrollers/arm-based-processors-and-mcus/i.mx-applications-processors/i.mx-rt-series/i.mx-rt1020-crossover-processor-with-arm-cortex-m7-core:i.MX-RT1020
303
304.. _i.MX RT1020 Datasheet:
305   https://www.nxp.com/docs/en/data-sheet/IMXRT1020CEC.pdf
306
307.. _i.MX RT1020 Reference Manual:
308   https://www.nxp.com/webapp/Download?colCode=IMXRT1020RM
309
310.. _OpenSDA J-Link MIMXRT1020-EVK Firmware:
311   https://www.segger.com/downloads/jlink/OpenSDA_MIMXRT1020-EVK
312