Go Down

Topic: Attiny84 icsp programming - [SOLVED] (Read 357 times) previous topic - next topic

CWashburn

Aug 11, 2017, 09:33 pm Last Edit: Aug 13, 2017, 12:20 am by CWashburn
I've been trying to program an Attiny84 on a custom board that I designed via an USBasp programmer, but I keep getting a "verification error" from avrdude. It sounds like this is a pretty common problem, but I haven't found any clues as to what actions I should take next.

Below is the complete log, and just by looking at it, it's obvious the attiny84 is communicating (at least to some degree), so I highly doubt it's a hardware problem. However, since the attiny84 is powered from an Li-ion and the programmer is 5V, I have a voltage translator separating them. It shouldn't make any difference, but just in case. I'm using the attiny core v1.0.2 by David Mellis and Arduino 1.8.2.

Code: [Select]

Sketch uses 702 bytes (8%) of program storage space. Maximum is 8192 bytes.
Global variables use 9 bytes (1%) of dynamic memory, leaving 503 bytes for local variables. Maximum is 512 bytes.
C:\Users\Caleb\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\Caleb\Arduino\hardware\tools\avr/etc/avrdude.conf -v -pattiny84 -cusbasp -Pusb -Uflash:w:C:\Users\Caleb\AppData\Local\Temp\arduino_build_32384/Blink.ino.hex:i

avrdude: Version 6.3, compiled on Jan 17 2017 at 12:00:53
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
         Copyright (c) 2007-2014 Joerg Wunsch

         System wide configuration file is "C:\Users\Caleb\Arduino\hardware\tools\avr/etc/avrdude.conf"

         Using Port                    : usb
         Using Programmer              : usbasp
avrdude: Warning: cannot open USB device: Function not implemented
         AVR Part                      : ATtiny84
         Chip Erase delay              : 4500 us
         PAGEL                         : P00
         BS2                           : P00
         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        512    4      0  4000  4500 0xff 0xff
           flash         65     6    32    0 yes      8192   64    128  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          1    0      0     0     0 0x00 0x00

         Programmer Type : usbasp
         Description     : USBasp, http://www.fischl.de/usbasp/

avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.00s

avrdude: Device signature = 0x1e930c (probably t84)
avrdude: NOTE: "flash" memory has been specified, an erase cycle will be performed
         To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: reading input file "C:\Users\Caleb\AppData\Local\Temp\arduino_build_32384/Blink.ino.hex"
avrdude: writing flash (702 bytes):

Writing | ################################################## | 100% 0.37s

avrdude: 702 bytes of flash written
avrdude: verifying flash memory against C:\Users\Caleb\AppData\Local\Temp\arduino_build_32384/Blink.ino.hex:
avrdude: load data flash data from input file C:\Users\Caleb\AppData\Local\Temp\arduino_build_32384/Blink.ino.hex:
avrdude: input file C:\Users\Caleb\AppData\Local\Temp\arduino_build_32384/Blink.ino.hex contains 702 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 0.23s

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x27
avrdude: verification error; content mismatch

avrdude done.  Thank you.

the selected serial port
 does not exist or your board is not connected




DrAzzy

#1
Aug 11, 2017, 10:52 pm Last Edit: Aug 11, 2017, 10:59 pm by DrAzzy
I don't know how to deal with "verification error" either! (except ofc when it's a fusebit, which generally indicates an issue with the board def and/or avrdude config)

Very interested in ways to deal with this.

Is your chip wired correctly? Is the 0.1uf ceramic decoupling capacitor in place? (if it's not, problems programming are expected. It must be ceramic (or tant), and it must be located close to the chip - in a breadboard for an '84, I'd put it over the top of the chip to be on the safe side)
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

CWashburn

I'm using the QFN version of the '84, and I have a 0402 0.1uF cap less than 2mm away.

CWashburn

I guess I have a DIP attiny84, I'll try it with that one.

DrAzzy

I'm using the QFN version of the '84, and I have a 0402 0.1uF cap less than 2mm away.
Excellent. Sounds like you're good on that front.
ATtiny core for 841+1634+828 and x313/x4/x5/x61/x7/x8 series Board Manager:
http://drazzy.com/package_drazzy.com_index.json
ATtiny breakouts (some assembled), mosfets and awesome prototyping board in my store http://tindie.com/stores/DrAzzy

kprims

@CWashburn
 

Dump this in a Command Prompt to see your fuses.

Code: [Select]
C:\Users\Caleb\Arduino\hardware\tools\avr/bin/avrdude -CC:\Users\Caleb\Arduino\hardware\tools\avr/etc/avrdude.conf -v -pattiny84 -cusbasp -Pusb

Mine look like this for 8MHz internal.

$ /home/kprims/ken/Downloads/arduino-1.8.3/hardware/tools/avr/bin/avrdude -C/home/kprims/.arduino15/packages/ATTinyCore/hardware/avr/1.1.4/avrdude.conf  -pattiny84 -cusbasp

avrdude: set SCK frequency to 187500 Hz
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930c (probably t84)

avrdude: safemode: Fuses OK (E:FF, H:D7, L:E2)

avrdude done.  Thank you.

CWashburn

Wow, that was easy :D

Here's what I got:

Code: [Select]


avrdude: auto set sck period (because given equals null)
avrdude: warning: cannot set sck period. please check for usbasp firmware update.
avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e930c (probably t84)
avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF

avrdude: safemode: hfuse reads as DF
avrdude: safemode: efuse reads as FF
avrdude: safemode: Fuses OK (E:FF, H:DF, L:62)

avrdude done.  Thank you.



CWashburn

Looks like those are the default fuse settings.

kprims

I agree, you haven't set the fuses yet.

 If you want to do this the easy way, I recommend using DrAzzy's ATTinyCore.

After installation, just select your chip and clock speed and flash bootloader which will set your fuses correctly, but will not really put on a bootloader.

Then you can upload your blink sketch or whatever.

https://github.com/SpenceKonde/ATTinyCore

CWashburn

Ok, I'm able to upload blink with DrAzzy's core with the clock set to 8MHz, but the blink is 8x slower than it should be. Also, if I change the delay to 100mS, it won't work and says

Code: [Select]

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x0000
         0x00 != 0x28
avrdude: verification error; content mismatch

kprims

"Ok, I'm able to upload blink with DrAzzy's core with the clock set to 8MHz, but the blink is 8x slower than it should be"


Did you select "Tools/ Burn Bootloader" first to set the fuses for 8MHz operation?
                      "Tools/Programmer:  "USBasp (ATTinyCore)""

After that you should be able to load the Blink sketch and it should run at the right speed.

CWashburn

Duh! :)

It works now!

Thanks guys, +1 to both of you.

Go Up