Pages: [1]   Go Down
Author Topic: Arduino UNO: out of sync: expect=0x14, resp=0x64  (Read 582 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Full Member
***
Karma: 1
Posts: 117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems this is a growing problem lately.

I have an idea that this is possibly due to sketch size.  When I load smaller sketches, and comment out several lines from my sketch, the program will successfully upload.  The magic size seems to be about 28,636 bytes, give or take a few.  28,710 bytes is slightly too big.  Unfortunately, this means I need to omit about 5 lines of code, lines which are necessary.  I've trimmed and streamlined everywhere possible at this point, including the complete removal of one of my sensors.

The IDE states we have a 32,356 byte maximum for our sketches, but obviously some of this is eaten by the 2,048 bytes of bootloader data.  IMO, that should be reflected in the maximum allowed sketch size.  The IDE should report 30,308 bytes maximum, although that's still obviously not true - I seem to be losing around 4k.

So, I'm left with either redesigning my project to utilize an Arduino MEGA (which will screw with my shield pinouts and physical construction), use a second Arduino UNO to govern my sensors (which will raise costs and power consumption), or write a program which will parse the raw data on my workstation (which will waste time and cost money).

It seems like 32k is a lot of space to write a program to utilize the Arduino to its fullest.  It isn't.  I realize this isn't the fault of the Arduino makers and rather a drawback of the ATMEGA328P chip itself, but it still kinda sucks.

EDIT:  I should clarify that I have replicated this problem on twelve Arduino UNO boards, both R2 and R3 using both Arduino 1.0 and 1.0.1.
« Last Edit: June 28, 2012, 07:13:10 pm by Verdris » Logged

Canada
Offline Offline
Full Member
***
Karma: 0
Posts: 246
Code Monkey
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

It seems this is a growing problem lately.

I have an idea that this is possibly due to sketch size.  When I load smaller sketches, and comment out several lines from my sketch, the program will successfully upload.  The magic size seems to be about 28,636 bytes, give or take a few.  28,710 bytes is slightly too big.  Unfortunately, this means I need to omit about 5 lines of code, lines which are necessary.  I've trimmed and streamlined everywhere possible at this point, including the complete removal of one of my sensors.

The IDE states we have a 32,356 byte maximum for our sketches, but obviously some of this is eaten by the 2,048 bytes of bootloader data.  IMO, that should be reflected in the maximum allowed sketch size.  The IDE should report 30,308 bytes maximum, although that's still obviously not true - I seem to be losing around 4k.

So, I'm left with either redesigning my project to utilize an Arduino MEGA (which will screw with my shield pinouts and physical construction), use a second Arduino UNO to govern my sensors (which will raise costs and power consumption), or write a program which will parse the raw data on my workstation (which will waste time and cost money).

It seems like 32k is a lot of space to write a program to utilize the Arduino to its fullest.  It isn't.  I realize this isn't the fault of the Arduino makers and rather a drawback of the ATMEGA328P chip itself, but it still kinda sucks.

EDIT:  I should clarify that I have replicated this problem on twelve Arduino UNO boards, both R2 and R3 using both Arduino 1.0 and 1.0.1.

If you need all that last bit of space, get an ISP and remove the bootloader.

Remember that RAM is organized in words, and EEPROM is organized in pages. This means that not everything will round to a single byte, and why you seem to be over-allocated.
Logged

I yield() for co-routines.

Offline Offline
Newbie
*
Karma: 0
Posts: 7
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are short just that small amount you could drop the bootloader and use a different burn method (this would require a external programmer, I'd advise a true Atmel AVRISP not a Chinese clone). You could still use Arduino development, you would just burn the temp .hex file Arduino creates.

Also you could re-evaluate the libraries you are using. Possibly remove some portions you don't need. /shrug

Have you tried streamlining your code? You'd be surprised what you can cut down optimizing your code.
Logged

Offline Offline
Full Member
***
Karma: 1
Posts: 117
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

If you are short just that small amount you could drop the bootloader and use a different burn method (this would require a external programmer, I'd advise a true Atmel AVRISP not a Chinese clone). You could still use Arduino development, you would just burn the temp .hex file Arduino creates.

Also you could re-evaluate the libraries you are using. Possibly remove some portions you don't need. /shrug

Have you tried streamlining your code? You'd be surprised what you can cut down optimizing your code.

The libraries I'm using are awfully dense, yes...I'd wager I have about 200 lines of actual code in my main sketch, but I'm using SD, TinyGPS, SoftwareSerial, Wire, and a library of my own design, which is just a convenient way to communicate with various sensors via Wire.

If anything is to be cut down, it will be in one of those libraries, and since I didn't write them, I wouldn't know where to start.
Logged

Pages: [1]   Go Up
Jump to: