Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Verification Error when Flashing Bootloader #3286

Closed
PickleJr opened this issue Jul 2, 2018 · 9 comments
Closed

Verification Error when Flashing Bootloader #3286

PickleJr opened this issue Jul 2, 2018 · 9 comments

Comments

@PickleJr
Copy link
Contributor

PickleJr commented Jul 2, 2018

I'm at a complete loss here on what to do. I've ordered a new flasher in case the issue is with my flasher. But aside from that I'm not sure what my issue could be. The error in question is this:

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, and I'm trying to flash the planck light. 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 a little bit of a noob so 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 bootloader. So I'm not sure if I'm even writing to the bootloader, or if I'm unable to read it.
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 bootloader 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.
Thanks for taking your time at reading this.

@drashna
Copy link
Member

drashna commented Jul 2, 2018

It sounds like the fuses are not set correctly, and that may be causing the mismatch error.

And for the Planck Light, it looks like it should be the AT90USB1286: https://github.com/qmk/qmk_firmware/blob/master/keyboards/planck/light/rules.mk#L5

@drashna drashna closed this as completed Jul 2, 2018
@drashna drashna reopened this Jul 2, 2018
@PickleJr
Copy link
Contributor Author

PickleJr commented Jul 2, 2018

Is my wire connection wrong? Wouldn't avrdude -p usb1286 -c usbtiny throw a fit if the wires were misconfigured? I could try a different set of jumper wires but I doubt that's where the issue lies since I've tried two different sets. Or am I misunderstanding what you mean by the fuses not being set correctly?

@drashna
Copy link
Member

drashna commented Jul 2, 2018

On windows, try using avrdudess. It's a GUI and may be a bit easier to use. Also, try the "detect MCU" option. If that comes back with a good result, then it's wired correctly. (I don't know/remember the commands to test this).

But it looks like you do have the right pins. However, I suspect that you don't have the right fuses set. But playing with those .... is a lot trickier and you could cause serious issues.

@PickleJr
Copy link
Contributor Author

PickleJr commented Jul 2, 2018

Thanks for the tip on avrdudess. It looks like my board is hooked up alright. I found this page when it comes to setting up fuses with avrdudess http://www.engbedded.com/fusecalc and.... you're right. Most of what's on this page is over my head. I'm not sure where to go to from here.

Edit: I'm not sure if this is helpful, but using the debugging command 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

Edit 2: The "programmer operation not supported" line looks suspicious.

@PickleJr
Copy link
Contributor Author

PickleJr commented Jul 2, 2018

Weird, if I flash another boot-loader, like the 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.

@drashna
Copy link
Member

drashna commented Jul 4, 2018

In that case, it sounds like one of the fuses is not properly set.

Unfortunately, the fuses are one of the things that you can cause a lot of issues with. And it's one of the areas that I don't understand very well.

@skullydazed any suggestions?

@PickleJr
Copy link
Contributor Author

Update: Went to microcenter, got myself a teensy, and flashed the bootloader with that. I'm not sure why the sparkfun pocket avi didn't work, but everything is good now. I typed this up on my planck. Thank you so much for taking the time to reply and help though!

@drashna
Copy link
Member

drashna commented Jul 20, 2018

Awesome, glad to hear it!

@drashna drashna closed this as completed Jul 20, 2018
@sigprof
Copy link
Contributor

sigprof commented Jan 16, 2022

USBtinyISP and any other ISP flashers using the same usbtiny protocol and firmware (e.g., SparkFun Pocket AVR Programmer) DO NOT support AVR chips with more than 64 KiB of flash, therefore they cannot be used to flash the AT90USB1286/7 chips.

At the moment the shop page for SparkFun Pocket AVR Programmer mentions this in the description:

The microcontroller-to-be-programmed can be any AVR with 64K or less of flash.

Adafruit has the same information in the FAQ for USBtinyISP:

Any AVR that uses the ISP interface for programming and has 64K or less of flash can be programmed.

Chips such as the Atmega1280/1281 and Atmega2560/2561 have more than 64K and cannot be programmed.

The limitation is due to the usage of 16-bit addresses in the usbtiny protocol, therefore it cannot be fixed without updating not just the firmware in the flasher (for which you would need to have a second ISP flasher anyway), but also the protocol implementation in avrdude (or completely rewriting the firmware to use a different communication protocol with support for more address bits).

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

3 participants