Go Down

Topic: Avrdude Verify errors with 18k sketch (Read 1 time) previous topic - next topic

Virtronics

We are trying to test an OLED display, and are trying to display a few large pictures. The attached sketch has  a 128 pixel wide by 115 pixel high picture which is stored in a .h file in a 2 dimensional array. The sketch compiles fine but gives errors when downloading. Have tried this on an Arduino Uno and Freetronics Eleven board using 1.0 RC2 of the IDE.

Code: [Select]
const unsigned char arduinox[115][128] = { //

We have turned off the virus scanner. David Mellis says the code downloads fine for him. Let me know if anyone else can download this sketch without any problems. Thanks.

Error message on Uno
Binary sketch size: 18384 bytes (of a 32256 byte maximum)
avrdude: verification error, first mismatch at byte 0x1680
        0xff != 0x92
avrdude: verification error; content mismatch

Error message on Freetronics Eleven
Binary sketch size: 18384 bytes (of a 32256 byte maximum)
avrdude: verification error, first mismatch at byte 0x1680
        0xff != 0xb1
avrdude: verification error; content mismatch
www.virtronics.com.au

Nick Gammon

There was a post about this recently. It appears that if a sketch (hex) file contains a page of 0xFF then the boot loader doesn't bother sending it, on the assumption that 0xFF is the default value of that page after program memory is cleared. However the boot loader doesn't clear program memory.

It may work for some people (eg. David Mellis) if their Uno happens to have 0xFF anyway in that place - which might be the case for a new Uno, or one that hasn't had large sketches uploaded to it.

I'm not sure of the workaround, but perhaps using ISP programming rather than the boot loader would help.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Nick Gammon

Another approach would be to rework how you store images. Instead of the binary data, you could run-length encode it (eg. 254 lots of 0xFF) which would save space, and make sure that you don't have lots of 0xFF in the .hex file.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

OK, thanks for the reply. 0xff here translates to the colour white is very common in pictures. We have a simple program which converts bitmaps to an array so the picture can be loaded and displayed on the screen.

Could you advise how to load a sketch via the AVR ISP. I use the AVR ISP MkII all the time, just not sure where the sketch hex code ends up or where to find it. Thanks.
www.virtronics.com.au

Nick Gammon

You should be able to do it inside the IDE. Locate your preferences.txt file (see the Preferences menu item to locate it).

Close the IDE.

Edit the preferences.txt file and look for the line:

Code: [Select]
upload.using=bootloader

Change that as appropriate. Not sure about your ISP, but something like:

Code: [Select]
upload.using=avrispmkii

(or similar) should do it. Save your changes and re-open the Arduino IDE.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

Thanks. I also found that with RC2 (not sure about previous versions) there is a Upload with programmer option. Will try this out.
www.virtronics.com.au

PaulS

115 * 128 bytes is more SRAM that any Arduino has.

Nick Gammon

Read up on program memory. You can have larger blocks of data in that, and then you need to write a custom function to copy that to the OLED without putting it all into RAM first. This also lets you work around the problem of the 0xFF issue, because you can compact the image.

http://www.arduino.cc/en/Reference/PROGMEM
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

#8
Oct 31, 2011, 01:10 am Last Edit: Oct 31, 2011, 01:12 am by Shields_Arduino Reason: 1
OK, I have tried using Upload with Programmer and under Tools|Programmer, the AVRISP mkII is selected. Here is the error message:

Binary sketch size: 7504 bytes (of a 32256 byte maximum)
avrdude: usbdev_open(): did not find any USB device "usb"

Note, I tested the AVRISP MkII from AVR Studio and it recognises the signature from the Mega328.

I changed the preferences.txt file line to upload.using=avrispmkii
but it appears the bootloader is still being used. The AVRISP mkII led always stays green while I would expect it to change to orange.

Attached is the preferences.txt file
www.virtronics.com.au

Nick Gammon

Did you restart the IDE after changing the file?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

Yes. I just tried this again on 1.0 RC2 and on 1.0 RC1 and 0022 and the same error appears for all IDEs. I am using AVR Studio v4.18 build 716.


Here is AVR Studio's log for reading the signature
Quote

Setting mode and device parameters.. OK!
Entering programming mode.. OK!
Reading signature from device .. 0x1E, 0x95, 0x0F .. OK!
Leaving programming mode.. OK!
www.virtronics.com.au

Nick Gammon

Well can you upload the .hex file through AVR Studio?
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

#12
Oct 31, 2011, 05:31 am Last Edit: Oct 31, 2011, 05:37 am by Shields_Arduino Reason: 1
No, I can't find the hex file. I found this link http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287332515 but holding the shift key down activates the Upload with programmer action now. Any ideas on how to find the hex file? There is no verbose word or setting in the preferences.txt file of 1.0 RC2.

Also, I noticed that if there is a .pde file in the same directory as the .ino file, the compiler tries to compile them both, and gives the errors below.

Code: [Select]

In file included from OLED.cpp:529:
/font8.h:3: error: redefinition of 'const unsigned char font [][7]'
/font8.h:3: error: 'const unsigned char font [98][7]' previously defined here
In file included from OLED.cpp:530:
bitmaps.h:2: error: redefinition of 'const unsigned char usb_logo [14][10]'
bitmaps.h:2: error: 'const unsigned char usb_logo [14][10]' previously defined here
bitmaps.h:21: error: redefinition of 'const unsigned char laser_label [52][128]'
bitmaps.h:21: error: 'const unsigned char laser_label [52][128]' previously defined here
In file included from OLED.cpp:532:
arduino1.h:2: error: redefinition of 'const unsigned char arduino1 [57][60]'
arduino1.h:2: error: 'const unsigned char arduino1 [57][60]' previously defined here
OLED:504: error: redefinition of 'const int EPin'
OLED:13: error: 'const int EPin' previously defined here
OLED:505: error: redefinition of 'const int RwPin'
OLED:14: error: 'const int RwPin' previously defined here
OLED:506: error: redefinition of 'const int DCPin'
OLED:15: error: 'const int DCPin' previously defined here
OLED:507: error: redefinition of 'const int CsPin'
OLED:16: error: 'const int CsPin' previously defined here
OLED:508: error: redefinition of 'const int Enable12VPin'
OLED:17: error: 'const int Enable12VPin' previously defined here
OLED:509: error: redefinition of 'const int OLEDRstPin'
OLED:18: error: 'const int OLEDRstPin' previously defined here
OLED:511: error: redefinition of 'const int switch1'
OLED:20: error: 'const int switch1' previously defined here
OLED:512: error: redefinition of 'const int switch2'
OLED:21: error: 'const int switch2' previously defined here
OLED:513: error: redefinition of 'const int switch3'
OLED:22: error: 'const int switch3' previously defined here
OLED:514: error: redefinition of 'const int switch4'
OLED:23: error: 'const int switch4' previously defined here
OLED:516: error: redefinition of 'int bgrnd_color'
OLED:25: error: 'int bgrnd_color' previously defined here
OLED:517: error: redefinition of 'int display'
OLED:26: error: 'int display' previously defined here
OLED:518: error: redefinition of 'int font_color'
OLED:27: error: 'int font_color' previously defined here
OLED:520: error: redefinition of 'char* s_disp []'
OLED:29: error: 'char* s_disp [5]' previously defined here
OLED.cpp: In function 'void setup()':
OLED:523: error: redefinition of 'void setup()'
OLED:32: error: 'void setup()' previously defined here
OLED.cpp: In function 'void loop()':
OLED:540: error: redefinition of 'void loop()'
OLED:49: error: 'void loop()' previously defined here
OLED.cpp: In function 'void command(int)':
OLED:574: error: redefinition of 'void command(int)'
OLED:83: error: 'void command(int)' previously defined here
OLED.cpp: In function 'void data(int)':
OLED:594: error: redefinition of 'void data(int)'
OLED:103: error: 'void data(int)' previously defined here
OLED.cpp: In function 'void init_colorlcd(int)':
OLED:613: error: redefinition of 'void init_colorlcd(int)'
OLED:122: error: 'void init_colorlcd(int)' previously defined here
OLED.cpp: In function 'void gotoxy(int, int)':
OLED:701: error: redefinition of 'void gotoxy(int, int)'
OLED:210: error: 'void gotoxy(int, int)' previously defined here
OLED.cpp: In function 'void set_screen(int)':
OLED:724: error: redefinition of 'void set_screen(int)'
OLED:233: error: 'void set_screen(int)' previously defined here
OLED.cpp: In function 'void clear_screen()':
OLED:754: error: redefinition of 'void clear_screen()'
OLED:263: error: 'void clear_screen()' previously defined here
OLED.cpp: At global scope:
OLED:759: error: redefinition of 'const int amask [16]'
OLED:268: error: 'const int amask [16]' previously defined here
OLED:760: error: redefinition of 'const byte mask [6]'
OLED:269: error: 'const byte mask [6]' previously defined here
OLED.cpp: In function 'void xyputs(unsigned char, unsigned char, int, int, char*)':
OLED:762: error: redefinition of 'void xyputs(unsigned char, unsigned char, int, int, char*)'
OLED:271: error: 'void xyputs(unsigned char, unsigned char, int, int, char*)' previously defined here
OLED.cpp: In function 'void puts8(int, int, char*)':
OLED:833: error: redefinition of 'void puts8(int, int, char*)'
OLED:342: error: 'void puts8(int, int, char*)' previously defined here
OLED.cpp: In function 'void draw_line(unsigned char, unsigned char, unsigned char, unsigned char, int)':
OLED:839: error: redefinition of 'void draw_line(unsigned char, unsigned char, unsigned char, unsigned char, int)'
OLED:348: error: 'void draw_line(unsigned char, unsigned char, unsigned char, unsigned char, int)' previously defined here
OLED.cpp: In function 'void draw_rectangle(unsigned char, unsigned char, unsigned char, unsigned char, int, int)':
OLED:861: error: redefinition of 'void draw_rectangle(unsigned char, unsigned char, unsigned char, unsigned char, int, int)'
OLED:370: error: 'void draw_rectangle(unsigned char, unsigned char, unsigned char, unsigned char, int, int)' previously defined here
OLED.cpp: In function 'void draw_circle(unsigned char, unsigned char, unsigned char, int, int)':
OLED:883: error: redefinition of 'void draw_circle(unsigned char, unsigned char, unsigned char, int, int)'
OLED:392: error: 'void draw_circle(unsigned char, unsigned char, unsigned char, int, int)' previously defined here
OLED.cpp: In function 'void enable_fill(unsigned char)':
OLED:902: error: redefinition of 'void enable_fill(unsigned char)'
OLED:411: error: 'void enable_fill(unsigned char)' previously defined here
OLED.cpp: In function 'void do_picture(int, int, int, int, const unsigned char*)':
OLED:941: error: redefinition of 'void do_picture(int, int, int, int, const unsigned char*)'
OLED:450: error: 'void do_picture(int, int, int, int, const unsigned char*)' previously defined here

www.virtronics.com.au

Nick Gammon


No, I can't find the hex file. I found this link http://www.arduino.cc/cgi-bin/yabb2/YaBB.pl?num=1287332515 but holding the shift key down activates the Upload with programmer action now. Any ideas on how to find the hex file? There is no verbose word or setting in the preferences.txt file of 1.0 RC2.


Hmmm - version 1.0 is hardly progress is it? My old sketches don't compile, and I can't get the verbose output. What other improvements are there?

Who knows? Maybe go back to version 0022.
Please post technical questions on the forum, not by personal message. Thanks!

More info:
http://www.gammon.com.au/electronics

Virtronics

Thanks for all the help Nick. I might wait for RC3, not having much luck here. I tried using PROGMEM to access flash memory but it all looks too hard. Having the const using RAM doesn't seem to make much sense. The Avrdude compressing of 256 consecutive 0xFFs is also very problematic and putting this into our code would be very difficult.
www.virtronics.com.au

Go Up