AM335x USB Device Firmware Upgrade User Guide

From Texas Instruments Wiki
Jump to: navigation, search
Construction Icon small.png This page is currently under construction. The content of this page is due to change quite frequently and thus the quality and accuracy are not guaranteed until this message has been removed. Please feel free to contribute to this page while construction is in progress.


TIBanner.png
AM335x USB Device Firmware Upgrade User guide
Linux PSP

Introduction

USB Device Firmware upgrade is used to upgrade the various firmwares on the deive such as SPL, u-boot, kernel and the filesystem. DFU exposes all the nand partitions to host machine as a different USB interfaces.

We need to have a host side application to communicate to DFU capable device as windows and linux host doesn't have a standard DFU utility. We are using Openmoko's host side dfu-utils which can be downloaded here.

Apart from the dfu-utils we need to provide DFU driver (.inf file) when DFU device is connected first time to the windows host. The driver is also available in above host-utils download.

Steps to add DFU on AM335x

* Clone the latest u-boot tree.
* Apply all the patches. Note: The patches would be made available soon
* Now compile the uboot and flash it on the evm.

Steps to use DFU on Windows XP

1. Select the default mtdparts.

   mtdparts default

    In case mtdparts variable is not set properly, it would lead to abrupt ending of the USB DFU mode.

    To see how the partitions are defined for AM335x refer this.

    Make sure the partitions match as defined in this page else it could lead to some unpredictable results when using device firmware upgrade (DFU).

   After the mtdparts variable has been set, run mtdparts in the uboot prompt. It should display the partitions as (These are the default partitions for AM335x,

it could differ depending on the mtdparts variable in uboot environment).

U-Boot# mtdparts
device nand0 <nand.0>, # parts = 8
 #: name                size            offset          mask_flags
 0: spl                 0x00020000      0x00000000      0
 1: spl.backup1         0x00020000      0x00020000      0
 2: spl.backup2         0x00020000      0x00040000      0
 3: spl.backup3         0x00020000      0x00060000      0
 4: u-boot              0x001e0000      0x00080000      0
 5: ubootenv            0x00020000      0x00260000      0
 6: kernel              0x00500000      0x00280000      0
 7: filesystem          0x0f880000      0x00780000      0

active partition: nand0,0 - (spl) 0x00020000 @ 0x00000000

defaults:
mtdids  : nand0=nand.0
mtdparts: mtdparts=nand.0:128k(spl),128k(spl.backup1),128k(spl.backup2),128k(spl.backup3),1920k(u-boot),128k(ubootenv),
5120k(kernel),-(filesystem)

2. Run the following command in the uboot prompt to enter into DFU mode

U-Boot# dfu <module number>

The module number refers to the the usb module you wish to use. Make sure the usb module you are refering is capable to work in device mode.

This command would disable the serial input console and move into DFU mode. The DFU mode may be aborted using ctrl+c to enter into normal mode.

NOTE: Make sure never use abort when downloading is going on. This could corrupt your image in nand flash.
Abort is to be used at one's own risk.

3. If using the window host PC for the first time, we need to change the vendor ID and product ID in the .inf file available in the downloaded host-utils.

The .inf file with the required changes looks like :(Showing only the changed part)

;--------------------------------------------------------------------------
; Devices
;--------------------------------------------------------------------------

;[Devices]
;"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a7

;[Devices.NT]
;"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a7

;[Devices.NTAMD64]
;"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a7


[Devices]
"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a8

[Devices.NT]
"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a8

[Devices.NTAMD64]
"Device Firmware Upgrade"=LIBUSB_DEV, USB\VID_0525&PID_a4a8

The vendor ID and the product ID need to be changed as shown (Vendor ID: 0525, Product ID a4a7). After this, windows would detect the device and install the driver for DFU support.

You may be required to provide the path where the .sys file is located (Path where the host-utils have been downloaded). This would install the driver and add new device into the device manager as:

LibUSB-Win32-Devices Device Firmware Upgrade.

we are now ready to use the host application for USB DFU.

4. Open the command prompt of windows and run dfu-util.exe adding required parameters.

$ dfu-util.exe -l to display the list of alternate interfaces available.

dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=0, name="RAM 0x80000000"

Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=1, name="spl"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=2, name="spl.backup1"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=3, name="spl.backup2"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=4, name="spl.backup3"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=5, name="u-boot"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=6, name="ubootenv"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=7, name="kernel"
Found DFU: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=8, name="filesystem"

$ dfu-util.exe -a <interface Number> -D <filename> to download image named filename(specify the complete path to the file) to specified interface number.

In case no interface number is provided, by default it takes alt = 0 and starts the downloading of required image to RAM at specified addresss.

dfu-util - (C) 2007 by OpenMoko Inc.
This program is Free Software and has ABSOLUTELY NO WARRANTY
Opening USB Device 0x0000:0x0000...
Found Runtime: [0x0525:0xa4a7] devnum=1, cfg=0, intf=0, alt=1, name="spl"
Setting Configuration 1...
Claiming USB DFU Interface...
Setting Alternate Setting ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
Transfer Size = 0x1000
bytes_per_hash=748
Starting download: [##################################################] finished
!
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

$ dfu-util.exe -a <Interface Number> -D <filename> -R to download the image named filename (specify the complete path) to specified interface number and issue a reset to change the mode of device from usb dfu mode to normal mode. In case more than one image needs to be upgraded, prefer to run dfu-util.exe with -R for the last image to be upgraded.

You can also upgrade more than one image using a single command as:

dfu-util.exe -a <interface number 1> -D <filename 1> & dfu-util.exe -a <Interface Number 2> -D <filename 2> & dfu-util.exe -a 
<interface number 3> -D <filename 3> -R

Make sure not to give -R in first or second command in the above case as it would take device out of dfu mode and won't allow further upgrades.

Warning: Make sure to give the interface number properly as it won't check whether the image downloaded using dfu is going
 at the correct address.In case one tries to upgrade SPL partition with the kernel image, it would allow to do so although 
it would give an error due to less size available.So it is the responsibility of the user to make sure the partitions are made
 properly and correct interface number is given.

5. Once the images have been upgraded, reboot the device and it should boot up with the new images in case the transfer has been successful.

Warning: The SPL and uboot images must be upgraded with care. In case of some power failure or any other problem the 
previously flashed images may become corrupted and it might be a case that the device won't boot again in NAND mode.