.. _Setup_PCIe_Mode: Set up DevKit in PCIe Mode ########################## .. tabs:: .. tab:: Prerequisites **Host operating system supported**: Ubuntu 22.04 LTS. To ensure proper driver functionality, configure your host machine's UEFI/BIOS settings accordingly. These configurations are necessary for optimal performance and compatibility with the SiMa.ai DevKit. - On Intel-based machines, enable SRIOV, IOMMU, and VT-D. - On AMD-based machines, disable AMD-V and enable IOMMU. **Install GStreamer and Required Libraries** 1. **Install GStreamer**: Follow installation instructions from the `official GStreamer documentation `_. 2. **Install Additional Required Libraries**: Run the following command in your terminal to install the necessary libraries and tools: .. code-block:: console :substitutions: sima-user@sima-user-machine:~/Downloads/|var_palette_reqs_file_version|$ sudo apt-get install make cmake gcc g++ dkms doxygen libjson-c-dev libjsoncpp-dev build-essential linux-headers-generic .. tab:: Driver Installation To enable communication between the host machine and the SiMa.ai DevKit, the required driver software must be installed. This step also installs necessary header files and libraries to support host side application development to communicate with the DevKit over PCIe. .. include:: blocks/download_mlsoc_firmware.rst The host driver build and installation is done via the ``sima_pcie_host_pkg.sh`` shell script, included in :substitution-code:`|var_palette_reqs_file_version|.tar` package that you downloaded. Find the ``sima_pcie_host_pkg.sh`` and execute it on the host machine: .. code-block:: console :substitutions: sima-user@sima-user-machine:~/Downloads/|var_palette_reqs_file_version|$ sudo ./sima_pcie_host_pkg.sh .. note:: Please be advised that your SiMa.ai Development Kit may be operating with outdated firmware. To ensure optimal performance and compatibility, we recommend updating to the latest firmware version. For detailed instructions on updating your DevKit in PCIe mode, see :ref:`here `. .. tab:: Hardware Installation .. image:: ../media/pcie-dip-switch.png :alt: SiMa.ai DevKit PCIe Dipswitch :align: center :width: 40% #. On the DevKit, there are four dip switches as shown above. Make sure switch #1 is in ``OFF`` position. #. Make sure the Run/Program switch is ON. #. Power off the host machine, insert the DevKit into the PCIe slot, and power on the host machine. For detailed view of the DevKit interfaces, switchs and connectors, refer to the :ref:`SiMa.ai DevKit Interface ` .. note:: In rare cases, if you do not need the driver to be automatically loaded when the host machine reboots, create (or edit if already exists) ``/etc/modprobe.d/blacklist.conf`` and add the line blacklist ``sima_mla_drv``. Once done, run ``update-initramfs`` and reboot the host machine. After reboot the drivers can be loaded manually using ``insmod`` or ``modeprobe``. .. tab:: Verify Installation To make sure the software installation was successful and everything is in order perform the following three checks. 1. First, verify installation on the GStreamer side using: .. code-block:: console sima-user@sima-user-machine:~$ gst-inspect-1.0 pciehost 2. Next, run the following code to ensure a successful driver installation. .. code-block:: console sima-user@sima-user-machine:~$ modinfo sima_mla_drv filename: /lib/modules/5.15.0-127-generic/updates/dkms/sima_mla_drv.ko license: GPL v2 author: SiMa.ai description: SiMa.ai MLA PCI Endpoint host driver version: 1.5.0_develop_B1327 srcversion: 31C4E60F90C78D7D061F66B alias: pci:v00001F06d00000001sv*sd*bc*sc*i* alias: pci:v00001F06d0000ABCDsv*sd*bc*sc*i* depends: retpoline: Y name: sima_mla_drv vermagic: 5.15.0-127-generic SMP mod_unload modversions sig_id: PKCS#7 signer: pcihost1 Secure Boot Module Signature key sig_key: 78:10:ED:67:33:51:A2:02:85:C5:F8:A3:44:00:65:FA:55:AC:DF:E4 sig_hashalgo: sha512 signature: AA:F7:B4:C1:19:06:30:99:42:90:71:8C:25:38:E0:DA:A1:AD:03:B6: 2B:0A:CA:62:1A:88:74:D9:DC:90:A2:D4:79:88:95:11:0A:9B:27:C8: 5C:6B:56:72:99:61:96:09:58:D8:B4:E2:CB:D3:40:F9:50:FE:4D:F4: FF:B6:7A:06:8F:BA:C4:9E:0B:20:B7:7D:A1:3B:FF:76:F9:AD:2A:59: AF:F6:3F:71:DA:04:0C:89:37:EB:98:A5:6D:99:9D:47:3E:BA:75:18: 29:F8:BF:23:8A:E4:35:04:11:EE:F2:47:17:1F:86:C4:8B:C6:F6:41: 0D:F0:44:F3:53:3E:61:5F:6E:ED:13:52:16:ab:F6:4D:B8:80:15:21: C1:83:07:0D:5F:9A:4A:A6:EE:3B:05:A9:CD:F6:AF:42:0A:01:85:30: 15:75:0C:57:61:C0:ED:9B:37:46:06:70:18:27:97:12:38:31:5E:60: 93:5D:58:10:81:2F:8F:CB:F7:5C:AE:FA:F8:11:F5:4B:CD:32:1B:DC: C7:0F:4D:E7:70:26:7F:42:86:53:A2:ED:4E:8F:31:47:9B:71:6E:71: FD:B0:E4:3D:AD:FA:3F:21:6E:32:AB:2C:67:56:93:6E:A0:B2:CB:D9: 35:C5:BD:EC:E9:86:D1:06:18:16:94:B9:36:ab:EF:25 parm: dump_queue_occupency:Dump queue occupency of all queues (bool) This means that the driver installation was successful. 3. Finally, run the code below to confirm that the device has been recognized successfully. .. code-block:: console sima-user@sima-user-machine:~$ lspci -vd 1f06:abcd 0000:01:00.0 Processing accelerators: Device 1f06:abcd (rev 01) Subsystem: Device 1f06:abcd Flags: bus master, fast devsel, latency 0, IRQ 156 Memory at 84000000 (64-bit, non-prefetchable) [size=1M] Memory at 6003000000 (64-bit, prefetchable) [size=1M] Expansion ROM at [disabled] Capabilities: Kernel driver in use: sima_mla_drv Kernel modules: sima_mla_drv This means the hardware has been recognized succesfully. 4. If you have installed :ref:`Palette CLI`, then you can run the following command to connect to the DevKit. - Start the Palette Docker container. - Connect to the board using the command, ``mpk device connect -s 0``. 5. If the DevKit is flashed with v1.5 or above, you can run the following command from the host side to check the version of the board software. .. code-block:: console sima-user@sima-user-machine:~$ ssh sima@10.0.0.2 "cat /etc/build"|grep SIMA_BUILD_VERSION sima@10.0.2's password: SIMA_BUILD_VERSION = 1.5.0_master_B1417 .. tab:: Virtual Network .. note:: The Virtual Network feature is available in firmware version ``1.5`` and later. To utilize this functionality, please ensure your DevKit is :ref:`updated` to the latest firmware version. When connected to a host system via PCI Express (PCIe), the SiMa.ai DevKit establishes a virtual ethernet interface. This interface enables direct network communication between the host and the DevKit over the high-speed PCIe bus. Primarily designed for debugging purposes, it allows users to: - **Secure Shell (SSH)**: Access the DevKit's command-line interface remotely for troubleshooting and system management. - **Secure Copy Protocol (SCP)**: Transfer files between the host and the DevKit securely, facilitating the movement of logs, configurations, and other necessary files during the development and debugging process. With ``scp`` and ``ssh`` utilities, users can also perform firmware update operations for the DevKit. When the interfaces are created, the host interface will have a MAC address in the format ``cardnum:S:I:m:A:0`` and the SoC interface will have a MAC address of ``cardnum:S:I:m:A:1``. The IP addresses are assigned upon creation as ``host:10.0.cardnum.1`` and ``soc:10.0.cardnum.2``. This also requires the host machine to have ``ifconfig`` utility installed. 1. ``ifconfig`` output on the host machine: .. code-block:: console enp2s0: flags=4163 mtu 65536 inet 10.0.0.1 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::253:49ff:fe4d:4130 prefixlen 64 scopeid 0x20 ether 00:53:49:4d:41:30 txqueuelen 1000 (Ethernet) RX packets 14107 bytes 4460994 (4.4 MB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 818 bytes 74840 (74.8 KB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 2. ``ifconfig`` output on the SiMa.ai DevKit: .. code-block:: console eth2: flags=4163 mtu 65536 inet 10.0.0.2 netmask 255.255.255.0 broadcast 10.0.0.255 inet6 fe80::253:49ff:fe4d:4131 prefixlen 64 scopeid 0x20 ether 00:53:49:4d:41:31 txqueuelen 1000 (Ethernet) RX packets 818 bytes 74840 (73.0 KiB) RX errors 0 dropped 0 overruns 0 frame 0 TX packets 14109 bytes 4461636 (4.2 MiB) TX errors 0 dropped 0 overruns 0 carrier 0 collisions 0 3. SSH from host to device Use default user name ``sima`` and password ``edgeai`` to connect. .. code-block:: console sima-user@sima-user-machine:~$ ssh sima@10.0.0.2 The authenticity of host '10.0.0.2 (10.0.0.2)' can't be established. ED25519 key fingerprint is SHA256:ulxwiRM+cCQNJ90R5Qn5eV+9hqvkVNo0eWQ9pY3l8E0. This key is not known by any other names Are you sure you want to continue connecting (yes/no/[fingerprint])? yes Warning: Permanently added '10.0.0.2' (ED25519) to the list of known hosts.. sima@10.0.0.2's password: sima@davinci:~#