Wiki

This version is outdated by a newer approved version.DiffThis version (29 Nov 2021 18:07) was approved by Robin Getz.The Previously approved version (20 Oct 2021 20:44) is available.Diff

This is an old revision of the document!


Pluto/M2k Firmware Updates

Latest Release

ADI default firmware images:

This zip file should include these files:

Filename Purpose
boot.dfu DFU file for First Stage Boot Loader, and U-Boot
boot.frm Firmware file for First Stage Boot Loader, U-Boot and it's default environment
pluto.dfu DFU file for Pluto Firmware, this would include FPGA Bit File, Linux kernel (all drivers), and ram based file system
m2k.dfu DFU file for M2k Firmware, this would include FPGA Bit File, Linux kernel (all drivers), and ram based file system
pluto.frm Firmware file for Pluto Firmware, this would include FPGA Bit File, Linux kernel (all drivers), and ram based file system
m2k.frm Firmware file for M2k Firmware, this would include FPGA Bit File, Linux kernel (all drivers), and ram based file system
uboot-env.dfu DFU file which includes the default U-Boot environment

Determining the firmware version

Before you update, check your existing version to understand if you really want to upgrade. There are a few ways to determine the version of firmware on your device.

Command Line

Use your favourite shell to access iio_attr, and ask the device:

rgetz@brain:~$ iio_attr -a -C fw_version
Using auto-detected IIO context at URI "usb:4.25.5"
fw_version: v0.31

The version on this devices is 0.31

Log In

SSH to the device. In the splash screen it will tell you…

If you can't remember the username/password, if it is the default, it will be on the mass storage device info.html page, under “Build Settings”. By default, it is username: root ; password is analog.

rgetz@brain:~$ ssh root@192.168.2.1
Warning: Permanently added '192.168.2.1' (ECDSA) to the list of known hosts.
root@192.168.2.1's password: analog
Welcome to:
______ _       _        _________________
| ___ \ |     | |      /  ___|  _  \ ___ \
| |_/ / |_   _| |_ ___ \ `--.| | | | |_/ /
|  __/| | | | | __/ _ \ `--. \ | | |    /
| |   | | |_| | || (_) /\__/ / |/ /| |\ \
\_|   |_|\__,_|\__\___/\____/|___/ \_| \_|

v0.31
http://wiki.analog.com/university/tools/pluto
# 

The version on this devices is 0.31

Check the mass storage device

If you are less keyboard prone, then you can check visually, as well.

Open the PlutoSDR mass storage device or M2K mass storage device. This will have a file called info.html. Double clicking on this file should open it in your favourite browser, clicking on the firmware tag in the top should take you down to a section that looks like this:

The version on this devices is 0.31

Upgrading

The easiest way to update the firmware is to use the mass storage device included in the default image. There are times when this might not be possible (when you aren't using the default image, or if you accidentally bricked your device by unplugging it during a firmware upgrade).

There are very legitimate Security Risks about loading random firmware images onto devices like the ADALM-PLUTO or ADALM2000, however, we decided early on that a learning tool must be open and accessible for people to experiment on. Please only use firmware images you have received from trusted locations.

Mass Storage Update

Copy the pluto.frm or m2k.frm file onto the mass storage device, and then eject it. If you have a Rev.C Pluto, copy the entire unzipped plutosdr-fw-v0.33.zip file. LED1 will start blinking rapidly.

Don't disconnect the device until rapid blinking stops!

Windows/OSX

  1. Open the Pluto or M2k mass storage device
  2. Download and open the firmware file
  3. Copy the file to the Mass Storage device:
    1. Windows
    2. OSX
  4. Eject (don't unplug) the mass storage device
    1. Windows
      Only Eject the drive (shown with the driver letter) not the parent device!
    2. OSX
  5. This will cause LED1 to blink rapidly. This means programming is taking place. Do not remove power (or USB) while the device is blinking rapidly. It does take approximately 4 minutes to properly program the device.
  6. Still do not unplug things. Try to be more patient.
  7. Once the device is done programming, it will re-appear as a mass storage device.
  8. Now you can unplug it, and use it as normal.

Linux

GUI

Command Line

It's exactly the same as the GUI instructions, copy it, and then eject it, then power cycle it. It's a little more tricky since eject needs the base device (it wants /dev/sdb not /dev/sdb1).

analog@imhotep:~/pluto$ cp ./pluto.frm /media/analog/PlutoSDR/
analog@imhotep:~/pluto$ mount | grep PlutoSDR | awk '{print $1}'
/dev/sdb1 
analog@imhotep:~/pluto$ sudo eject /dev/sdb
analog@imhotep:~/pluto$ echo “WAIT 4 minutes for firmware to update!!!! Do not unplug the device.”

DFU Update

USB Device Firmware Upgrade (DFU) is an official USB device class specification of the USB Implementers Forum. It specifies a vendor and device independent way of updating the firmware of a USB device. The concept is to have only one vendor-independent update tool as part of the operating system, which can then (given a particular firmware image) be downloaded into the device. During the firmware upgrade operation (when the Pluto or M2k is in “DFU” mode), the device changes its operating mode (it's no longer an SDR or an instrument, no longer uses it's standard PID/VID, but becomes a flash programmer).

This should only be necessary to recover your device if something accidentally happened during a firmware update (like having loose USB plugs, or bad USB cables, which cause a power cycle during a normal firmware update.)

Entering DFU mode

How to manually enter DFU mode?

In general, the preferred firmware upgrade is via the mass storage device. There are 3 ways to enter the DFU mode manually:

  1. Press the device button with a toothpick, paper-clip or similar and then apply power by plugging in the USB cable.
  2. From the device linux console type device_reboot sf. There are three ways to access the linux console:
    1. The USB console USB CDC ACM aka. ttyACM0 using putty, minicom, tera Term, etc.
    2. The UART console using ADALM-JTAGUART.
    3. The network console using ssh/slogin.
  3. Directly from u-boot serial console type: run dfu_sf. Access to the uboot command console is only available using ADALM-JTAGUART

When does the device automatically enter DFU mode?

The device enters DFU mode in case booting the multi component FIT image (Flattened Image Tree) fails. This may happen due to checksum failure caused by a corrupted previous firmware update.

How can I check if the device is in DFU mode?

When the device is in DFU mode, the DONE LED is OFF, while LED1 is constantly ON. The device switches it’s USB PID to 0xB674 (PlutoSDR DFU)

Windows

Check with Device Manager, and see if the DFU mode shows up.

on Linux

0456 is the Analog Devices Vendor ID (VID), by using using lsusb, you can check the mode. In normal use mode, the PlutoSDR will show up as Product ID (PID) b673:

analog@imhotep:~$ lsusb | grep 0456
Bus 003 Device 008: ID 0456:b673 Analog Devices, Inc. 
And in DFU mode:
analog@imhotep:~$ lsusb | grep 0456
Bus 003 Device 009: ID 0456:b674 Analog Devices, Inc.

On MAC

Check on

Update using DFU mode

How to update the firmware using DFU mode? How to rewrite the default uboot environment?

Windows

The PlutoSDR/M2K driver package bundles also a dfu utility. There is a windows command console batch script called UPDATE.BAT which eases the update procedure.

  1. Download and save UPDATE.BAT
  2. Download and unzip the latest PlutoSDR respectively M2k release
  3. Open a windows command prompt
  4. Execute UPDATE.BAT with the path to the pluto.dfu or m2k.dfu file. (In case you need to rewrite the default uboot environment the use the uboot-env.dfu file)
  5. Wait for the script to complete
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation.  All rights reserved.

C:\tmp>UPDATE.BAT c:\tmp\pluto.dfu
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Opening DFU capable USB device...
ID 0456:b674
Run-time device DFU version 0110
Claiming USB DFU Interface...
Setting Alternate Setting #1 ...
Determining device status: state = dfuIDLE, status = 0
dfuIDLE, continuing
DFU mode device DFU version 0110
Device returned transfer size 4096
Copying data from PC to DFU device
Download        [=========================] 100%      8694467 bytes
Download done.
state(7) = dfuMANIFEST, status(0) = No error condition is present
state(2) = dfuIDLE, status(0) = No error condition is present
Done!

C:\tmp>

Linux

sudo dfu-util -a firmware.dfu -D pluto.dfu

pluto.dfu is your firmware file in the dfu format.

OSX

dfu-util does not come with a default OSX install. You can install it with brew as:

brew install dfu-util

Updating the firmware is the same as Linux:

dfu-util -a firmware.dfu -D pluto.dfu

pluto.dfu is your firmware file in the dfu format.

Debugging DFU

If those instructions didn't help - you might get here. Hopefully this will help describe things.

The first thing to try is to make sure the device (Pluto or M2k) is actually in DFU mode. This is accomplished by asking the dfu utilities to list any devices that it finds, their configuration, interface and altsetting.

Although these examples are on a Linux machine, on Windows, it is similar. When you installed the Pluto or M2k Windows Drivers, it put the dfu-utils on your hard drive (that's why you accepted the GPL when you installed the Windows license). However, for many these are not on path. It's easy to go to this directory, and run things from there. For example:

C:\>cd “c:\Program Files\Analog Devices\PlutoSDR-M2K”
C:\Program Files\Analog Devices\PlutoSDR-M2K>dfu-util.exe -l
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0456:b674] ver=0221, devnum=7, cfg=1, intf=0, path="1-1", alt=4, name="spare.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=7, cfg=1, intf=0, path="1-1", alt=3, name="uboot-env.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=7, cfg=1, intf=0, path="1-1", alt=2, name="uboot-extra-env.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=7, cfg=1, intf=0, path="1-1", alt=1, name="firmware.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=7, cfg=1, intf=0, path="1-1", alt=0, name="boot.dfu", serial="UNKNOWN"

Just don't type in the sudo that is necessary on Linux.

Here it found one device, with 5 “partitions” in the flash map.

rgetz@brain:~/$ sudo dfu-util --list
[sudo] password for rgetz: 
dfu-util 0.9

Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
Copyright 2010-2016 Tormod Volden and Stefan Schmidt
This program is Free Software and has ABSOLUTELY NO WARRANTY
Please report bugs to http://sourceforge.net/p/dfu-util/tickets/

Found DFU: [0456:b674] ver=0221, devnum=104, cfg=1, intf=0, path="3-1.6.6", alt=4, name="spare.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=104, cfg=1, intf=0, path="3-1.6.6", alt=3, name="uboot-env.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=104, cfg=1, intf=0, path="3-1.6.6", alt=2, name="uboot-extra-env.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=104, cfg=1, intf=0, path="3-1.6.6", alt=1, name="firmware.dfu", serial="UNKNOWN"
Found DFU: [0456:b674] ver=0221, devnum=104, cfg=1, intf=0, path="3-1.6.6", alt=0, name="boot.dfu", serial="UNKNOWN"
rgetz@brain:~/$ 

If this doesn't show up, try again. dfu-utils is known to work better the 2nd time.

When the system boots, it follows this basic process:

  1. the U-Boot (boot section) will load,
  2. U-Boot will load it's environment (both the uboot-env and uboot-extra-env sections),
  3. U-Boot will then use that to load the kernel and ramfs (the firmware section).

dfu-util - a short dfu primer

DFU has lots of options, the ones to remember are:

  • -l List the currently attached DFU capable USB devices
  • -a <altsetting> Specify the Altseting of the DFU Interface
  • -D <file Write firmware from <file> into device
  • -U <file> Read firmware from device into <file>
  • -R Issue USB reset signalling after upload or download has finished.

The file releases always include:

  • boot.dfu
  • pluto.dfu
  • uboot-env.dfu

And corruption of those sections can cause problems in the booting process. In order, try writing the:

  1. firmware section:
    rgetz@brain:~/$ sudo dfu-util -a firmware.dfu -D ./pluto.dfu
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Match vendor ID from file: 0456
    Match product ID from file: b673
    Opening DFU capable USB device...
    ID 0456:b674
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #1 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%     10623523 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    rgetz@brain:~/$ 
    
  2. The U-Boot section:
    rgetz@brain:~/$ sudo dfu-util -a boot.dfu -D ./boot.dfu
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Match vendor ID from file: 0456
    Match product ID from file: b673
    Opening DFU capable USB device...
    ID 0456:b674
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #0 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%       469388 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    rgetz@brain:~/$ 
    
  3. the U-Boot environment :
    rgetz@brain:~/$ sudo dfu-util -a uboot-env.dfu -D ./uboot-env.dfu
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Match vendor ID from file: 0456
    Match product ID from file: b673
    Opening DFU capable USB device...
    ID 0456:b674
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #3 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from PC to DFU device
    Download	[=========================] 100%       131072 bytes
    Download done.
    state(7) = dfuMANIFEST, status(0) = No error condition is present
    state(2) = dfuIDLE, status(0) = No error condition is present
    Done!
    
  4. the uboot-extra-env.dfu. This is rarely needed to be changed. This is where things like factory calibration and ppm offset are stored. A good idea is just to check it:
    rgetz@brain:~/ sudo dfu-util -a uboot-extra-env.dfu -U ./uboot-extra-env.dfu
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Opening DFU capable USB device...
    ID 0456:b674
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #2 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from DFU device to PC
    Upload	[=========================] 100%         4096 bytes
    Upload done.
    
    This will upload things from the device to your PC. It can be checked with hexdump.
    rgetz@brain:~/Downloads/pluto2$ hexdump -C ./uboot-extra-env.dfu
    00000000  ff ff ff ff ff ff ff ff  ff ff ff ff ff ff ff ff  |................|
    *
    00001000
    
    Here we can see this is blank (all 0xFF), meaning that no custom calibration data is currently used on this device. This is common for early models. If you need to clear it, just make a file that starts with 0xFF, and write it. Note that this section of flash is protected. Therefore, the flash must be unlocked if you want to overwrite this partition. The U-Boot environment sections are protected with a CRC32, so if something has become corrupt, it will be skipped. Even if this partition is bad and CRC32 passes, only the xo_correction is used and itself will fail gracefully if wrong values provided.
  5. The last time your access things, you can tell the device to reset with the -R option.
    rgetz@brain:~/ sudo dfu-util -R -a uboot-extra-env.dfu -U ./uboot-extra-env.dfu
    dfu-util 0.9
    
    Copyright 2005-2009 Weston Schmidt, Harald Welte and OpenMoko Inc.
    Copyright 2010-2016 Tormod Volden and Stefan Schmidt
    This program is Free Software and has ABSOLUTELY NO WARRANTY
    Please report bugs to http://sourceforge.net/p/dfu-util/tickets/
    
    Opening DFU capable USB device...
    ID 0456:b674
    Run-time device DFU version 0110
    Claiming USB DFU Interface...
    Setting Alternate Setting #2 ...
    Determining device status: state = dfuIDLE, status = 0
    dfuIDLE, continuing
    DFU mode device DFU version 0110
    Device returned transfer size 4096
    Copying data from DFU device to PC
    Upload	[=========================] 100%         4096 bytes
    Upload done.
    Resetting USB to switch back to runtime mode
    

Release Notification

When a new release is made, you can be automatically notified if you are watching the release section on github. To do this, you need to be logged into github with a valid account (and have a valid email where you want notifications to show up). Then just go to the GitHub Scopy site; GitHub M2k Firmware site or GitHub PlutoSDR Firmware site. Scopy has built in notification (it will tell you on startup if a new feature is available, but if you are a lab manager, and still want to be notified - the default github notifications are the best solution).

Click on the “Watch” button in the right hand side, then decide if you want to watch everything, or just releases (under Custom). (Click on the picture if you need it bigger).

university/tools/pluto/users/firmware.1638205666.txt.gz · Last modified: 29 Nov 2021 18:07 by Robin Getz