more sophisticated ways for updating the atusb firmware

Werner Almesberger werner at
Wed May 11 20:32:32 EDT 2011

In the previous mail [1], I described how to update the application
running on the atusb board. Now, if you don't like all this plugging
and unplugging, there's a more dignified way to run dfu-util,
provided that atusb contains a working firmware.

In case the atusb application is broken to the point that atusb does
not enumerate after the boot loader or for some other reason fails
to respond to commands, you need to follow the procedure in [1].

Now, in addition to the prerequisites from [1], you need the
following software on the PC:

  - atrf-reset
  - usbwait (optional)

You may already have these tools (they're part of the whole bundle
of tools that come with the ben-wpan project). If not, you can build
them from sources as follows:

- clone the ben-wpan and the f32xbase project:

  git clone git://
  git clone git://

- build the ben-wpan diagnostic and maintenance tools:

  cd ben-wpan/tools

- install them under /usr/local/

  make install

  or just run whichever tool you want from its directory. E.g.,
  atrf-reset would be in tools/atrf-reset/

This gives you atrf-reset and usbwait. atrf-reset can send a reset
command to the microcontroller in atusb.

Instead of unplugging and re-plugging, you would just run these
commands (with atusb plugged into the PC):

  atrf-reset -a
  sleep 1
  dfu-util -d 20b7:1540 -D atusb.bin

atrf-reset reports an error because the microcontroller resets
immediately, without even acknowledging the reset command.

The one second sleep is a rough approximation of the time it takes
to enumerate. A more precise method for catching the right moment
would be to run usbwait, which first waits for the device to
disappear from the USB bus, and then waits for it to reappear:

  atrf-reset -a
  usbwait -r -i 0.01 -t 5 20b7:1540
  dfu-util -d 20b7:1540 -D atusb.bin

The -i option sets the amount of time - in seconds - usbwait waits
between attempts to find the device. -t sets the timeout until
usbwait gives up.

These commands can also be found in the target "update" of


- Werner

More information about the discussion mailing list