27 maja 2008

Programowanie mikrokontrolerow AVR + AVR-Doper + USB + Linux + UBUNTU

Sesja z konfigurowana programatora AVR pod Lnuxem



$ sudo dmesg

...

[ 56.193165] NET: Registered protocol family 10
[ 56.193313] lo: Disabled Privacy Extensions
[ 56.193520] ADDRCONF(NETDEV_UP): eth0: link is not ready
[ 66.331696] nas0: no IPv6 routers present
[ 851.674370] usb 2-1: new low speed USB device using ohci_hcd and address 2
[ 851.912107] usb 2-1: configuration #1 chosen from 1 choice
[ 852.180868] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[ 852.189322] usbcore: registered new interface driver cdc_acm
[ 852.189896] /build/buildd/linux-source-2.6.22-2.6.22/drivers/usb/class/cdc-acm.c: v0.25:USB Abstract Control Model driver for USB modems and ISDN adapters
[ 863.085900] usb 2-1: USB disconnect, address 2
[ 910.664830] usb 2-1: new low speed USB device using ohci_hcd and address 3
[ 910.902548] usb 2-1: configuration #1 chosen from 1 choice
[ 910.906498] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
$ avrdude -?
$ sudo ls /dev/ttyACM0
/dev/ttyACM0
$ sudo less /dev/ttyACM0
/dev/ttyACM0 is not a regular file (use -f to see it)
$ sudo less -f /dev/ttyACM0
$ avrdude -m t2313 -p /dev/ttyACM0
avrdude: invalid option -- m
Usage: avrdude [options]
Options:
-p Required. Specify AVR device.
-b Override RS-232 baud rate.
-B Specify JTAG/STK500v2 bit clock period (us).
-C Specify location of configuration file.
-c Specify programmer type.
-D Disable auto erase for flash memory
-i ISP Clock Delay [in microseconds]
-P Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U :r|w|v:[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E [,] List programmer exit specifications.
-y Count # erase cycles in EEPROM.
-Y Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-? Display this usage.

avrdude project:
$ avrdude -m t2313 -p /dev/ttyACM0 -c usbasp
avrdude: invalid option -- m
Usage: avrdude [options]
Options:
-p Required. Specify AVR device.
-b Override RS-232 baud rate.
-B Specify JTAG/STK500v2 bit clock period (us).
-C Specify location of configuration file.
-c Specify programmer type.
-D Disable auto erase for flash memory
-i ISP Clock Delay [in microseconds]
-P Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U :r|w|v:[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E [,] List programmer exit specifications.
-y Count # erase cycles in EEPROM.
-Y Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-? Display this usage.

avrdude project:
$ avrdude -m t2313 -P /dev/ttyACM0 -c usbasp
avrdude: invalid option -- m
Usage: avrdude [options]
Options:
-p Required. Specify AVR device.
-b Override RS-232 baud rate.
-B Specify JTAG/STK500v2 bit clock period (us).
-C Specify location of configuration file.
-c Specify programmer type.
-D Disable auto erase for flash memory
-i ISP Clock Delay [in microseconds]
-P Specify connection port.
-F Override invalid signature check.
-e Perform a chip erase.
-O Perform RC oscillator calibration (see AVR053).
-U :r|w|v:[:format]
Memory operation specification.
Multiple -U options are allowed, each request
is performed in the order specified.
-n Do not write anything to the device.
-V Do not verify.
-u Disable safemode, default when running from a script.
-s Silent safemode operation, will not ask you if
fuses should be changed back.
-t Enter terminal mode.
-E [,] List programmer exit specifications.
-y Count # erase cycles in EEPROM.
-Y Initialize erase cycle # in EEPROM.
-v Verbose output. -v -v for more.
-q Quell progress output. -q -q for less.
-? Display this usage.

avrdude project:
$ qavrdude -m t2313 -P /dev/ttyACM0 -c usbasp


$ sudo mcedit /etc/udev/rules.d/

$ sudo mcedit /etc/udev/rules.d/65-programator.rules

$ sudo mcedit /etc/udev/rules.d/
00-init.rules 70-persistent-cd.rules
05-options.rules 70-persistent-net.rules
20-names.rules 75-cd-aliases-generator.rules
30-cdrom_id.rules 75-persistent-net-generator.rules
40-permissions.rules 80-programs.rules
45-fuse.rules 85-alsa.rules
45-hplip.rules 85-hdparm.rules
45-libgphoto2.rules 85-hplj10xx.rules
45-libsane.rules 85-hwclock.rules
50-xserver-xorg-input-wacom.rules 85-ifupdown.rules
55-hpmud.rules 85-pcmcia.rules
60-libpisock.rules 90-modprobe.rules
60-symlinks.rules 95-hal.rules
65-dmsetup.rules 99-udevmonitor.rules
65-persistent-input.rules libmtp.rules
65-persistent-storage.rules README
65-programator.rules
$ sudo mcedit /etc/udev/rules.d/6
60-libpisock.rules 65-dmsetup.rules 65-persistent-storage.rules
60-symlinks.rules 65-persistent-input.rules 65-programator.rules
$ sudo mcedit /etc/udev/rules.d/65-persistent-storage.rules

$ sudo mcedit /etc/udev/rules.d/65-programator.rules

$ avrdude -p m8 -c stk500v2 -P /dev/bus/usb/001/014
avrdude: ser_open(): can't open device "/dev/bus/usb/001/014": No such file or directory
$ avrdude -p m8 -c stk500v2 -P /dev/AVR
avrdude: ser_open(): can't open device "/dev/AVR": No such file or directory
$ avrdude -p m8 -c stk500v2 -P /dev/ttyACM0

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

$ avrdude -p m8 -c stk500v2 -P /dev/ttyACM0

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

$ avrdude -p t2313 -c stk500v2 -P /dev/ttyACM0

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

$ avrdude -p t2313 -c stk500v2 -P /dev/ttyACM0 -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ avrdude -p t2313 -c stk500v2 -P /dev/ttyACM0 -F
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/ttyACM0
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

$ modprobe usbserial
FATAL: Error inserting usbserial (/lib/modules/2.6.22-15-generic/kernel/drivers/usb/serial/usbserial.ko): Operation not permitted
$ sudo modprobe usbserial
$ udevinfo /dev/ttyACM0
missing option
$ sudo udevinfo /dev/ttyACM0
missing option
$ sudo udevinfo /dev/ttyACM0
missing option
$ udevinfo -a -p $(udevinfo -q path -n udevinfo -a -p $(udevinfo -q path -n /dev/sdb1))
$ dprobe usbserial
bash: dprobe: polecenie nieodnalezione
$
$ dprobe usbserial
bash: dprobe: polecenie nieodnalezione
$ FATAL: Error inserting us
$ udevinfo -a -p $(udevinfo -q path -n /dev/ttyACM0)

Udevinfo starts with the device specified by the devpath and then
walks up the chain of parent devices. It prints for every device
found, all possible attributes in the udev rules key format.
A rule to match, can be composed by the attributes of the device
and the attributes from one single parent device.

looking at device '/class/tty/ttyACM0':
KERNEL=="ttyACM0"
SUBSYSTEM=="tty"
DRIVER==""
ATTR{dev}=="166:0"

looking at parent device '/devices/pci0000:00/0000:00:03.1/usb2/2-1/2-1:1.0':
KERNELS=="2-1:1.0"
SUBSYSTEMS=="usb"
DRIVERS=="cdc_acm"
ATTRS{modalias}=="usb:v16C0p05E1d0100dc02dsc00dp00ic02isc02ip01"
ATTRS{bInterfaceProtocol}=="01"
ATTRS{bInterfaceSubClass}=="02"
ATTRS{bInterfaceClass}=="02"
ATTRS{bNumEndpoints}=="01"
ATTRS{bAlternateSetting}==" 0"
ATTRS{bInterfaceNumber}=="00"
ATTRS{bmCapabilities}=="2"

looking at parent device '/devices/pci0000:00/0000:00:03.1/usb2/2-1':
KERNELS=="2-1"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{product}=="AVR-Doper"
ATTRS{manufacturer}=="obdev.at"
ATTRS{quirks}=="0x0"
ATTRS{maxchild}=="0"
ATTRS{version}==" 1.01"
ATTRS{devnum}=="3"
ATTRS{busnum}=="2"
ATTRS{speed}=="1.5"
ATTRS{bMaxPacketSize0}=="8"
ATTRS{bNumConfigurations}=="1"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="02"
ATTRS{bcdDevice}=="0100"
ATTRS{idProduct}=="05e1"
ATTRS{idVendor}=="16c0"
ATTRS{bMaxPower}=="200mA"
ATTRS{bmAttributes}=="80"
ATTRS{bConfigurationValue}=="1"
ATTRS{bNumInterfaces}==" 2"
ATTRS{configuration}==""
ATTRS{dev}=="189:130"

looking at parent device '/devices/pci0000:00/0000:00:03.1/usb2':
KERNELS=="usb2"
SUBSYSTEMS=="usb"
DRIVERS=="usb"
ATTRS{serial}=="0000:00:03.1"
ATTRS{product}=="OHCI Host Controller"
ATTRS{manufacturer}=="Linux 2.6.22-15-generic ohci_hcd"
ATTRS{quirks}=="0x0"
ATTRS{maxchild}=="3"
ATTRS{version}==" 1.10"
ATTRS{devnum}=="1"
ATTRS{busnum}=="2"
ATTRS{speed}=="12"
ATTRS{bMaxPacketSize0}=="64"
ATTRS{bNumConfigurations}=="1"
ATTRS{bDeviceProtocol}=="00"
ATTRS{bDeviceSubClass}=="00"
ATTRS{bDeviceClass}=="09"
ATTRS{bcdDevice}=="0206"
ATTRS{idProduct}=="0000"
ATTRS{idVendor}=="0000"
ATTRS{bMaxPower}==" 0mA"
ATTRS{bmAttributes}=="e0"
ATTRS{bConfigurationValue}=="1"
ATTRS{bNumInterfaces}==" 1"
ATTRS{configuration}==""
ATTRS{dev}=="189:128"

looking at parent device '/devices/pci0000:00/0000:00:03.1':
KERNELS=="0000:00:03.1"
SUBSYSTEMS=="pci"
DRIVERS=="ohci_hcd"
ATTRS{msi_bus}==""
ATTRS{broken_parity_status}=="0"
ATTRS{modalias}=="pci:v00001039d00007001sv00001849sd00007001bc0Csc03i10"
ATTRS{local_cpus}=="ff"
ATTRS{irq}=="17"
ATTRS{class}=="0x0c0310"
ATTRS{subsystem_device}=="0x7001"
ATTRS{subsystem_vendor}=="0x1849"
ATTRS{device}=="0x7001"
ATTRS{vendor}=="0x1039"

looking at parent device '/devices/pci0000:00':
KERNELS=="pci0000:00"
SUBSYSTEMS==""
DRIVERS==""
ATTRS{uevent}==""

$ udevinfo -a -p $(udevinfo -q path -n /dev/ttyACM0)


$ avrdude -p t2313 -c avr_doper -P /dev/ttyACM0 -F -u -t | grep doper

avrdude: Can't find programmer id "avr_doper"

Valid programmers are:
dasa3 = serial port banging, reset=!dtr sck=rts mosi=txd miso=cts [/etc/avrdude.conf:770]
dasa = serial port banging, reset=rts sck=dtr mosi=txd miso=cts [/etc/avrdude.conf:757]
siprog = Lancos SI-Prog [/etc/avrdude.conf:744]
ponyser = design ponyprog serial, reset=!txd sck=rts mosi=dtr miso=cts [/etc/avrdude.conf:731]
frank-stk200 = Frank STK200 [/etc/avrdude.conf:696]
blaster = Altera ByteBlaster [/etc/avrdude.conf:683]
ere-isp-avr = ERE ISP-AVR [/etc/avrdude.conf:673]
atisp = AT-ISP V1.1 programming cable for AVR-SDK1 from [/etc/avrdude.conf:663]
dapa = Direct AVR Parallel Access cable [/etc/avrdude.conf:652]
xil = Xilinx JTAG cable [/etc/avrdude.conf:639]
futurlec = Futurlec.com programming cable. [/etc/avrdude.conf:622]
abcmini = ABCmini Board, aka Dick Smith HOTCHIP [/etc/avrdude.conf:612]
picoweb = Picoweb Programming Cable, http://www.picoweb.net/ [/etc/avrdude.conf:602]
sp12 = Steve Bolt's Programmer [/etc/avrdude.conf:591]
alf = Nightshade ALF-PgmAVR, http://nightshade.homeip.net/ [/etc/avrdude.conf:575]
bascom = Bascom SAMPLE programming cable [/etc/avrdude.conf:565]
dt006 = Dontronics DT006 [/etc/avrdude.conf:555]
pony-stk200 = Pony Prog STK200 [/etc/avrdude.conf:543]
stk200 = STK200 [/etc/avrdude.conf:527]
bsd = Brian Dean's Programmer, http://www.bsdhome.com/avrdude/ [/etc/avrdude.conf:516]
pavr = Jason Kyle's pAVR Serial Programmer [/etc/avrdude.conf:508]
dragon_dw = Atmel AVR Dragon in debugWire mode [/etc/avrdude.conf:501]
dragon_hvsp = Atmel AVR Dragon in HVSP mode [/etc/avrdude.conf:493]
dragon_pp = Atmel AVR Dragon in PP mode [/etc/avrdude.conf:485]
dragon_isp = Atmel AVR Dragon in ISP mode [/etc/avrdude.conf:477]
dragon_jtag = Atmel AVR Dragon in JTAG mode [/etc/avrdude.conf:469]
jtag2dw = Atmel JTAG ICE mkII in debugWire mode [/etc/avrdude.conf:461]
jtag2isp = Atmel JTAG ICE mkII in ISP mode [/etc/avrdude.conf:453]
jtag2 = Atmel JTAG ICE mkII [/etc/avrdude.conf:445]
jtag2fast = Atmel JTAG ICE mkII [/etc/avrdude.conf:437]
jtag2slow = Atmel JTAG ICE mkII [/etc/avrdude.conf:429]
jtagmkII = Atmel JTAG ICE mkII [/etc/avrdude.conf:421]
jtag1slow = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:414]
jtag1 = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:406]
jtagmkI = Atmel JTAG ICE (mkI) [/etc/avrdude.conf:398]
avr911 = Atmel AppNote AVR911 AVROSP [/etc/avrdude.conf:392]
avr109 = Atmel AppNote AVR109 Boot Loader [/etc/avrdude.conf:386]
butterfly = Atmel Butterfly Development Board [/etc/avrdude.conf:380]
usbasp = USBasp, http://www.fischl.de/usbasp/ [/etc/avrdude.conf:374]
avr910 = Atmel Low Cost Serial Programmer [/etc/avrdude.conf:368]
stk500hvsp = Atmel STK500 V2 in high-voltage serial programming mode [/etc/avrdude.conf:362]
stk500pp = Atmel STK500 V2 in parallel programming mode [/etc/avrdude.conf:356]
stk500v2 = Atmel STK500 Version 2.x firmware [/etc/avrdude.conf:350]
stk500v1 = Atmel STK500 Version 1.x firmware [/etc/avrdude.conf:344]
stk500 = Atmel STK500 [/etc/avrdude.conf:338]
avrisp2 = Atmel AVR ISP mkII [/etc/avrdude.conf:328]
avrispmkII = Atmel AVR ISP mkII [/etc/avrdude.conf:322]
avrispv2 = Atmel AVR ISP V2 [/etc/avrdude.conf:316]
avrisp = Atmel AVR ISP [/etc/avrdude.conf:310]

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR -F
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0xffffff
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo mcedit /etc/udev/rules.d/40-permissions.rules

$ sudo mcedit /etc/udev/rules.d/65-
65-dmsetup.rules 65-persistent-storage.rules
65-persistent-input.rules 65-programator.rules
$ sudo mcedit /etc/udev/rules.d/65-programator.rules

$ sudo cat /etc/udev/rules.d/65-programator.rules
KERNEL=="ttyACM0", NAME="AVR"


[ 4003.035799] usb 2-1: USB disconnect, address 5
[ 5253.262662] usb 2-1: new low speed USB device using ohci_hcd and address 6
[ 5253.500452] usb 2-1: configuration #1 chosen from 1 choice
[ 5253.504384] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[ 6125.721804] usb 2-1: USB disconnect, address 6
[ 6130.036372] usb 2-1: new low speed USB device using ohci_hcd and address 7
[ 6130.274132] usb 2-1: configuration #1 chosen from 1 choice
[ 6130.278060] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
[ 6399.501693] usb 2-1: USB disconnect, address 7
[ 6404.684821] usb 2-1: new low speed USB device using ohci_hcd and address 8
[ 6404.922588] usb 2-1: configuration #1 chosen from 1 choice
[ 6404.926555] cdc_acm 2-1:1.0: ttyACM0: USB ACM device
$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F -t -u
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
avrdude> stk 4
>>> stk 4
avrdude: invalid command "stk"
avrdude> stv 4
>>> stv 4
avrdude: invalid command "stv"
avrdude> help
>>> help
Valid commands:

dump : dump memory : dump
read : alias for dump
write : write memory : write ...
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send
parms : display adjustable parameters (STK500 only)
vtarg : set (STK500 only)
varef : set (STK500 only)
fosc : set (STK500 only)
sck : set (STK500 only)
help : help
? : help
quit : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> read
>>> read
Usage: dump [ ]
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.229 MHz
SCK period : 2.2 us
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.229 MHz
SCK period : 2.2 us
avrdude> sck 1
>>> sck 1
avrdude: stk500v2_set_sck_period(): p = 1.0 us too small, using 1.1 us
avrdude> sck 2
>>> sck 2
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.229 MHz
SCK period : 2.2 us
avrdude> sck 3
>>> sck 3
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.229 MHz
SCK period : 3.3 us
avrdude> sck 4
>>> sck 4
avrdude> help
>>> help
Valid commands:

dump : dump memory : dump
read : alias for dump
write : write memory : write ...
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send
parms : display adjustable parameters (STK500 only)
vtarg : set (STK500 only)
varef : set (STK500 only)
fosc : set (STK500 only)
sck : set (STK500 only)
help : help
? : help
quit : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> quit
>>> quit

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
Double check connections and try again, or use -F to override
this check.


avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F -t -u
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.04s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.229 MHz
SCK period : 4.4 us
avrdude> help
>>> help
Valid commands:

dump : dump memory : dump
read : alias for dump
write : write memory : write ...
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send
parms : display adjustable parameters (STK500 only)
vtarg : set (STK500 only)
varef : set (STK500 only)
fosc : set (STK500 only)
sck : set (STK500 only)
help : help
? : help
quit : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> fosc 12.0000
>>> fosc 12.0000
avrdude: stk500v2_set_fosc(): f = 12 Hz too low, 14 Hz min
avrdude (fosc): failed to set oscillator_frequency (rc = -1)
avrdude> fosc 12000000
>>> fosc 12000000
avrdude: stk500v2_set_fosc(): f = 12.000 MHz too high, using 3.686 MHz
avrdude> fosc 12000
>>> fosc 12000
avrdude> quit
>>> quit

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A

avrdude: safemode: Fuses OK

avrdude done. Thank you.

$ sudo avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F -t -u
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: stk500v2_command(): command failed
avrdude: initialization failed, rc=-1
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x000000
avrdude: Yikes! Invalid device signature.
avrdude: Expected signature for ATtiny2313 is 1E 91 0A
avrdude>
avrdude> fosc 1.229 MHz
>>> fosc 1.229 MHz
Usage: fosc [M|k] | off
avrdude> fosc 1.229M
>>> fosc 1.229M
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.843 MHz
SCK period : 4.4 us
avrdude> fosc 12.00M
>>> fosc 12.00M
avrdude: stk500v2_set_fosc(): f = 12.000 MHz too high, using 3.686 MHz
avrdude> fosc 12M
>>> fosc 12M
avrdude: stk500v2_set_fosc(): f = 12.000 MHz too high, using 3.686 MHz
avrdude> fosc 1.229M
>>> fosc 1.229M
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.843 MHz
SCK period : 4.4 us
avrdude> help
>>> help
Valid commands:

dump : dump memory : dump
read : alias for dump
write : write memory : write ...
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send
parms : display adjustable parameters (STK500 only)
vtarg : set (STK500 only)
varef : set (STK500 only)
fosc : set (STK500 only)
sck : set (STK500 only)
help : help
? : help
quit : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> part
>>> part

AVR Part : ATtiny2313
Chip Erase delay : 9000 us
PAGEL : PD4
BS2 : PD6
RESET disposition : possible i/o
RETRY pulse : SCK
serial program mode : yes
parallel program mode : yes
Timeout : 200
StabDelay : 100
CmdexeDelay : 25
SyncLoops : 32
ByteDelay : 0
PollIndex : 3
PollValue : 0x53
Memory Detail :

Block Poll Page Polled
Memory Type Mode Delay Size Indx Paged Size Size #Pages MinW MaxW ReadBack
----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
eeprom 65 6 4 0 no 128 4 0 4000 4500 0xff 0xff
flash 65 6 32 0 yes 2048 32 64 4500 4500 0xff 0xff
signature 0 0 0 0 no 3 0 0 0 0 0x00 0x00
lock 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
lfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
hfuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
efuse 0 0 0 0 no 1 0 0 9000 9000 0x00 0x00
calibration 0 0 0 0 no 2 0 0 0 0 0x00 0x00

avrdude> help
>>> help
Valid commands:

dump : dump memory : dump
read : alias for dump
write : write memory : write ...
erase : perform a chip erase
sig : display device signature bytes
part : display the current part information
send : send a raw command : send
parms : display adjustable parameters (STK500 only)
vtarg : set (STK500 only)
varef : set (STK500 only)
fosc : set (STK500 only)
sck : set (STK500 only)
help : help
? : help
quit : quit

Use the 'part' command to display valid memory types for use with the
'dump' and 'write' commands.

avrdude> sck
>>> sck
Usage: sck
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.843 MHz
SCK period : 4.4 us
avrdude> sck 1
>>> sck 1
avrdude: stk500v2_set_sck_period(): p = 1.0 us too small, using 1.1 us
avrdude> sck 1
>>> sck 1
avrdude: stk500v2_set_sck_period(): p = 1.0 us too small, using 1.1 us
avrdude> parms
>>> parms
Vtarget : 4.9 V
Varef : 0.0 V
Oscillator : 1.843 MHz
SCK period : 1.1 us
avrdude> sck 2
>>> sck 2
avrdude> parms
>>> parms
Vtarget : 5.0 V
Varef : 0.0 V
Oscillator : 1.843 MHz
SCK period : 2.2 us
avrdude>


$ whereis avrdude
avrdude: /usr/bin/avrdude /etc/avrdude.conf /usr/share/man/man1/avrdude.1.gz
$ touch /tmp/123.hex
$ chmod a+wrx /tmp/123.hex
$ less /tmp/123.hexqqqq
/tmp/123.hexqqqq: No such file or directory
$ less /tmp/123.hex
$ cat /tmp/123.hex
:2000000012C02AC029C028C027C026C025C024C023C022C021C020C01FC01EC01DC01CC0C1
:200020001BC01AC019C011241FBECFEDCDBF10E0A0E6B0E0ECE9F0E002C005900D92A03661
:20004000B107D9F710E0A0E6B0E001C01D92A036B107E1F710D021C0D3CF08958FEF87BB7C
:2000600081BB18BA12BA08958FEF88BB82BB089518BA12BA08958FEF87BB80BB849B04C055
:1C00800088B3847088BB01C0C29A859B04C088B3827088BBF3CFC19AF1CFFFCFD6
:00000001FF
$

user@desktop:~/Desktop/Dokumenty/AVR8_Burn-O-Mat$ avrdude -p t2313 -c stk500v2 -P /dev/AVR-Doper-USB-Programmer -F
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.03s

avrdude: Device signature = 0x1e910a

avrdude: safemode: Fuses OK

avrdude done. Thank you.

user@desktop:~/Desktop/Dokumenty/AVR8_Burn-O-Mat$ sh start.sh



ODCZYT FUSEBYTES


/usr/bin/avrdude -q -u -C /etc/avrdude.conf -p t2313 -P /dev/AVR-Doper-USB-Programmer -c stk500v2 -E noreset,novcc -F -U efuse:r:/tmp/efuse41068.hex:r -U hfuse:r:/tmp/hfuse41067.hex:r -U lfuse:r:/tmp/lfuse41066.hex:r
avrdude: WARNING: -E option not supported by this programmer type

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e910a
avrdude: reading efuse memory:
avrdude: writing output file "/tmp/efuse41068.hex"
avrdude: reading hfuse memory:
avrdude: writing output file "/tmp/hfuse41067.hex"
avrdude: reading lfuse memory:
avrdude: writing output file "/tmp/lfuse41066.hex"

avrdude done. Thank you.



ZAPIS FUSEBITES


/usr/bin/avrdude -q -u -C /etc/avrdude.conf -p t2313 -P /dev/AVR-Doper-USB-Programmer -c stk500v2 -E noreset,novcc -F -U efuse:w:0xFF:m -U hfuse:w:0xDF:m -U lfuse:w:0xFD:m
avrdude: WARNING: -E option not supported by this programmer type

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e910a
avrdude: reading input file "0xFF"
avrdude: writing efuse (1 bytes):
avrdude: 1 bytes of efuse written
avrdude: verifying efuse memory against 0xFF:
avrdude: load data efuse data from input file 0xFF:
avrdude: input file 0xFF contains 1 bytes
avrdude: reading on-chip efuse data:
avrdude: verifying ...
avrdude: 1 bytes of efuse verified
avrdude: reading input file "0xDF"
avrdude: writing hfuse (1 bytes):
avrdude: 1 bytes of hfuse written
avrdude: verifying hfuse memory against 0xDF:
avrdude: load data hfuse data from input file 0xDF:
avrdude: input file 0xDF contains 1 bytes
avrdude: reading on-chip hfuse data:
avrdude: verifying ...
avrdude: 1 bytes of hfuse verified
avrdude: reading input file "0xFD"
avrdude: writing lfuse (1 bytes):
avrdude: 1 bytes of lfuse written
avrdude: verifying lfuse memory against 0xFD:
avrdude: load data lfuse data from input file 0xFD:
avrdude: input file 0xFD contains 1 bytes
avrdude: reading on-chip lfuse data:
avrdude: verifying ...
avrdude: 1 bytes of lfuse verified

avrdude done. Thank you.



ODCZYTANIE ZAWARTOSCI PROGRAMU Z MIKROKONTROLERA DO PLIKU


/usr/bin/avrdude -q -u -C /etc/avrdude.conf -p t2313 -P /dev/AVR-Doper-USB-Programmer -c stk500v2 -E noreset,novcc -F -U flash:r:/tmp/123.hex:i
avrdude: WARNING: -E option not supported by this programmer type
avrdude: stk500_2_ReceiveMessage(): timeout

avrdude: AVR device initialized and ready to accept instructions
avrdude: Device signature = 0x1e910a
avrdude: reading flash memory:
avrdude: writing output file "/tmp/123.hex"

avrdude done. Thank you.



SKRYPT KONFUGURACJI FUSEBYTES


http://palmavr.sourceforge.net/cgi-bin/fc.cgi


Dodatkowe informacje n.T. fusebytes i programowania mikrokontrolerów AVR


http://www.tkdami.net/~voytek/programy/programy.html
http://www.elektroda.pl/rtvforum/topic854656.html


Oprogramownie do programowania mikrokontrolerów AVR


http://sourceforge.net/projects/kontrollerlab/

Atmel AVR toolchain

JTAG Tools

JTAG FAQ

AVR® 8-Bit RISC - Datasheets

Projekty elektroniczne open source na Linuxa z wykorzystaniem AVR

8 komentarzy:

Anonimowy pisze...

http://jumptuck.wordpress.com/2008/11/10/programming-avr-on-ubuntu-810-intrepid-ibex/

Anonimowy pisze...

http://www.cadmaniac.org/ - KDE kontrollerlab AVR programming open source studio

Anonimowy pisze...

http://www.ladyada.net/learn/avr/setup-unix.html

Anonimowy pisze...

http://www.attiny.com/speakjet.htm - intersting controlling SpeakJetTM with an AVR microcontroller

Anonimowy pisze...

http://www.ladyada.net/learn/avr/setup-unix.html - jak ustawić środowiskoprogramistyczne dla AVR an Windows Linux/ Ubuntu

Anonimowy pisze...

http://www.ladyada.net/learn/avr/fuses.html - Fuses configuration info

tajwoj pisze...

Adres strony:
http://www.tkdami.net/~voytek/programy/programy.html
jest zmieniony na:
http://www.voytek.evbox.pl/programy/programy.html

Marcin Bielak | bieli pisze...

@tajwoj: dzieki za korektę