.. include:: ../substitutions.rst .. _usbdfuBoot-62A: USB/DFU ======= Overview -------- |soc-caps| USB peripheral boot (also called device boot) mode receives a second bootloader image from a USB host using the Device Firmware Update (DFU) specification defined by USB-DFU. This section demonstrates how to use DFU to boot |product| to a U-Boot prompt using a Linux Ubuntu PC. Requirements ------------ **Hardware** * Ubuntu 22.04 LTS, 64-bit Host Machine * If using a virtual machine, VMWare Workstation, VMWare Player, and VirtualBox are all viable solutions. * USB-C to USB-A cable .. image:: ../../images/phycore-am62ax/pb-07524_usb-c.png :width: 500px :alt: phyBOARD-AM62Ax boot switches **Software** Prepare the following U-Boot images by building the BSP (:ref:`BuildTheBSP-62A`) or downloading the pre-built (:ref:`PreBuilts-62A`) image files. These images will be used for downloading to and booting on the |product| via DFU: .. code-block:: none :substitutions: * tiboot3.bin-usbdfu * tispl.bin * u-boot.img .. note:: **tiboot3.bin-usbdfu** is built along side tiboot3.bin and is used for USB-DFU boot on the |product|. Install & Configure Snagboot ---------------------------- * Install python3, pip, and swig: .. code-block:: console :substitutions: |host-prompt| sudo apt update && sudo apt install python3 python3-pip python3-venv swig * Now we can create and source our python virtual environment in the same folder that we have our U-Boot images. .. code-block:: console :substitutions: |host-prompt| python3 -m venv myenv |host-prompt| source myenv/bin/activate * Install snagboot in our venv using pip .. code-block:: console :substitutions: |host-prompt| pip install snagboot * Export the PHYTEC template .. code-block:: console :substitutions: |host-prompt| snagrecover -t am62x-phyboard-lyra > am62x-phyboard-lyra.yaml We can **cat** the template to verify it is exported correctly: .. code-block:: console :substitutions: |host-prompt| cat am62x-phyboard-lyra.yaml tiboot3: path: tiboot3.bin-usbdfu tispl: path: tispl.bin u-boot: path: u-boot.img .. note:: If the template shows :code:`tiboot3.bin-perif`, you will need to update it to :code:`tiboot3.bin-usbdfu` as shown above. * Add **udev rules** to allow snagrecover to access our USB devices: .. code-block:: console :substitutions: |host-prompt| snagrecover --udev > 50-snagboot.rules |host-prompt| sudo cp 50-snagboot.rules /etc/udev/rules.d/ |host-prompt| sudo udevadm control --reload-rules |host-prompt| sudo udevadm trigger .. note:: If we run **ls** our folder should include **at least** the following files to begin recovery: .. code-block:: console :substitutions: |host-prompt| ls am62x-phyboard-lyra.yaml myenv tiboot3.bin-usbdfu tispl.bin u-boot.img Booting from USB/DFU -------------------- Here are the basic steps for booting from USB/DFU on the |product| development kit. The steps for establishing a serial communication are outlined in the :ref:`Quickstart-62A`. .. note:: Two terminals should be open on your host Linux machine. * One for running commands via USB-C * One for Serial communication to see the SOMs boot status. **Boot Switch Settings** .. image:: ../../images/phycore-am62x/pb-07124_boot-usb.png :alt: SD Boot Switch :width: 250px .. image:: ../../images/phycore-am62ax/pb-07524_bootswitch.png :width: 500px :alt: phyBOARD-AM62Ax boot switches * Plug a USB-C cable from the |product| development kit into your Ubuntu machine. * Adjust boot switch settings on the |product| development kit. * Power on the |product| development kit. You should see the kit appear on your Ubuntu machine via the USB-C. To verify this, run the following: .. code-block:: console :substitutions: |host-prompt| lsusb | grep 0451:6165 Bus 005 Device 060: ID 0451:6165 Texas Instruments, Inc. AM62Ax DFU We can now begin our recovery by running snagrecover on our Ubuntu machine in our USB-C terminal. .. code-block:: console :substitutions: |host-prompt| snagrecover -s am625 -f am62x-phyboard-lyra.yaml Starting recovery of am625 board Installing firmware tiboot3 Searching for partition id... Downloading file... Could not read status after end of manifest phase Done Done installing firmware tiboot3 Installing firmware u-boot Searching for partition id... Downloading file... Done Done installing firmware u-boot Installing firmware tispl Searching for partition id... Downloading file... Done Sending detach command... Done installing firmware tispl Done recovering am625 board We should see the following response on our serial terminal: .. code-block:: none :caption: Target (Serial) U-Boot SPL 2024.04-ti-g571136028904 (Sep 27 2024 - 18:33:50 +0000) SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)') SPL initial stack usage: 13568 bytes Trying to boot from DFU dwc3-am62 dwc3-usb@f900000: unable to get ti,syscon-phy-pll-refclk regmap ############################################################DOWNLOAD ... OK Ctrl+C to exit ... ################################################DOWNLOAD ... OK Ctrl+C to exit ... Authentication passed Authentication passed Authentication passed Loading Environment from nowhere... OK init_env from device 10 not supported! Authentication passed Authentication passed Starting ATF on ARM64 core... NOTICE: BL31: v2.11.0(release):v2.11.0-dirty NOTICE: BL31: Built : 11:51:22, May 23 2024 U-Boot SPL 2024.04-ti-g571136028904 (Sep 27 2024 - 18:33:50 +0000) SYSFW ABI: 4.0 (firmware rev 0x000a '10.0.8--v10.00.08 (Fiery Fox)') Trying to boot from DFU dwc3-am62 dwc3-usb@f900000: unable to get ti,syscon-phy-pll-refclk regmap dwc3-am62 dwc3-usb@f900000: unable to get ti,syscon-phy-pll-refclk regmap ####DOWNLOAD ... OK Ctrl+C to exit ... Authentication passed Authentication passed U-Boot 2024.04-ti-g571136028904 (Sep 27 2024 - 18:33:50 +0000) SoC: AM62AX SR1.0 HS-FS Model: PHYTEC phyBOARD-Lyra AM62A7 DRAM: 2 GiB Core: 84 devices, 31 uclasses, devicetree: separate MMC: mmc@fa10000: 0, mmc@fa00000: 1 Loading Environment from nowhere... OK In: serial@2800000 Out: serial@2800000 Err: serial@2800000 Net: eth0: ethernet@8000000port@1 Warning: ethernet@8000000port@2 (eth1) using random MAC address - 3e:6b:bb:f7:72:64 , eth1: ethernet@8000000port@2 Hit any key to stop autoboot: 0 => We should see U-Boot start up and attempt to boot from the SD-Card. We can stop in U-Boot by pressing any key at this point. Boot Switch Settings -------------------- * S7 should be ON to overide default boot settings. .. image:: ../../images/phycore-am62x/pb-07124_boot-usb.png :width: 300px :alt: SD Boot Switch .. image:: ../../images/phycore-am62ax/pb-07524_bootswitch.png :width: 500px :alt: phyBOARD-AM62Ax boot switches