1.. _connect_serial_port:
2
3Enable Serial Port on NUC
4#########################
5
6Option 1: Using the Serial Port on TGL Intel NUC
7================================================
8
9You can enable the serial console on the
10`TGL Intel NUC <https://ark.intel.com/content/www/us/en/ark/products/205594/intel-nuc-11-pro-kit-nuc11tnhi5.html?wapkw=NUC11TNHi5>`_
11(NUC11TNHi5). The TGL Intel NUC has a serial port header that you can
12expose with a serial DB9 header cable. (The Intel NUC has a punch-out hole for
13mounting the serial connector.)
14
15.. figure:: images/NUC11TNH-serial-port.png
16
17   TGL Intel NUC with populated serial port punchout
18
19You can `purchase
20<https://www.amazon.com/dp/B07BV1W6N8/ref=cm_sw_r_cp_ep_dp_wYm0BbABD5AK6>`_
21such a cable or you can build it yourself;
22refer to the `TGL Intel NUC product specification
23<https://ark.intel.com/content/www/us/en/ark/products/205594/intel-nuc-11-pro-kit-nuc11tnhi5.html>`_
24as shown below:
25
26.. figure:: images/NUC11TNH-serial-port-header.png
27   :scale: 80
28
29   NUC11TNH serial port header details
30
31
32.. figure:: images/NUC11TNH-serial-port-header-to-RS232-cable.png
33   :scale: 80
34
35   NUC11TNH `serial port header to RS232 cable
36   <https://www.amazon.com/dp/B07BV1W6N8/ref=cm_sw_r_cp_ep_dp_wYm0BbABD5AK6>`_
37
38
39You'll also need an `RS232 DB9 female to USB cable
40<https://www.amazon.com/Adapter-Chipset-CableCreation-Converter-Register/dp/B0769DVQM1>`_
41or an `RS232 DB9 female/female (NULL modem) cross-over cable
42<https://www.amazon.com/SF-Cable-Null-Modem-RS232/dp/B006W0I3BA>`_
43to connect to your host system.
44
45Note that If you want to use the RS232 DB9 female/female cable, choose
46the **cross-over** type rather than **straight-through** type.
47
48Option 2: Enabling PCIe Serial Port on TGL Intel NUC
49====================================================
50
51If there is no internal serial port header on your NUC, you can enable the PCIe serial port to debug the issues effeciently.
52Most of the NUCs don't have a PCIe interface but have an NVMe M.2 interface, so the additional M.2 to PCIe adaptor is needed to
53enable the PCIe serial port on the NUC. You can buy the `adaptor
54<https://item.jd.com/10025455296900.html>`_ first and then buy the PCIe serial card with `StarTech 2 Port Native PCI Express
55<https://www.ebay.ca/i/351912927278>`_  or `IO-PCE99100-2S <https://item.jd.com/1126612955.html>`_.
56Both of them are verified with this
57`commit <https://github.com/projectacrn/acrn-hypervisor/commit/9e838248c3ce4d6b68e1c5b068d10d566a06db10>`_.
58
59.. figure:: images/NVMe-M.2-to-PCIe-adaptor.png
60   :scale: 80
61
62   NVMe M.2 to PCIe adaptor
63
64.. figure:: images/PCIe-serial-StarTech.png
65   :scale: 80
66
67   StarTech 2 Port Native PCI Express
68
69.. figure:: images/PCIe-serial-LeKuo.png
70   :scale: 80
71
72   IO-PCE99100-2S
73
74
75Check the BDF Information
76*************************
77
78Connect as in following figure, boot into native, and then check the BDF
79information of the adapter using: ``lspci``.
80
81.. figure:: images/PCIe-serial-Connection.png
82   :scale: 80
83
84   PCIe Serial Connection on NUC
85
86.. code-block:: bash
87
88   01:00.0 Serial controller: Asix Electronics Corporation Device 9100
89   01:00.1 Serial controller: Asix Electronics Corporation Device 9100
90
91Convert the BDF to Hex Format
92*****************************
93
94Refer this :ref:`hv-parameters` to change bdf 01:00.1 to Hex format: 0x101;
95then add it to the grub menu:
96
97.. code-block:: bash
98
99   multiboot2 /boot/acrn.bin  root=PARTUUID="b1bebafc-2b06-43e2-bf6a-323337daebc0" uart=bdf@0x101
100
101.. Note::
102
103   ``uart=bdf@0x100`` for port 1
104
105   ``uart=bdf@0x101`` for port 2
106
107   ``uart=bdf@0x101`` is preferred for the shared scenario; otherwise, it can't
108   input in the Hypervisor console after the Service VM boots up.
109   There is no such limitation for the hybrid or hybrid_rt scenarios.
110