1 (edited by tealvince 2014-03-22 17:49:18)

Topic: Can't upload firmware with USBasp (solved)

Help!  I've spent the last couple of hours banging my head against the wall.  I was trying to update my firmware with my new usbasp programmer, and have only managed to erase my chip.

I bought the programmer off ebay (it says USBASP V2.0 - LC Technology), and wired an adapter cable with the following mappings (from Sanguino to programmer):

1 - 9 (MISO)
2 - 2  (VCC)
3 - 7 (SCK)
4 - 1 (MOSI)
5 - 5 (CS)
6 - 10 (GND)

When using, it, the 1284p is detected and has the correct signature, and I can successfully read and change the fuses, so the connection seems okay.  However, when trying to upload a bootloader or marlin build, it always fails to verify as follows.  Any ideas?  The programmer itself only has a jumper for 3.3/5V (currently set to 5V).

>avrdude -C ..\etc\avrdude.conf -c usbasp -p m1284p -U flash:w:SolidoodleMarlin.cpp.hex -v -D

avrdude: Version 5.4-arduino, compiled on Oct 11 2007 at 19:12:32
         Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/

         System wide configuration file is "..\etc\avrdude.conf"

         Using Port            : lpt1
         Using Programmer      : usbasp
         AVR Part              : ATMEGA1284P
         Chip Erase delay      : 9000 us
         PAGEL                 : PD7
         BS2                   : PA0
         RESET disposition     : dedicated
         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  Max
W   ReadBack
           ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ---
-- ---------
           eeprom        65    10   128    0 no       4096    8      0  9000  90
00 0xff 0xff
           flash         65    10   256    0 yes    131072  256    512  4500  45
00 0xff 0xff
           lock           0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
           lfuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
           hfuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
           efuse          0     0     0    0 no          1    0      0  9000  90
00 0x00 0x00
           signature      0     0     0    0 no          3    0      0     0
0 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: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9705
avrdude: safemode: lfuse reads as DE
avrdude: safemode: hfuse reads as DB
avrdude: safemode: efuse reads as F8
avrdude: reading input file "SolidoodleMarlin.cpp.hex"
avrdude: input file SolidoodleMarlin.cpp.hex auto detected as Intel Hex
avrdude: writing flash (110734 bytes):

Writing | ################################################## | 100% 59.31s



avrdude: 110734 bytes of flash written
avrdude: verifying flash memory against SolidoodleMarlin.cpp.hex:
avrdude: load data flash data from input file SolidoodleMarlin.cpp.hex:
avrdude: input file SolidoodleMarlin.cpp.hex auto detected as Intel Hex
avrdude: input file SolidoodleMarlin.cpp.hex contains 110734 bytes
avrdude: reading on-chip flash data:

Reading | ################################################## | 100% 57.39s



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

avrdude: safemode: lfuse reads as DE
avrdude: safemode: hfuse reads as DB
avrdude: safemode: efuse reads as F8
avrdude: safemode: Fuses OK

avrdude done.  Thank you.

2

Re: Can't upload firmware with USBasp (solved)

Make sure you test the actual voltage out of the usbasp module.... there are some imports that give 3.3 when set to 5 and 5volts when set to 3.3 smile

3

Re: Can't upload firmware with USBasp (solved)

ronsii wrote:

Make sure you test the actual voltage out of the usbasp module.... there are some imports that give 3.3 when set to 5 and 5volts when set to 3.3 smile

Thanks!  Unfortunately same results with the jumper in the other position.

4

Re: Can't upload firmware with USBasp (solved)

I finally solved the problem early this morning, or at least found a workaround.  I had two 1284p chips.  One would give this error on both computers I tried it on (one an old PC and one a newer mac), but the other would work correctly on the mac only.  I'm guessing there is some sort of timing-specific sensitivity involved here, but I've managed to reflash the bootloader and firmware onto the second chip so I'm back in business. 

One thing I learned in searching is that the -t (interactive) option in avrdude is very useful in that you can use it to dump out the contents of flash memory to see what (if anything) is getting written to the chip.  The second thing I learned is that the "lock" bits are really "unlock" bits, and if you set them to all you zero you will brick your chip, which I eventually did with the first chip that I couldn't reflash with either computer anyway.