Pages: [1]   Go Down
Author Topic: Can't upload sketches that are greater than 28674 bytes on my Uno  (Read 1595 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey folks.

I think i may have a bad chip or something, but i can't seem to upload my sketch when it grows to greater than 28674 bytes.  I'm using Arduino 022 on MacOS. 

If the sketch is 28674 or fewer bytes, i see the normal upload message:

Code:
Binary sketch size: 28674 bytes (of a 32256 byte maximum)

and the code seems to work ok. 

If the sketch grows to 28676 bytes, I see this:

Code:
Binary sketch size: 28676 bytes (of a 32256 byte maximum)

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x54
avrdude: failed to write flash memory, rc=-4
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x61

And the arduino doesn't run the code at all.

If the sketch gets much bigger than 28680, i see:

Code:
Binary sketch size: 28700 bytes (of a 32256 byte maximum)
avrdude: stk500_recv(): programmer is not responding

I originally thought it was something in my code, but I can get this problem to occur by changing the length of strings (such as within a "Serial.print()" call).

For example, if i have a sketch that compiles to 28674 bytes (and works ok), changing:

Code:
Serial.print ( "12345" );

to

Code:
Serial.print ( "123456" );

Will cause the sketch size to be 28676 bytes, and the problem will occur.

The error message seems to indicate there's a problem with the Flash space on the chip, but i'm not sure.  Do I have any recourse here (other than to get a new board or chip?)

Thanks!

...tango...
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I have any recourse here (other than to get a new board or chip?)

I suspect a $6 investment in a new 328p chip (with bootloader) is your best bet as I can't think of anything else on the board that could cause the symptom.

Lefty

Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
Do I have any recourse here (other than to get a new board or chip?)

I suspect a $6 investment in a new 328p chip (with bootloader) is your best bet as I can't think of anything else on the board that could cause the symptom.

Lefty

Thanks.  I thought that might be it, but i was hoping there'd be something else i could try. 

OK, off to get a new chip it is.  It seems like this chip will work (http://www.sparkfun.com/products/10524), but i'm still a little fuzzy on the bootload aspect, so i'm not quite sure. 

Thanks again. 

...tango...
Logged

Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17307
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

That's the correct chip/bootloader for a Uno board.

Lefty
Logged

Offline Offline
Edison Member
*
Karma: 3
Posts: 1001
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think i may have a bad chip or something, but i can't seem to upload my sketch when it grows to greater than 28674 bytes.  I'm using Arduino 022 on MacOS. 
Before you throw out the chip, I would check the fuse settings. If fuses are set to reserve a 4k boot section, addresses beyond 28672 (32k less 4k = 28672) would be write protected and so upload would fail.
Logged

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I think i may have a bad chip or something, but i can't seem to upload my sketch when it grows to greater than 28674 bytes.  I'm using Arduino 022 on MacOS. 
Before you throw out the chip, I would check the fuse settings. If fuses are set to reserve a 4k boot section, addresses beyond 28672 (32k less 4k = 28672) would be write protected and so upload would fail.


Thanks. 

One (super newbie) question though...how?

Thanks again.
Logged

Grand Blanc, MI, USA
Offline Offline
Faraday Member
**
Karma: 95
Posts: 4094
CODE is a mass noun and should not be used in the plural or with an indefinite article.
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

I might try this beta bootloader:
http://arduino.cc/forum/index.php/topic,64105.msg466703.html#msg466703

One of the issues it fixes is:
Quote
380 optiboot has problems uploading sketches bigger than about 30 KB
Logged

MCP79411/12 RTC ... "One Million Ohms" ATtiny kit ... available at http://www.tindie.com/stores/JChristensen/

0
Offline Offline
Newbie
*
Karma: 0
Posts: 19
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I might try this beta bootloader:
http://arduino.cc/forum/index.php/topic,64105.msg466703.html#msg466703

One of the issues it fixes is:
Quote
380 optiboot has problems uploading sketches bigger than about 30 KB

AHA!

Thanks for that.  I didn't actually get the beta optiboot running, but i was able to get an older version (yet newer than the default optiboot that comes on the UNO) installed by using optifix (http://www.adafruit.com/forums/viewtopic.php?f=25&t=19260).

This seems to have fixed my issue.

Phew!
Logged

Pages: [1]   Go Up
Jump to: