Root/prod/atusb-flash

Source at commit 86ea428afcef59fd87407fe10ccd84c7294873a5 created 9 years 4 months ago.
By Werner Almesberger, prod/doc/analysis.html: emphasize that 1 MHz clock is normal without firmware
1#!/bin/sh
2
3. ./Common
4
5
6USB_ID=20b7:1540
7FW_BOOT_FILE=boot.hex
8FW_APP_FILE=atusb.bin
9
10
11#
12# This invocation of avrdude is derived from ben-wpan/atusb/fw/Makefile,
13# target "prog".
14#
15
16flash()
17{
18    step "Flash boot loader"
19    cmd "$REF_EXEC avrdude -F -p atmega32u2 -c nanonote_atusb -e \
20                  -U flash:w:$FW_BOOT_FILE:i \
21                  -U lfuse:w:0x60:m \
22                  -U hfuse:w:0xd8:m \
23                  -U lock:w:0x2f:m"
24    expect "lock verified"
25}
26
27
28enumerate()
29{
30    step "Enumeration"
31    cmd "$LOCAL_EXEC usbwait -i 0.1 -t 30 $USB_ID"
32    doit
33}
34
35
36dfu()
37{
38    step "DFU application"
39    cmd "$LOCAL_EXEC dfu-util -d $USB_ID -D $FW_APP_FILE"
40    expect "No error"
41}
42
43
44begin
45flash
46enumerate
47dfu
48

Archive Download this file



interactive