1.. _udoo_neo_full:
2
3UDOO Neo Full
4#############
5
6Overview
7********
8
9UDOO Neo Full is an open source Arduino Uno compatible single board computer.
10It is equipped with an NXP |reg| i.MX 6SoloX hybrid multicore processor
11composed of one ARM |reg| Cortex-A9 core running up to 1 GHz and one Cortex-M4
12core running up to 227 MHz for high CPU performance and real-time response.
13Zephyr was ported to run on the Cortex-M4 core only. In a future release, it
14will also communicate with the Cortex-A9 core (running Linux) via OpenAMP.
15
16.. figure:: udoo_neo_full_mcimx6x_m4.jpg
17   :align: center
18   :alt: UDOO-Neo-Full
19
20   UDOO Neo Full (Credit: udoo.org)
21
22Hardware
23********
24
25- MCIMX6X MCU with a single Cortex-A9 (1 GHz) core and single Cortex-M4 (227 MHz) core
26
27- Memory
28
29  - 1 GB RAM
30  - 128 KB OCRAM
31  - 256 KB L2 cache (can be switched into OCRAM instead)
32  - 16 KB OCRAM_S
33  - 32 KB TCML
34  - 32 KB TCMU
35  - 32 KB CAAM (secure RAM)
36
37- A9 Boot Devices
38
39  - NOR flash
40  - NAND flash
41  - OneNAND flash
42  - SD/MMC
43  - Serial (I2C/SPI) NOR flash and EEPROM
44  - QuadSPI (QSPI) flash
45
46- Display
47
48  - Micro HDMI connector
49  - LVDS display connector
50  - Touch (I2C signals)
51
52- Multimedia
53
54  - Integrated 2d/3d graphics controller
55  - 8-bit parallel interface for analog camera supporting NTSC and PAL
56  - HDMI audio transmitter
57  - S/PDIF
58  - I2S
59
60- Connectivity
61
62  - USB 2.0 Type A port
63  - USB OTG (micro-AB connector)
64  - 10/100 Mbit/s Ethernet PHY
65  - Wi-Fi 802.11 b/g/n
66  - Bluetooth 4.0 Low Energy
67  - 3x UART ports
68  - 2x CAN Bus interfaces
69  - 8x PWM signals
70  - 3x I2C interface
71  - 1x SPI interface
72  - 6x multiplexable signals
73  - 32x GPIO (A9)
74  - 22x GPIO (M4)
75
76- Other
77
78  - MicroSD card slot (8-bit SDIO interface)
79  - Power status LED (green)
80  - 2x user LED (red and orange)
81
82- Power
83
84  - 5 V DC Micro USB
85  - 6-15 V DC jack
86  - RTC battery connector
87
88- Debug
89
90  - pads for soldering of JTAG 14-pin connector
91
92- Sensor
93
94  - 3-Axis Accelerometer
95  - 3-Axis Magnetometer
96  - 3-Axis Digital Gyroscope
97  - 1x Sensor Snap-In I2C connector
98
99- Expansion port
100
101  - Arduino interface
102
103For more information about the MCIMX6X SoC and UDOO Neo Full board,
104see these references:
105
106- `NXP i.MX 6SoloX Website`_
107- `NXP i.MX 6SoloX Datasheet`_
108- `NXP i.MX 6SoloX Reference Manual`_
109- `UDOO Neo Website`_
110- `UDOO Neo Getting Started`_
111- `UDOO Neo Documentation`_
112- `UDOO Neo Datasheet`_
113- `UDOO Neo Schematics`_
114
115Supported Features
116==================
117
118The UDOO Neo Full board configuration supports the following hardware
119features:
120
121+-----------+------------+-------------------------------------+
122| Interface | Controller | Driver/Component                    |
123+===========+============+=====================================+
124| NVIC      | on-chip    | nested vector interrupt controller  |
125+-----------+------------+-------------------------------------+
126| SYSTICK   | on-chip    | systick                             |
127+-----------+------------+-------------------------------------+
128| UART      | on-chip    | serial port-polling;                |
129|           |            | serial port-interrupt               |
130+-----------+------------+-------------------------------------+
131| GPIO      | on-chip    | general purpose input/output        |
132+-----------+------------+-------------------------------------+
133| COUNTER   | on-chip    | counter                             |
134+-----------+------------+-------------------------------------+
135
136The default configuration can be found in the defconfig file:
137
138	:zephyr_file:`boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4_defconfig`
139
140Other hardware features are not currently supported by the port.
141
142Connections and IOs
143===================
144
145The UDOO Neo Full board was tested with the following pinmux
146controller configuration.
147
148+---------------+-----------------+---------------------------+
149| Board Name    | SoC Name        | Usage                     |
150+===============+=================+===========================+
151| J4 RX         | UART5_RX_DATA   | UART Console              |
152+---------------+-----------------+---------------------------+
153| J4 TX         | UART5_TX_DATA   | UART Console              |
154+---------------+-----------------+---------------------------+
155
156System Clock
157============
158
159The MCIMX6X SoC is configured to use the 24 MHz external oscillator
160on the board with the on-chip PLL to generate core clock.
161PLL settings for M4 core are set via code running on the A9 core.
162
163Serial Port
164===========
165
166The MCIMX6X SoC has six UARTs. UART5 is configured for the M4 core and the
167remaining are used by the A9 core or not used.
168
169Programming and Debugging
170*************************
171
172The M4 core does not have a flash memory and is not provided a clock
173at power-on-reset. Therefore it needs to be started by the A9 core.
174The A9 core is responsible to load the M4 binary application into the RAM,
175put the M4 in reset, set the M4 Program Counter and Stack Pointer, and get
176the M4 out of reset. The A9 can perform these steps at the bootloader level
177or after the Linux system has booted.
178
179The M4 core can use up to 5 different RAMs (some other types of memory like
180a secure RAM are not currently implemented in Zephyr).
181These are the memory mappings for A9 and M4:
182
183+------------+-----------------------+-----------------------+-----------------------+
184| Region     | Cortex-A9             | Cortex-M4             | Size                  |
185+============+=======================+=======================+=======================+
186| TCML       | 0x007F8000-0x007FFFFF | 0x1FFF8000-0x1FFFFFFF |   32 KB               |
187+------------+-----------------------+-----------------------+-----------------------+
188| TCMU       | 0x00800000-0x00807FFF | 0x20000000-0x20007FFF |   32 KB               |
189+------------+-----------------------+-----------------------+-----------------------+
190| OCRAM_S    | 0x008F8000-0x008FBFFF | 0x208F8000-0x208FBFFF |   16 KB               |
191+------------+-----------------------+-----------------------+-----------------------+
192| OCRAM      | 0x00900000-0x0091FFFF | 0x20900000-0x2091FFFF |  128 KB               |
193+------------+-----------------------+-----------------------+-----------------------+
194| DDR        | 0x80000000-0xFFFFFFFF | 0x80000000-0xDFFFFFFF | 2048 MB (1536 for M4) |
195+------------+-----------------------+-----------------------+-----------------------+
196
197References
198==========
199
200- `NXP i.MX 6SoloX Reference Manual`_ Chapter 2 - Memory Maps
201
202You have to choose which RAM will be used at compilation time. This configuration
203is done in the file :zephyr_file:`boards/udoo/udoo_neo_full/udoo_neo_full_mcimx6x_m4.dts`.
204
205If you want to have the code placed in the subregion of a memory, which will
206likely be the case when using DDR, select "zephyr,flash=&flash" and set the
207DT_FLASH_SIZE macro to determine the region size and DT_FLASH_ADDR to determine
208the address where the region begins.
209
210If you want to have the data placed in the subregion of a memory, which will
211likely be the case when using DDR, select "zephyr,sram = &sram", which sets the
212CONFIG_SRAM_SIZE macro to determine the region size and
213CONFIG_SRAM_BASE_ADDRESS to determine the address where the region begins.
214
215Otherwise set "zephyr,flash" and/or "zephyr,sram" to one of the predefined
216regions:
217
218.. code-block:: none
219
220   "zephyr,flash"
221   - &tcml
222   - &ocram_s
223   - &ocram
224   - &ddr
225
226   "zephyr,sram"
227   - &tcmu
228   - &ocram_s
229   - &ocram
230   - &ddr
231
232Below you will find the instructions how a Linux user space application running
233on the A9 core can be used to load and run Zephyr application on the M4 core.
234
235The UDOOBuntu Linux distribution contains a `udooneo-m4uploader`_ utility,
236but its purpose is to load UDOO Neo "Arduino-like" sketches, so it doesn't
237work with Zephyr applications in most cases. The reason is that there is
238an exchange of information between this utility and the program running on the
239M4 core using hardcoded shared memory locations. The utility writes a flag which
240is read by the program running on the M4 core. The program is then supposed to
241end safely and write the status to the shared memory location for the main core.
242The utility then loads the new application and reads its status from the shared
243memory location to determine if it has successfully launched. Since this
244functionality is specific for the UDOO Neo "Arduino-like" sketches, it is not
245implemented in Zephyr. However Zephyr applications can support it on their own
246if planned to be used along with the UDOOBuntu Linux running on the A9 core.
247The udooneo-uploader utility calls another executable named
248mqx_upload_on_m4SoloX which can be called directly to load Zephyr applications.
249Copy the Zephyr binary image into the Linux filesystem and invoke the utility
250as a root user:
251
252.. code-block:: console
253
254   mqx_upload_on_m4SoloX zephyr.bin
255
256If the output looks like below, the mqx_upload_on_m4SoloX could not read
257the status of the stopped application. This is expected if the previously
258loaded application is not a UDOO Neo "Arduino-like" sketch and ignores the
259shared memory communication:
260
261.. code-block:: console
262
263   UDOONeo - mqx_upload_on_m4SoloX 1.1.0
264   UDOONeo - Waiting M4 Stop, m4TraceFlags: 00000000
265   UDOONeo - Waiting M4 Stop, m4TraceFlags: 00000000
266   UDOONeo - Waiting M4 Stop, m4TraceFlags: 00000000
267   UDOONeo - Waiting M4 Stop, m4TraceFlags: 00000000
268   UDOONeo - Failed to Stop M4 sketch: reboot system !
269
270In such situation, the mqx_upload_on_m4SoloX utility has reset the trace flags,
271so it will succeed when called again. Then it can have this output below:
272
273.. code-block:: console
274
275   UDOONeo - mqx_upload_on_m4SoloX 1.1.0
276   UDOONeo - FILENAME = zephyr.bin; loadaddr = 0x84000000
277   UDOONeo - start - end (0x84000000 - 0x84080000)
278   UDOONeo - Waiting M4 Run, m4TraceFlags: 000001E0
279   UDOONeo - M4 sketch is running
280
281Or the one below, if the utility cannot read the status flag that the M4 core
282applications has started. It can be ignored as the application should be
283running, the utility just doesn't know it:
284
285.. code-block:: console
286
287   UDOONeo - mqx_upload_on_m4SoloX 1.1.0
288   UDOONeo - FILENAME = zephyr.bin; loadaddr = 0x84000000
289   UDOONeo - start - end (0x84000000 - 0x84080000)
290   UDOONeo - Waiting M4 Run, m4TraceFlags: 00000000
291   UDOONeo - Waiting M4 Run, m4TraceFlags: 00000000
292   UDOONeo - Waiting M4 Run, m4TraceFlags: 00000000
293   UDOONeo - Waiting M4 Run, m4TraceFlags: 00000000
294   UDOONeo - Failed to Start M4 sketch: reboot system !
295
296The stack pointer and the program counter values are read from the binary.
297The memory address where binary will be placed is calculated from the program
298counter as its value aligned to 64 KB down, or it can be provided as a second
299command line argument:
300
301.. code-block:: console
302
303   mqx_upload_on_m4SoloX zephyr.bin 0x84000000
304
305It is necessary to provide the address if the binary is copied into a memory
306region which has different mapping between the A9 and the M4 core. The address
307calculated from the stack pointer value in the binary file would be wrong.
308
309It is possible to modify the mqx_upload_on_m4SoloX utility source code
310to not exchange the information with the M4 core application using shared
311memory.
312
313It is also possible to use the `imx-m4fwloader`_ utility to load the M4 core
314application.
315
316One option applicable in UDOOBuntu Linux is to copy the binary file into the
317file /var/opt/m4/m4last.fw in the Linux filesystem. The next time the system is
318booted, Das U-Boot will load it from there.
319
320Another option is to directly use Das U-Boot to load the code.
321
322Debugging
323=========
324
325The UDOO Neo Full board includes pads for soldering the 14-pin JTAG
326connector. Zephyr applications running on the M4 core have only been
327tested by observing UART console output.
328
329References
330==========
331
332.. target-notes::
333
334.. _UDOO Neo Website:
335   https://www.udoo.org/udoo-neo/
336
337.. _UDOO Neo Getting Started:
338   https://www.udoo.org/get-started-neo/
339
340.. _UDOO Neo Documentation:
341   https://www.udoo.org/docs-neo
342
343.. _UDOO Neo Datasheet:
344   https://www.udoo.org/download/files/datasheets/datasheet_udoo_neo.pdf
345
346.. _UDOO Neo Schematics:
347   https://www.udoo.org/download/files/schematics/UDOO_NEO_schematics.pdf
348
349.. _Udoo Neo Linux or Android Images for the A9 Core:
350   https://www.udoo.org/downloads/
351
352.. _udooneo-m4uploader:
353   https://github.com/ektor5/udooneo-m4uploader
354
355.. _imx-m4fwloader:
356   https://github.com/codeauroraforum/imx-m4fwloader
357
358.. _NXP i.MX 6SoloX Website:
359   https://www.nxp.com/products/processors-and-microcontrollers/applications-processors/i.mx-applications-processors/i.mx-6-processors/i.mx-6solox-processors-heterogeneous-processing-with-arm-cortex-a9-and-cortex-m4-cores:i.MX6SX
360
361.. _NXP i.MX 6SoloX Datasheet:
362   https://www.nxp.com/docs/en/data-sheet/IMX6SXCEC.pdf
363
364.. _NXP i.MX 6SoloX Reference Manual:
365   https://www.nxp.com/docs/en/reference-manual/IMX6SXRM.pdf
366
367.. _Loading Code on Cortex-M4 from Linux for the i.MX 6SoloX and i.MX 7Dual/7Solo Application Processors:
368   https://www.nxp.com/docs/en/application-note/AN5317.pdf
369