diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/1-overview.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/1-overview.md new file mode 100644 index 0000000000..d03d9757ad --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/1-overview.md @@ -0,0 +1,41 @@ +--- +title: Overview +weight: 2 + +### FIXED, DO NOT MODIFY +layout: learningpathall +--- + +## Hardware Overview - NXP's FRDM i.MX 93 Board + +Selecting the best hardware for machine learning (ML) models depends on effective tools. You can visualize ML performance early in the development cycle by using NXP's [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) board. + +
+ + +*Unboxing NXP's FRDM i.MX 93 board* +
+ +![NXP FRDM i.MX 93 Board SoC Highlighted alt-text#center](./nxp-frdm-imx93-board-soc-highlighted.png "Arm Ethos-U65 NPU location") + +### NXP's FRDM i.MX 93 Processor Decoded + +![i.MX 93 Processor SoC alt-text#center](./imx93-application-processor-soc.png "NXP's FRDM i.MX 93 processor") + +**NXP's Processor Labeling Convention:** +|Line|Meaning| +|----|-------| +|MIMX9352|• MI – Microcontroller IC
• MX93 – i.MX 93 family
• 52 – Variant:
• Dual-core Arm Cortex-A55
• Single Cortex-M33
• Includes **Ethos-U65 NPU**| +|CVVXMAB|• C - Commercial temperature grade (0°C to 95°C)
• VVX - Indicates package type and pinout (BGA, pitch, etc.)
• MAB - Specific configuration (e.g., NPU present, security level, memory interfaces) +| +|1P87F|• Silicon mask set identifier| +|SBBM2410E|• NXP traceability code| + +## Benefits and applications + +NPUs, like Arm's [Ethos-U65](https://www.arm.com/products/silicon-ip-cpu/ethos/ethos-u65) NPU are available on physical devices specifically made for developers. Development boards like NXP's [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) also connect to displays via a HDMI cable. Additionally the board accepts video inputs. This is useful for for ML performance visualization due to: +- visual confirmation that your ML model is running on the physical device, +- image and video inputs for computer vision models running on the device, +- clearly indicated instruction counts, +- confirmation of total execution time and +- visually appealing output for prototypes and demos. \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/2-boot-nxp.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/2-boot-nxp.md new file mode 100644 index 0000000000..8765903b69 --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/2-boot-nxp.md @@ -0,0 +1,103 @@ +--- +# User change +title: "Boot the NXP FRDM i.MX 93 Board" + +weight: 3 + +# Do not modify these elements +layout: "learningpathall" +--- + +In this section, you will prepare the NXP [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) board for ML development. + +## Unbox the NXP Board + +Follow NXP's getting started instructions: [Getting Started with FRDM-IMX93](https://www.nxp.com/document/guide/getting-started-with-frdm-imx93:GS-FRDM-IMX93): +* Stop when you complete section "1.6 Connect Power Supply" + +## Connect to the NXP Board + +Prior to logging in to the NXP board, you need to configure `picocom`. This allows you to connect to the board using a USB cable. + +{{% notice macOS %}} + +1. Install the Silicon Labs driver: + + https://www.silabs.com/developer-tools/usb-to-uart-bridge-vcp-drivers?tab=downloads + +2. Install [picocom](https://github.com/npat-efault/picocom): + ```bash + brew install picocom + ``` + +3. Establish a USB-to-UART (serial) connection: + - Connect the board's "DEBUG" USB-C connector to your Mac + - Find the NXP board's USB connections in your computer's terminal: + ```bash { output_lines = "2-7" } + ls /dev/tty.* + # output lines + ... + /dev/tty.debug-console + /dev/tty.usbmodem56D70442811 + /dev/tty.usbmodem56D70442813 + ... + ``` + + - Connect to the NXP board: + ```bash { output_lines = "2-5" } + sudo picocom -b 115200 /dev/tty.usbmodem56D70442811 + # output lines + picocom v3.1 + ... + Terminal ready + ``` + +4. Go straight to step 2, in the below instructions + +{{% /notice %}} + +1. Establish a USB-to-UART (serial) connection: + - Connect the board's "DEBUG" USB-C connector to your Linux machine + - Find the NXP board's USB connections in your computer's terminal: + ```bash { output_lines = "2-3" } + ls /dev/ttyUSB* /dev/ttyACM* 2>/dev/null + # output lines + /dev/ttyACM0 /dev/ttyACM1 + ``` + + - Connect to the NXP board: + ```bash { output_lines = "2-5" } + sudo picocom -b 115200 /dev/ttyACM0 + # output lines + picocom v3.1 + ... + Terminal ready + ``` +2. Log in to Linux on the NXP board: + - Connect the board's "POWER" USB-C connector to your laptop + - At this point you should see one red and one white light on the board + - Next you should see scrolling text in your `picocom` window, as the NXP board boots + - The last line should say `login:` + ```bash { output_lines = "1-9" } + # output lines + ... + [ OK ] Reached target Graphical Interface. + Starting Record Runlevel Change in UTMP... + [ OK ] Finished Record Runlevel Change in UTMP. + + NXP i.MX Release Distro 6.6-scarthgap imx93frdm ttyLP0 + + imx93frdm login: + ``` +3. Type `root` to log in as root. There is no password + +### Troubleshooting +* Restart the NXP board, to get to the `login:` prompt: + * Hold the NXP board's power button for 2-seconds, until the lights turn off + * Hold the NXP board's power button again for 2-seconds, until the lights turn on + +## [Optional] Run the Built-In NXP Demos +* Connect the NXP board to a monitor via HDMI +* Connect a mouse to the NXP board's USB-A port + +![NXP board built-in ML demos alt-text#center](./nxp-board-built-in-ml-demos.png "NXP board built-in ML demos") diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/3-create-super-user.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/3-create-super-user.md new file mode 100644 index 0000000000..927a029927 --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/3-create-super-user.md @@ -0,0 +1,36 @@ +--- +# User change +title: "Create a Linux Super User" + +weight: 4 + +# Do not modify these elements +layout: "learningpathall" +--- + +On the NXP board, create a non-root super user (if you do not already have one): + +1. While [logged in as root]( {{< relref "2-boot-nxp.md" >}} ): + + * Enable super user privileges: + ```bash + sudo visudo + ``` + * In the vi editor that opens up, uncomment the below line: + ```bash { output_lines = "1" } + %wheel ALL=(ALL:ALL) ALL # uncomment this line + ``` + +2. Add a super user: + ```bash + sudo adduser testuser + sudo usermod -aG wheel testuser + ``` + +3. While still logged in as root, confirm successful super user creation: + ```bash + su - testuser + sudo whoami # should return "root" + ``` + +4. Log out of the NXP board and log back in to Linux as the super user \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/4-enable-wifi.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/4-enable-wifi.md new file mode 100644 index 0000000000..12ce8e216d --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/4-enable-wifi.md @@ -0,0 +1,88 @@ +--- +# User change +title: "Enable WiFi" + +weight: 5 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +{{% notice Note %}} + +* WiFi network connectivity **does not persist** on NXP board reboot +* It **does persist** on logging out and then logging back in as the same Linux user + +{{% /notice %}} + +1. [Log in to Linux]( {{< relref "2-boot-nxp.md" >}} ) on the board, as a [super user]( {{< relref "3-create-super-user" >}} ) + +2. Run the below terminal commands: + ```bash + sudo /usr/sbin/modprobe moal mod_para=nxp/wifi_mod_para.conf + sudo connmanctl + ``` + +3. The prompt will change to `connmanctl>`, where you will enter the following commands: + + ```bash + enable wifi + scan wifi + services + ``` + +4. Your available WiFi networks will be listed in the following form: + + ```bash { output_lines = "1-3" } + wifi_0123456789ab_cdef0123456789_managed_psk + wifi_abcdef012345_6789abcdef0123_managed_psk + wifi_fedcba987654_3210fedcba9876_managed_psk + ``` + + {{% notice Note %}} + + Duplicate SSIDs may appear, so you will have to experiment with the different `wifi_..._managed_psk` names, when you try to connect in the next step + + {{% /notice %}} + +5. Still within the `connmanctl>` prompt, enter the following commands: + + ```bash + agent on + connect wifi_0123456789ab_cdef0123456789_managed_psk # Your wifi_..._managed_ps name will be different + Agent RequestInput wifi_0123456789ab_cdef0123456789_managed_psk + Passphrase = [ Type=psk, Requirement=mandatory ] + Passphrase? # Enter your WiFi password + connmanctl> quit + ``` + +6. Assuming your WiFi network is connected to the Internet, test connectivity: + + ```bash + curl -I http://www.example.com + ``` + + If WiFi is configured correctly, you will see the example.com web page load: + + ```bash { output_lines = "1-2" } + HTTP/1.1 200 OK + ... + ``` + +7. [optional] If your WiFi network is not connected to the internet, test connectivity this way: + + ```bash + ifconfig | grep RUNNING -A 1 + ``` + + If WiFi is configured correctly, you will see a list of `RUNNING` network adapters: + * one for `127.0.0.1` (`localhost`) and + * a second for the NXP board's assigned IP address on the WiFi network + * Example output, where `192.168.1.89` is the NXP board's successfully assigned IP address: + ```bash { output_lines = "1-5" } + lo: flags=73 mtu 65536 + inet 127.0.0.1 netmask 255.0.0.0 + -- + mlan0: flags=-28605 mtu 1500 + inet 192.168.1.89 netmask 255.255.255.0 broadcast 192.168.1.255 + ``` \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/5-transfer-files-wifi.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/5-transfer-files-wifi.md new file mode 100644 index 0000000000..8eaa0c09ed --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/5-transfer-files-wifi.md @@ -0,0 +1,30 @@ +--- +# User change +title: "Transfer Files Over WiFi" + +weight: 6 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +1. [Log in to Linux]( {{< relref "2-boot-nxp.md" >}} ) on the board, as a [super user]( {{< relref "3-create-super-user" >}} ) + +2. [Enable Wifi]( {{< relref "4-enable-wifi.md" >}} ) on the NXP board + +3. Note down the NXP board's IP address on your WiFi network: + ```bash + ifconfig | grep RUNNING -A 1 + ``` + +4. Open a terminal window on the machine with the source file + +5. Navigate to the source file directory and copy the file to the NXP board's destination directory: + ```bash + # On your machine, in the source file directory + scp @:/home/nxp_user/path/to/destination/directory/ + ``` + Example: + ```bash { output_lines = "1" } + scp install.sh testuser@192.168.1.1:/home/testuser/apps/test_app/ + ``` \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/6-tranfer-files-usb.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/6-tranfer-files-usb.md new file mode 100644 index 0000000000..89ee721ff8 --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/6-tranfer-files-usb.md @@ -0,0 +1,32 @@ +--- +# User change +title: "Transfer Files Over USB" + +weight: 7 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +1. [Log in to Linux]( {{< relref "2-boot-nxp.md" >}} ) on the board, as a [super user]( {{< relref "3-create-super-user" >}} ) + +2. On your machine with the source file, copy the source file to a USB-A thumb drive: + +3. Insert the thumb drive into the NXP board's USB-A port + +4. Mount the thumb drive and then copy the files to the board: + ```bash { output_lines = "1" } + # Execute these commands on the board + mount /dev/sda1 /mnt + cp /mnt/ /path/to/destination/directory/ + ``` + + Example: + ```bash { output_lines = "1" } + cp /mnt/install.sh ./apps/test_app/ + ``` + +5. [optional] Unmount the thumbdrive and then remove it from the NXP board + ```bash + umount /mnt + ``` \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/7-enable-persistent-wifi.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/7-enable-persistent-wifi.md new file mode 100644 index 0000000000..d8b2f7a6cf --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/7-enable-persistent-wifi.md @@ -0,0 +1,148 @@ +--- +# User change +title: "(Optional) Enable Persistent WiFi" + +weight: 8 # 1 is first, 2 is second, etc. + +# Do not modify these elements +layout: "learningpathall" +--- + +On this page you will configure the NXP board to connect to a specific WiFi network on boot. + +1. [Log in to Linux]( {{< relref "2-boot-nxp.md" >}} ) on the board, as `root` + +2. Create a `wpa_supplicant.conf`: + ```bash + touch /etc/wpa_supplicant.conf + nano /etc/wpa_supplicant.conf + ``` + Enter your WiFi credentials into the `wpa_supplicant.conf` file: + ```bash + ctrl_interface=DIR=/var/run/wpa_supplicant GROUP=netdev + update_config=1 + + network={ + ssid="YOUR_SSID" + psk="YOUR_PASSWORD" + key_mgmt=WPA-PSK + } + ``` + +3. Test the `wpa_supplicant.conf` file: + ```bash + modprobe moal mod_para=nxp/wifi_mod_para.conf + ifconfig mlan0 up + wpa_supplicant -B -i mlan0 -c /etc/wpa_supplicant.conf + udhcpc -i mlan0 + ``` + * mlan0 is the WiFi interface on i.MX93 + * If this connects to WiFi, we’re ready for automation + +4. Configure DNS server IP addresses, so that the NXP board can resolve Internet addresses: + ```bash + touch /usr/share/udhcpc/default.script + nano /usr/share/udhcpc/default.script + ``` + and add in the following `udhcpc` script: + ```bash + #!/bin/sh + # udhcpc script + case "$1" in + deconfig) + ip addr flush dev $interface + ;; + bound|renew) + ip addr add $ip/$subnet dev $interface + ip route add default via $router + echo "nameserver 8.8.8.8" > /etc/resolv.conf + echo "nameserver 1.1.1.1" >> /etc/resolv.conf + ;; + esac + ``` + Make the `default.script` executable: + ```bash + chmod +x /usr/share/udhcpc/default.script + ``` + +5. Create a `nxp-wifi-setup.sh` script: + ```bash + touch /usr/bin/nxp-wifi-setup.sh + nano /usr/bin/nxp-wifi-setup.sh + ``` + and add in the following lines: + ```bash + #!/bin/sh + # Load WiFi driver + /usr/sbin/modprobe moal mod_para=nxp/wifi_mod_para.conf + + # Bring interface up + /usr/bin/ifconfig mlan0 up + + # Connect to WiFi + /usr/sbin/wpa_supplicant -B -i mlan0 -c /etc/wpa_supplicant.conf + + # Obtain DHCP IP + DNS + /usr/sbin/udhcpc -i mlan0 -s /usr/share/udhcpc/default.script + ``` + Make the `nxp-wifi-setup.sh` executable: + ```bash + chmod +x /usr/bin/nxp-wifi-setup.sh + ``` + +6. Create a `nxp-wifi-setup.service`: + ```bash + touch /etc/systemd/system/nxp-wifi-setup.service + nano /etc/systemd/system/nxp-wifi-setup.service + ``` + Enter the following systemd commands into the `nxp-wifi-setup.service` file: + ```bash + [Unit] + Description=WiFi Setup for NXP FRDM i.MX93 + After=network.target + + [Service] + Type=oneshot + ExecStart=/usr/bin/nxp-wifi-setup.sh + RemainAfterExit=yes + + [Install] + WantedBy=multi-user.target + ``` + +7. Create a `wpa_supplicant.service`: + ```bash + touch /etc/systemd/system/wpa_supplicant.service + nano /etc/systemd/system/wpa_supplicant.service + ``` + Enter the following systemd commands into the `wpa_supplicant.service` file: + ```bash + [Unit] + Description=WPA Supplicant daemon + After=network.target + + [Service] + Type=simple + ExecStart=/usr/sbin/wpa_supplicant -i mlan0 -c /etc/wpa_supplicant.conf + Restart=always + + [Install] + WantedBy=multi-user.target + ``` + +8. Enable and Start the `nxp-wifi-setup.service`: + ```bash + systemctl daemon-reload + systemctl enable nxp-wifi-setup.service wpa_supplicant.service + systemctl start nxp-wifi-setup.service wpa_supplicant.service + ``` + +10. Check status: + ```bash + systemctl status nxp-wifi-setup.service + systemctl status wpa_supplicant.service + ``` + and confirm Internet connectivity: + ```bash + curl -I http://www.example.com + ``` \ No newline at end of file diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_index.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_index.md new file mode 100644 index 0000000000..94cefa8b63 --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_index.md @@ -0,0 +1,60 @@ +--- +title: Using Linux on the NXP FRDM IMX93 Board + +minutes_to_complete: 120 + +who_is_this_for: This is an advanced topic for embedded device developers and machine learning engineers, who want need a professional-grade Arm embedded device development platform. + +learning_objectives: + - Identify suitable physical Arm-based devices for TinyML applications. + - Configure physical embedded devices. + - Enable hardware modules on embedded devices. + - Deploy a apps to NXP's FRDM i.MX 93 board. + - Using Linux on an embedded device's Arm Cortex-A processor(s). + - Deploying machine learning models to Arm Cortex-M and Ethos-U processors will be covered in a later learning path. + +prerequisites: + - Purchase of a NXP [FRDM i.MX 93](https://www.nxp.com/design/design-center/development-boards-and-designs/frdm-i-mx-93-development-board:FRDM-IMX93) board. + - A computer running Linux or macOS. + +author: Waheed Brown + +### Tags +skilllevels: Introductory +subjects: ML +armips: + - Cortex-A + +operatingsystems: + - Linux + - macOS + +tools_software_languages: + - Baremetal + - Python + - Bash + - systemd + +further_reading: + - resource: + title: TinyML Brings AI to Smallest Arm Devices + link: https://newsroom.arm.com/blog/tinyml + type: blog + - resource: + title: Arm Machine Learning Resources + link: https://www.arm.com/developer-hub/embedded-and-microcontrollers/ml-solutions/getting-started + type: documentation + - resource: + title: Arm Developers Guide for Cortex-M Processors and Ethos-U NPU + link: https://developer.arm.com/documentation/109267/0101 + type: documentation + + + + +### FIXED, DO NOT MODIFY +# ================================================================================ +weight: 1 # _index.md always has weight of 1 to order correctly +layout: "learningpathall" # All files under learning paths have this same wrapper +learning_path_main_page: "yes" # This should be surfaced when looking for related content. Only set for _index.md of learning path content. +--- diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_next-steps.md b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_next-steps.md new file mode 100644 index 0000000000..c3db0de5a2 --- /dev/null +++ b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/_next-steps.md @@ -0,0 +1,8 @@ +--- +# ================================================================================ +# FIXED, DO NOT MODIFY THIS FILE +# ================================================================================ +weight: 21 # Set to always be larger than the content in this path to be at the end of the navigation. +title: "Next Steps" # Always the same, html page title. +layout: "learningpathall" # All files under learning paths have this same wrapper for Hugo processing. +--- diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/imx93-application-processor-soc.png b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/imx93-application-processor-soc.png new file mode 100644 index 0000000000..838d47f6d5 Binary files /dev/null and b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/imx93-application-processor-soc.png differ diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-board-built-in-ml-demos.png b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-board-built-in-ml-demos.png new file mode 100644 index 0000000000..e50d656b13 Binary files /dev/null and b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-board-built-in-ml-demos.png differ diff --git a/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-frdm-imx93-board-soc-highlighted.png b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-frdm-imx93-board-soc-highlighted.png new file mode 100644 index 0000000000..b50ace3a21 Binary files /dev/null and b/content/learning-paths/embedded-and-microcontrollers/linux-nxp-board/nxp-frdm-imx93-board-soc-highlighted.png differ