Verification Error when Flashing Bootloader

Go To Last Post
13 posts / 0 new
Author
Message
#1
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Hey guys! I'm new here and pretty much a noob, sorry If I'm posting in the wrong place...

 

I'm trying to flash a boot-loader on a Planck Light keyboard, it shipped without a boot-loader. I get a verification error when I try to flash it.

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000 0xff != 0x0c
avrdude: verification error; content mismatch
avrdude: safemode: Fuses OK (E:F3, H:99, L:5E)

I'm using a Sparkfun Pocket AVI. I know I'm able to connect to the board. Running

avrdude -p usb1287 -c usbtiny

confirms I have good contact with the board. The commands I have ran are these:

sudo avrdude -p usb1286 -c usbtiny -U flash:w:bootloader_at90usb128x_1_0_1.hex:i

and

sudo avrdude -p usb1287 -c usbtiny -U flash:w:bootloader_at90usb128x_1_0_1.hex:i

(the one difference is the usb1287 and usb1286. I'm not sure if there's much difference in the commands?)

 

I have tried running this: sudo avrdude -p usb1286 -c usbtiny -U flash:r:mystery.hex:r to see if the bootloader is getting flashed at all. When I run this command the file that gets returned is blank. There's nothing in it. No boot-loader. So I'm not sure if I'm even writing to the bootloader, or if I'm unable to read it. However,  If I flash another boot-loader, one called  bootloader_atmega16u4_1_0_1.hex, the bootloader flashes fine. I'm able to confirm that it writes by calling the read command again. It just has a verification error on at90usb128x for some reason.

On my pocket avr, the connections I have set up are:

RST <-> RST
GND <-> GND
B1  <-> SCK
B2  <-> MIS1
B3  <-> MIS0
VCC <-> VCC

I have tried on both a Windows and a Linux laptop. So I don't think the issue is my laptop setup. My Linux computer is being a little weird I think? When I run the flash command it "writes" and "reads" kind of fast before it verifies (progress bars jump to 100%.) whereas my windows laptop seems to go at a slower speed (I can see the progress bar creep up to 100%).
The Planck did come in working order. It lit up, buttons worked, and everything. After the first flash to install the correct boot-loader however, it never woke up. I understand it's expected the lights wont work, but the computer wont even read keystrokes. I'm hoping it's not actually fried somehow. I do think there's life however. When I plug it in windows makes a "device connected" sound. I just can't do anything with it.
I know the issue isn't with the USB cable connecting the laptop to the programmer either. I've tried multiple cables.

 

Here's what I get when I run verbose:

avrdude -c usbtiny -p usb1286 -P usb -v -v -v -v -n -U flash:w:"C:\Users\Taylor\Development\qmk_firmware\util\bootloader_at90usb128x_1_0_1.hex":a
avrdude.exe: AVR device initialized and ready to accept instructions

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

avrdude.exe: Device signature = 0x1e9782
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: conflicting -e and -n options specified, NOT erasing chip
avrdude.exe: reading input file "C:\Users\Taylor\Development\qmk_firmware\util\bootloader_at90usb12
AVRDUDE killed
8x_1_0_1.hex"
avrdude.exe: input file C:\Users\Taylor\Development\qmk_firmware\util\bootloader_at90usb128x_1_0_1.hex auto detected as Intel Hex
avrdude.exe: writing flash (131072 bytes):
~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ ~ 

avrdude.exe: Version 6.1, compiled on Mar 13 2014 at 00:09:49
             Copyright (c) 2000-2005 Brian Dean, http://www.bdmicro.com/
             Copyright (c) 2007-2014 Joerg Wunsch

             System wide configuration file is "C:\Program Files (x86)\AVRDUDESS\avrdude.conf"

             Using Port                    : usb
             Using Programmer              : usbtiny
avrdude.exe: usbdev_open(): Found USBtinyISP, bus:device: bus-0:\\.\libusb0-0001--0x1781-0x0c9f
             AVR Part                      : AT90USB1286
             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  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               eeprom        65    10     8    0 no       4096    8      0  9000  9000 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               flash         65     6   256    0 yes    131072  256    512  4500  4500 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               hfuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               efuse          0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               lock           0     0     0    0 no          1    0      0  9000  9000 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               calibration    0     0     0    0 no          1    0      0     0     0 0x00 0x00
                                      Block Poll               Page                       Polled
               Memory Type Mode Delay Size  Indx Paged  Size   Size #Pages MinW  MaxW   ReadBack
               ----------- ---- ----- ----- ---- ------ ------ ---- ------ ----- ----- ---------
               signature      0     0     0    0 no          3    0      0     0     0 0x00 0x00

             Programmer Type : USBtiny
             Description     : USBtiny simple USB programmer, http://www.ladyada.net/make/usbtinyisp/
avrdude.exe: programmer operation not supported

avrdude.exe: Using SCK period of 10 usec
CMD: [ac 53 00 00] [00 ac 53 00]
avrdude.exe: AVR device initialized and ready to accept instructions

Reading | CMD: [30 00 00 00] [00 30 00 1e]
CMD: [30 00 01 00] [00 30 00 97]
################CMD: [30 00 02 00] [00 30 00 82]
################################## | 100% -0.00s

avrdude.exe: Device signature = 0x1e9782
avrdude.exe: NOTE: "flash" memory has been specified, an erase cycle will be performed
             To disable this feature, specify the -D option.
avrdude.exe: conflicting -e and -n options specified, NOT erasing chip

Even if you don't reply, thank you for taking your time reading this.

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Check the memory lock bits.

See "30.1 Program and data memory lock bits" in the datasheet.

 

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:

Check the memory lock bits.

See "30.1 Program and data memory lock bits" in the datasheet.

 

 

 

I'm sorry but like I said I'm a noob. Where's the datasheet?

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

What version of avrdude? I seem to remember there were problems in the past with writing beyond 64K which affected "large" devices that had bootloaders at a high address.

 

Might be worth pulling the latest source tree for avrdude and building an up to date one if the repo version for your Linux is quite old (certainly if it is a 5.x rather than a 6.x version).

 

EDIT: I should learn to read - I see "6.1" in the output above. I think that is recent enough but I would check the release notes to see if you can spot when the 64K was fixed.

 

EDI2: ah I think the thing I am thinking of was line 331 in this:

 

http://svn.savannah.gnu.org/view...

 

If so then that was fixed at 6.0 in fact.

Last Edited: Wed. Jul 4, 2018 - 08:54 AM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

clawson wrote:

What version of avrdude? I seem to remember there were problems in the past with writing beyond 64K which affected "large" devices that had bootloaders at a high address.

 

Might be worth pulling the latest source tree for avrdude and building an up to date one if the repo version for your Linux is quite old (certainly if it is a 5.x rather than a 6.x version).

 

EDIT: I should learn to read - I see "6.1" in the output above. I think that is recent enough but I would check the release notes to see if you can spot when the 64K was fixed.

 

EDI2: ah I think the thing I am thinking of was line 331 in this:

 

http://svn.savannah.gnu.org/view...

 

If so then that was fixed at 6.0 in fact.

 

Ah dang. That would've been nice if that was the solution. Thanks for the reply though!

I submitted an issue on github and it looks like somebody else said this might be a fuse issue. If that's the case, then afaik thats in the same ballpark as the lock bits. So I suppose I'll keep trying to understand that.

Last Edited: Wed. Jul 4, 2018 - 02:32 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

From Post#1

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000 0xff != 0x0c
avrdude: verification error; content mismatch
avrdude: safemode: Fuses OK (E:F3, H:99, L:5E) 

 

From Engbedded Atmel AVR Fuse Calculator (LINK), those fuse values show for the AT90USB1286:

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Chuck99 wrote:

From Post#1

avrdude: verifying ...
avrdude: verification error, first mismatch at byte 0x1e000 0xff != 0x0c
avrdude: verification error; content mismatch
avrdude: safemode: Fuses OK (E:F3, H:99, L:5E) 

 

From Engbedded Atmel AVR Fuse Calculator (LINK), those fuse values show for the AT90USB1286:

 

Thanks for the link! Yeah I found that earlier and checked it out but I unfortunately had no idea what I was looking at. It looked like that those are the correct settings when looking at other Planck Light users trying to flash their bootloader however. 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Why don't you use avrdude to read the lock byte?

 

From avrdude user manual (LINK).

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

You know... I looked at this page a thousand times and never noticed the lock option...

 

avrdude: AVR device initialized and ready to accept instructions

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

avrdude: Device signature = 0x1e9782 (probably usb1287)
avrdude: reading lock memory:

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

avrdude: writing output file "lock.h"

avrdude: safemode: Fuses OK (E:F3, H:99, L:5E)

avrdude done.  Thank you.

:01000000FF00
:00000001FF

 

Edit 1: Formatting

Edit 2: So If I'm understanding this correctly, the bits are all set to 1 which means they're programmed?

Edit 3: Just exported it to binary instead of hex because of obvious reasons... Yes the lock byte is set to 0b111111.

Last Edited: Wed. Jul 4, 2018 - 07:51 PM
  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Edit 2: So If I'm understanding this correctly, the bits are all set to 1 which means they're programmed?

No, it means that they're NOT programed.

So it appears that the memory being locked is not the problem.

 

 

From the datasheet (link in post#4)

 

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

Update!: After going to microcenter and getting myself a teeny, and programming the teeny so act as an ISP programmer, I was able to flash the bootloader. I'm not sure what entirely was wrong with the sparkfun avi, but that seemed to be the cause of my problems. Thank you so much for taking the time to reply to me though!!

  • 1
  • 2
  • 3
  • 4
  • 5
Total votes: 0

I'm glad you got it working.  Thanks for the update.