source: rtems-docs/user/bsps/arm/imxrt.rst @ 238b48f9

Last change on this file since 238b48f9 was 238b48f9, checked in by Christian Mauderer <christian.mauderer@…>, on 07/15/21 at 13:31:17

user/imxrt: Add notes about problems with EVB

There are some possible problems with the i.MXRT1050 evaluation board.
Make some notes about that in the BSP manual.

  • Property mode set to 100644
File size: 8.0 KB
Line 
1.. SPDX-License-Identifier: CC-BY-SA-4.0
2
3.. Copyright (C) 2020 embedded brains GmbH
4.. Copyright (C) 2020 Christian Mauderer
5
6imxrt (NXP i.MXRT)
7==================
8
9This BSP offers only one variant, the `imxrt1052`. This variant supports the
10i.MXRT 1052 processor on a IMXRT1050-EVKB (tested with rev A1). You can also
11configure it to work with custom boards.
12
13NOTE: The IMXRT1050-EVKB has an backlight controller that must not be enabled
14without load. Make sure to either attach a load, disable it by software or
15disable it by removing the 0-Ohm resistor on it's input.
16
17Build Configuration Options
18---------------------------
19
20Please see the documentation of the `IMXRT_*` and `BSP_*` configuration options
21for that. You can generate a default set of options with::
22
23  ./waf bsp_defaults --rtems-bsps=arm/imxrt1052 > config.ini
24
25Boot Process
26------------
27
28There are two possible boot processes supported:
29
301) The ROM code loads a configuration from HyperFlash (connected to FlexSPI),
31   does some initialization (based on device configuration data (DCD)) and then
32   starts the application. This is the default case. `linkcmds.flexspi` is used
33   for this case.
34
352) Some custom bootloader does the basic initialization, loads the application
36   to SDRAM and starts it from there. Select the `linkcmds.sdram` for this.
37
38For programming the HyperFlash in case 1, you can use the on board debugger
39integrated into the IMXRT1050-EVKB. You can generate a flash image out of a
40compiled RTEMS application with for example::
41
42  arm-rtems6-objcopy -O binary build/arm/imxrt1052/testsuites/samples/hello.exe hello.bin
43
44Then just copy the generated binary to the mass storage provided by the
45debugger. Wait a bit till the mass storage vanishes and re-appears. After that,
46reset the board and the newly programmed application will start.
47
48NOTE: It seems that there is a bug on at least some of the on board debuggers.
49They can't write more than 1MB to the HyperFlash. If your application is bigger
50than that (like quite some of the applications in libbsd), you should use an
51external debugger or find some alternative programming method.
52
53For debugging: Create a special application with a `while(true)` loop at end of
54`bsp_start_hook_1`. Load that application into flash. Then remove the loop
55again, build your BSP for SDRAM and use a debugger to load the application into
56SDRAM after the BSP started from flash did the basic initialization.
57
58Flash Image
59-----------
60
61For booting from a HyperFlash (or other storage connected to FlexSPI), the ROM
62code of the i.MXRT first reads some special flash header information from a
63fixed location of the connected flash device. This consists of the Image vector
64table (IVT), Boot data and Device configuration data (DCD).
65
66In RTEMS, these flash headers are generated using some C-structures. If you use
67a board other than the IMXRT1050-EVKB, those structures have to be adapted. To
68do that re-define the following variables in your application (you only need the
69ones that need different values):
70
71.. code-block:: c
72
73  #include <bsp/flash-headers.h>
74  const uint8_t imxrt_dcd_data[] =
75      { /* Your DCD data here */ };
76  const ivt imxrt_image_vector_table =
77      { /* Your IVT here */ };
78  const BOOT_DATA_T imxrt_boot_data =
79      { /* Your boot data here */ };
80  const flexspi_nor_config_t imxrt_flexspi_config =
81      { /* Your FlexSPI config here */ };
82
83You can find the default definitions in `bsps/arm/imxrt/start/flash-*.c`. Take a
84look at the `i.MX RT1050 Processor Reference Manual, Rev. 4, 12/2019` chapter
85`9.7 Program image` for details about the contents.
86
87FDT
88---
89
90The BSP uses a FDT based initialization. The FDT is linked into the application.
91You can find the default FDT used in the BSP in
92`bsps/arm/imxrt/dts/imxrt1050-evkb.dts`. The FDT is split up into two parts. The
93core part is put into an `dtsi` file and is installed together with normal
94headers into `${PREFIX}/arm-rtems6/imxrt1052/lib/include`. You can use that to
95create your own device tree based on that. Basically use something like::
96
97  /dts-v1/;
98 
99  #include <imxrt/imxrt1050-pinfunc.h>
100  #include <imxrt/imxrt1050.dtsi>
101 
102  &lpuart1 {
103          pinctrl-0 = <&pinctrl_lpuart1>;
104          status = "okay";
105  };
106 
107  &chosen {
108          stdout-path = &lpuart1;
109  };
110 
111  /* put your further devices here */
112 
113  &iomuxc {
114          pinctrl_lpuart1: lpuart1grp {
115                  fsl,pins = <
116                          IMXRT_PAD_GPIO_AD_B0_12__LPUART1_TX     0x8
117                          IMXRT_PAD_GPIO_AD_B0_13__LPUART1_RX     0x13000
118                  >;
119          };
120 
121          /* put your further pinctrl groups here */
122  };
123
124You can then convert your FDT into a C file with (replace `YOUR.dts` and similar
125with your FDT source names)::
126
127  sh> arm-rtems6-cpp -P -x assembler-with-cpp \
128                     -I ${PREFIX}/arm-rtems6/imxrt1052/lib/include \
129                     -include "YOUR.dts" /dev/null | \
130            dtc -O dtb -o "YOUR.dtb" -b 0 -p 64
131  sh> rtems-bin2c -C -N imxrt_dtb "YOUR.dtb" "YOUR.c"
132
133Make sure that your new C file is compiled and linked into the application.
134
135PLL Settings
136------------
137
138The commercial variant of the i.MXRT1052 on the evaluation board allows a clock
139up to 600MHz for the ARM core. For some industrial variants only up to 528MHz
140are specified. To make it possible to adapt to these variants the application
141can overwrite the following constant:
142
143.. code-block:: c
144
145  #include "fsl_clock_config.h"
146 
147  const clock_arm_pll_config_t armPllConfig_BOARD_BootClockRUN = {
148      .loopDivider = 100,
149      .src = 0,
150  };
151
152With the default configuration of a 24MHz oscillator, the loopDivider has to be
15388 for the 528MHz.
154
155Clock Driver
156------------
157
158The clock driver uses the generic `ARMv7-M Clock`.
159
160IOMUX
161-----
162
163The i.MXRT IOMUXC is initialized based on the FDT. For that, the `pinctrl-0`
164fields of all devices with a status of `ok` or `okay` will be parsed.
165
166Console Driver
167--------------
168
169LPUART drivers are registered based on the FDT. The special `rtems,path`
170attribute defines where the device file for the console is created.
171
172The `stdout-path` in the `chosen` node determines which LPUART is used for the
173console.
174
175I2C Driver
176----------
177
178I2C drivers are registered based on the FDT. The special `rtems,path` attribute
179defines where the device file for the I2C bus is created.
180
181Limitations:
182
183* Only basic I2C is implemented. This is mostly a driver limitation and not a
184  hardware one.
185
186SPI Driver
187----------
188
189SPI drivers are registered based on the FDT. The special `rtems,path` attribute
190defines where the device file for the SPI bus is created.
191
192Note that the SPI-pins on the evaluation board are shared with the SD card.
193Populate R278, R279, R280, R281 on the IMXRT1050-EVKB (Rev A) to use the SPI
194pins on the Arduino connector.
195
196Limitations:
197
198* Only a basic SPI driver is implemented. This is mostly a driver limitation and
199  not a hardware one.
200
201Network Interface Driver
202------------------------
203
204The network interface driver is provided by the `libbsd`. It is initialized
205according to the device tree.
206
207Note on the hardware: The i.MXRT1050 EVKB maybe has a wrong termination of the
208RXP, RXN, TXP and TXN lines. The resistors R126 through R129 maybe shouldn't be
209populated because the used KSZ8081RNB already has an internal termination.
210Ethernet does work on short distance anyway. But keep it in mind in case you
211have problems. Source:
212https://community.nxp.com/t5/i-MX-RT/Error-in-IMXRT1050-EVKB-and-1060-schematic-ethernet/m-p/835540#M1587
213
214NXP SDK files
215-------------
216
217A lot of peripherals are currently not yet supported by RTEMS drivers. The NXP
218SDK offers drivers for these. For convenience, the BSP compiles the drivers from
219the SDK. But please note that they are not tested and maybe won't work out of
220the box. Everything that works with interrupts most likely needs some special
221treatment.
222
223Caveats
224-------
225
226The clock configuration support is quite rudimentary. The same is true for
227SDRAM. It mostly relies on the DCD and on a static clock configuration that is
228taken from the NXP SDK example projects.
229
230The MPU settings are currently quite permissive.
231
232There is no power management support.
Note: See TracBrowser for help on using the repository browser.