Pages: [1] 2   Go Down
Author Topic: Avrdude Verify errors with 18k sketch  (Read 1073 times)
0 Members and 1 Guest are viewing this topic.
Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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

* OLED.zip (16.58 KB - downloaded 2 times.)
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
upload.using=bootloader

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

Code:
upload.using=avrispmkii

(or similar) should do it. Save your changes and re-open the Arduino IDE.
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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


Seattle, WA USA
Online Online
Brattain Member
*****
Karma: 601
Posts: 48543
Seattle, WA USA
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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

* preferences.txt (2.95 KB - downloaded 7 times.)
« Last Edit: October 30, 2011, 07:12:49 pm by Shields_Arduino » Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you restart the IDE after changing the file?
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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!
Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Well can you upload the .hex file through AVR Studio?
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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:
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

« Last Edit: October 30, 2011, 11:37:08 pm by Shields_Arduino » Logged


Global Moderator
Offline Offline
Brattain Member
*****
Karma: 474
Posts: 18696
Lua rocks!
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged

Australia
Offline Offline
Jr. Member
**
Karma: 0
Posts: 66
Power up to your potential
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

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.
Logged


Pages: [1] 2   Go Up
Jump to: