1.. zephyr:board:: mimxrt1040_evk
2
3Overview
4********
5
6i.MX RT1040 crossover MCUs add additional flexibility with new packages and an
7extended temperature range up to 125° C. The i.MX RT1040 MCU has a compact
89x9 mm package, as well as the 11x11 mm package that supports implementing a
92-layer PCB design. The i.MX RT1040 MCUs run on the Arm® Cortex®-M7 core at
10600 MHz.
11
12Hardware
13********
14
15- MIMXRT1042XJM5B MCU (600 MHz, 512 KB TCM)
16
17- Memory
18
19  - 256 MBit SDRAM (Winbond W9825G6KH)
20  - 64 Mbit QSPI Flash (Winbond W25Q64JVSSIQ)
21
22- Display
23
24  - LCD connector
25  - Touch connector
26
27- Ethernet
28
29  - 10/100 Mbit/s Ethernet PHY
30
31- USB
32
33  - USB 2.0 OTG connector
34
35- Audio
36
37  - 3.5 mm audio stereo headphone jack
38  - Board-mounted microphone
39
40- Power
41
42  - 5 V DC jack
43
44- Debug
45
46  - JTAG 20-pin connector
47  - OpenSDA with DAPLink
48
49- Expansion port
50
51  - Arduino interface
52
53- CAN bus connector
54
55For more information about the MIMXRT1040 SoC and MIMXRT1040-EVK board, see
56these references:
57
58- `i.MX RT1040 Website`_
59- `i.MX RT1040 Datasheet`_
60- `i.MX RT1040 Reference Manual`_
61- `MIMXRT1040-EVK Website`_
62- `MIMXRT1040-EVK User Guide`_
63- `MIMXRT1040-EVK Design Files`_
64
65External Memory
66===============
67
68This platform has the following external memories:
69
70+----------------+------------+-------------------------------------+
71| Device         | Controller | Status                              |
72+================+============+=====================================+
73| W9825G6KH      | SEMC       | Enabled via device configuration    |
74|                |            | data block, which sets up SEMC at   |
75|                |            | boot time                           |
76+----------------+------------+-------------------------------------+
77| W25Q64JVSSIQ   | FLEXSPI    | Enabled via flash configurationn    |
78|                |            | block, which sets up FLEXSPI at     |
79|                |            | boot time. Supported for XIP only.  |
80+----------------+------------+-------------------------------------+
81
82Supported Features
83==================
84
85The mimxrt1040_evk board configuration supports the hardware features listed
86below.  For additional features not yet supported, please also refer to the
87:zephyr:board:`mimxrt1064_evk` , which is the superset board in NXP's i.MX RT10xx family.
88NXP prioritizes enabling the superset board with NXP's Full Platform Support for
89Zephyr.  Therefore, the mimxrt1064_evk board may have additional features
90already supported, which can also be re-used on this mimxrt1040_evk board:
91
92+-----------+------------+-------------------------------------+
93| Interface | Controller | Driver/Component                    |
94+===========+============+=====================================+
95| NVIC      | on-chip    | nested vector interrupt controller  |
96+-----------+------------+-------------------------------------+
97| SYSTICK   | on-chip    | systick                             |
98+-----------+------------+-------------------------------------+
99| GPIO      | on-chip    | gpio                                |
100+-----------+------------+-------------------------------------+
101| UART      | on-chip    | serial port-polling;                |
102|           |            | serial port-interrupt               |
103+-----------+------------+-------------------------------------+
104| PWM       | on-chip    | pwm                                 |
105+-----------+------------+-------------------------------------+
106| ADC       | on-chip    | adc                                 |
107+-----------+------------+-------------------------------------+
108| SPI       | on-chip    | spi                                 |
109+-----------+------------+-------------------------------------+
110| DMA       | on-chip    | dma                                 |
111+-----------+------------+-------------------------------------+
112| I2C       | on-chip    | i2c                                 |
113+-----------+------------+-------------------------------------+
114| GPT       | on-chip    | gpt                                 |
115+-----------+------------+-------------------------------------+
116| DISPLAY   | on-chip    | eLCDIF. Tested with                 |
117|           |            | :ref:`rk043fn02h_ct`, and           |
118|           |            | :ref:`rk043fn66hs_ctg` shields      |
119+-----------+------------+-------------------------------------+
120| UART      | NXP NW61x  | M.2 WIFI/BT module                  |
121+-----------+------------+-------------------------------------+
122
123The default configuration can be found in
124:zephyr_file:`boards/nxp/mimxrt1040_evk/mimxrt1040_evk_defconfig`
125
126Other hardware features are not currently supported by the port.
127
128Connections and IOs
129===================
130
131The MIMXRT1040 SoC has five pairs of pinmux/gpio controllers.
132
133+---------------+-----------------+---------------------------+
134| Name          | Function        | Usage                     |
135+===============+=================+===========================+
136| GPIO_AD_B0_12 | LPUART1_TX      | UART Console              |
137+---------------+-----------------+---------------------------+
138| GPIO_AD_B0_13 | LPUART1_RX      | UART Console              |
139+---------------+-----------------+---------------------------+
140| WAKEUP        | GPIO            | SW0                       |
141+---------------+-----------------+---------------------------+
142| GPIO_AD_B0_08 | GPIO            | User LD1                  |
143+---------------+-----------------+---------------------------+
144| GPIO_AD_B0_10 | FLEXPWM1 PWM3A  | PWM Output                |
145+---------------+-----------------+---------------------------+
146| GPIO_AD_B0_14 | ADC0 IN3        | ADC0 Input                |
147+---------------+-----------------+---------------------------+
148| GPIO_AD_B0_15 | ADC0 IN4        | ADC0 Input                |
149+---------------+-----------------+---------------------------+
150| GPIO_SD_B0_02 | LPSPI1_SDO      | SPI Output                |
151+---------------+-----------------+---------------------------+
152| GPIO_SD_B0_03 | LPSPI1_SDI      | SPI Input                 |
153+---------------+-----------------+---------------------------+
154| GPIO_SD_B0_00 | LPSPI1_SCK      | SPI Clock                 |
155+---------------+-----------------+---------------------------+
156| GPIO_SD_B0_00 | LPSPI1_SCK      | SPI Clock                 |
157+---------------+-----------------+---------------------------+
158| GPIO_AD_B1_00 | LPI2C1_SCL      | I2C Clock                 |
159+---------------+-----------------+---------------------------+
160| GPIO_AD_B1_01 | LPI2C1_SDA      | I2C Data                  |
161+---------------+-----------------+---------------------------+
162| GPIO_AD_B1_06 | LPUART3_TX      | M.2 BT HCI                |
163+---------------+-----------------+---------------------------+
164| GPIO_AD_B1_07 | LPUART3_RX      | M.2 BT HCI                |
165+---------------+-----------------+---------------------------+
166| GPIO_AD_B1_04 | LPUART3_CTS_b   | M.2 BT HCI                |
167+---------------+-----------------+---------------------------+
168| GPIO_AD_B1_05 | LPUART3_RTS_b   | M.2 BT HCI                |
169+---------------+-----------------+---------------------------+
170
171.. note::
172        In order to use the SPI peripheral on this board, resistors R350, R346,
173        and R360 must be populated with zero ohm resistors.
174
175System Clock
176============
177
178The MIMXRT1040 SoC is configured to use SysTick as the system clock source,
179running at 600MHz.
180
181When power management is enabled, the 32 KHz low frequency
182oscillator on the board will be used as a source for the GPT timer to
183generate a system clock. This clock enables lower power states, at the
184cost of reduced resolution
185
186Serial Port
187===========
188
189The MIMXRT1040 SoC has eight UARTs. ``LPUART1`` is configured for the console,
190``LPUART3`` for the Bluetooth Host Controller Interface (BT HCI),
191and the remaining UARTs are not used.
192
193Fetch Binary Blobs
194==================
195
196The board Bluetooth/WiFi module requires fetching some binary blob files, to do
197that run the command:
198
199.. code-block:: console
200
201   west blobs fetch hal_nxp
202
203.. note:: Only Bluetooth functionality is currently supported.
204
205Programming and Debugging
206*************************
207
208This board supports 3 debug host tools. Please install your preferred host
209tool, then follow the instructions in `Configuring a Debug Probe`_ to
210configure the board appropriately.
211
212* :ref:`jlink-debug-host-tools` (Default, Supported by NXP)
213* :ref:`linkserver-debug-host-tools` (Supported by NXP)
214* :ref:`pyocd-debug-host-tools` (Not supported by NXP)
215
216Once the host tool and board are configured, build and flash applications
217as usual (see :ref:`build_an_application` and :ref:`application_run` for more
218details).
219
220Configuring a Debug Probe
221=========================
222
223For the RT1040, J9/J10 are the SWD isolation jumpers, J12 is the DFU
224mode jumper, and J2 is the 20 pin JTAG/SWD header.
225
226.. include:: ../../common/rt1xxx-lpclink2-debug.rst
227   :start-after: rt1xxx-lpclink2-probes
228
229Configuring a Console
230=====================
231
232Regardless of your choice in debug probe, we will use the OpenSDA
233microcontroller as a usb-to-serial adapter for the serial console. Check that
234jumpers J11 and J13 are **on** (they are on by default when boards ship from
235the factory) to connect UART signals to the OpenSDA microcontroller.
236
237Connect a USB cable from your PC to J1.
238
239Use the following settings with your serial terminal of choice (minicom, putty,
240etc.):
241
242- Speed: 115200
243- Data: 8 bits
244- Parity: None
245- Stop bits: 1
246
247Flashing
248========
249
250Here is an example for the :zephyr:code-sample:`hello_world` application.
251
252.. zephyr-app-commands::
253   :zephyr-app: samples/hello_world
254   :board: mimxrt1040_evk
255   :goals: flash
256
257Open a serial terminal, reset the board (press the SW1 button), and you should
258see the following message in the terminal:
259
260.. code-block:: console
261
262   ***** Booting Zephyr OS Booting Zephyr OS build v3.3.0-rc3-66 *****
263   Hello World! mimxrt1040_evk
264
265Debugging
266=========
267
268Here is an example for the :zephyr:code-sample:`hello_world` application.
269
270.. zephyr-app-commands::
271   :zephyr-app: samples/hello_world
272   :board: mimxrt1040_evk
273   :goals: debug
274
275Open a serial terminal, step through the application in your debugger, and you
276should see the following message in the terminal:
277
278.. code-block:: console
279
280   ***** Booting Zephyr OS Booting Zephyr OS build v3.3.0-rc3-66 *****
281   Hello World! mimxrt1040_evk
282
283Troubleshooting
284===============
285
286USER_LED D8
287-----------
288The MIMXRT1040-EVK board ships with the wireless module in the M.2 connector,
289and with jumper J80 shorted.  This causes a conflict with the USER_LED D8,
290and the LED will not turn off.  Samples and applications using USER_LED D8,
291like blinky, require removal of J80 jumper.
292
293Boot Header
294-----------
295
296If the debug probe fails to connect with the following error, it's possible
297that the boot header in QSPI is invalid or corrupted. The boot header is
298configured by :kconfig:option:`CONFIG_NXP_IMXRT_BOOT_HEADER`.
299
300.. code-block:: console
301
302   Remote debugging using :2331
303   Remote communication error.  Target disconnected.: Connection reset by peer.
304   "monitor" command not supported by this target.
305   "monitor" command not supported by this target.
306   You can't do that when your target is `exec'
307   (gdb) Could not connect to target.
308   Please check power, connection and settings.
309
310You can fix it by erasing and reprogramming the QSPI with the following
311steps:
312
313#. Set the SW4 DIP switches to OFF-OFF-OFF-ON to boot into the ROM bootloader.
314
315#. Reset by pressing SW1
316
317#. Run ``west debug`` or ``west flash`` again with a known working Zephyr
318   application.
319
320#. Set the SW4 DIP switches to OFF-OFF-ON-OFF to boot from QSPI.
321
322#. Reset by pressing SW1
323
324Bluetooth Module
325----------------
326
327For Murate 2EL M.2 Mdoule, the following hardware rework needs to be applied,
328Solder 0 ohm resistors for R96, and R93.
329Remove resistors from R497, R498, R456 and R457.
330
331And due to pin conflict issue, the PCM interface of Bluetooth module cannot be supported.
332
333For the debugger fails to connect with the following error, please refer to the next section.
334
335WiFi Module
336-----------
337
338If the debugger fails to connect with the following error, it's possible
339the M.2 WiFi module is interfering with the debug signals
340
341.. code-block:: console
342
343   Remote debugging using :2331
344   Remote communication error.  Target disconnected.: Connection reset by peer.
345   "monitor" command not supported by this target.
346   "monitor" command not supported by this target.
347   You can't do that when your target is `exec'
348   (gdb) Could not connect to target.
349   Please check power, connection and settings.
350
351To resolve this, you may remove the M.2 WiFi module from the board when
352flashing or debugging it, or remove jumper J80.
353
354
355.. _MIMXRT1040-EVK Website:
356   https://www.nxp.com/design/development-boards/i-mx-evaluation-and-development-boards/i-mx-rt1040-evaluation-kit:MIMXRT1040-EVK
357
358.. _MIMXRT1040-EVK User Guide:
359   https://www.nxp.com/webapp/Download?colCode=MIMXRT1040-EVKUM
360
361.. _MIMXRT1040-EVK Design Files:
362   https://www.nxp.com/webapp/Download?colCode=MIMXRT1040-EVK-DESIGNFILES
363
364.. _i.MX RT1040 Website:
365   https://www.nxp.com/products/processors-and-microcontrollers/arm-microcontrollers/i-mx-rt-crossover-mcus/i-mx-rt1040-crossover-mcu-with-arm-cortex-m7-core:i.MX-RT1040
366
367.. _i.MX RT1040 Datasheet:
368   https://www.nxp.com/docs/en/data-sheet/IMXRT1040CEC.pdf
369
370.. _i.MX RT1040 Reference Manual:
371   https://www.nxp.com/webapp/Download?colCode=IMXRT1040RM
372
373.. _NXP AN13206:
374   https://www.nxp.com/docs/en/application-note/AN13206.pdf
375