Standalone Programmer on Arduino UNO?

Post here about your Arduino projects, get help - for Adafruit customers!

Moderators: adafruit_support_bill, adafruit

Standalone Programmer on Arduino UNO?

Postby osbock » Sun Dec 11, 2011 9:15 pm

Has anyone gotten the standalone programmer:
https://github.com/adafruit/Standalone- ... programmer
To download to an UNO? I've tried it on 3 different UNO's and I get:

Arduino 22 and 23
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: failed to write flash memory, rc=-4
avrdude: stk500_disable(): protocol error, expect=0x14, resp=0x51
on Arduino 1.0 the more generic:

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

Works fine on a Duemilanove with a 328.

The other strange thing is that it starts downloading normally, and then both the TX and RX leds light constant (or at least as far as I can tell) together for a few seconds, then nothing for a while and then it gives the error. On the Duemilanove, it flickers back and forth for longer and successfully downloads.

I'm a bit mystified. Thinking it might have something to do with available flash size (which shouldn't be a problem, as the UNO theoretically has more space with it's tiny bootloader.) I tried truncating the images.cpp hex structure, and weird thing was the arduino output hex file (in the temp build directory ) was exactly the same size.

I could just use the Due, but I want to understand and I'm working on adapting the standalone programmer to use an SD card, and I'd want that to work on the UNO.

PS:
I tried to use AVRDude from the command line to do the same thing:
C:\Users\Kevin\Desktop>avrdude -c arduino -P COM18 -p m328p -U flash:w:adaloader
.cpp.hex

avrdude: AVR device initialized and ready to accept instructions

Reading | ################################################## | 100% 0.02s

avrdude: Device signature = 0x1e950f
avrdude: NOTE: FLASH memory has been specified, an erase cycle will be performed

To disable this feature, specify the -D option.
avrdude: erasing chip
avrdude: reading input file "adaloader.cpp.hex"
avrdude: input file adaloader.cpp.hex auto detected as Intel Hex
avrdude: writing flash (30022 bytes):

Writing | ################################################ | 95% 6.57s
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync
Thanks,
Kevin
osbock
 
Posts: 125
Joined: Tue Jan 23, 2007 12:12 pm

Re: Standalone Programmer on Arduino UNO?

Postby jwhance » Mon Dec 12, 2011 9:11 am

You might have a look at this thread:

viewtopic.php?f=25&t=24767

It may be the same or a similar problem.
jwhance
 
Posts: 15
Joined: Sun Dec 11, 2011 7:54 am

Re: Standalone Programmer on Arduino UNO?

Postby osbock » Mon Dec 12, 2011 9:44 am

I'm hot on a lead, and that thread isn't the same problem, though I think I may have found the answer to that one too. I think it's a known optiloader (uno bootloader bug) and when I verify, I'll post here, and to that thread too.
osbock
 
Posts: 125
Joined: Tue Jan 23, 2007 12:12 pm

Re: Standalone Programmer on Arduino UNO?

Postby osbock » Mon Dec 12, 2011 3:52 pm

Ok,
Found this over at Arduino.cc forums: http://arduino.cc/forum/index.php/topic,64105.0.html
There's a beta bootloader that fixes a number of problems, including:
380 optiboot has problems uploading sketches bigger than about 30 KB
368 Optiboot does not support ArduinoasISP programmer

I think that last one may explain why some people have problems with Uno and others do not with ArduinoISP.

Anyway, I programmed the new bootloader, and the adaloader code loads fine. It still doesn't explain the same size hex file when I truncate the image, but that is less important to me now.

I'll post some more in the arduinoISP post : http://forums.adafruit.com/viewtopic.php?f=25&t=24767
osbock
 
Posts: 125
Joined: Tue Jan 23, 2007 12:12 pm

Re: Standalone Programmer on Arduino UNO?

Postby wbp » Mon Mar 19, 2012 10:54 pm

I have a Standalone Programmer with an UNO and it's been working just fine until today. I use it to reprogram the 168 in my Ice Tube clock.

I made a small change to the program running on the UNO (the AVRISP sketch from Github), recompiled it, and reloaded it to the UNO. After that, AVRDude gave errors:

Code: Select all
avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64


I am running Arduino 1.0. After several frustrating attempts to figure out what was wrong, I decided to back up and try reloading with Arduino 22. Bingo! Now it works again.

I'm not sure why it failed with 1.0, but it does. Anyone got any ideas? Hopefully this will help anyone else with the same problem...

William
User avatar
wbp
 
Posts: 149
Joined: Mon Mar 07, 2011 12:18 pm

Re: Standalone Programmer on Arduino UNO?

Postby osbock » Tue Mar 20, 2012 4:03 am

They changed the size of the receive buffers in 1.0. You can fix by editing the core search arduino.cc
osbock
 
Posts: 125
Joined: Tue Jan 23, 2007 12:12 pm

Re: Standalone Programmer on Arduino UNO?

Postby wbp » Tue Mar 20, 2012 5:12 am

Not sure about the receive buffers, I'll take a look at that, but one thing I did find was that there is a change in Serial.print. The Arduino ISP sketch uses Serial.print to send back responses, and this needs to be changed to use Serial.write.
User avatar
wbp
 
Posts: 149
Joined: Mon Mar 07, 2011 12:18 pm

Re: Standalone Programmer on Arduino UNO?

Postby wbp » Tue Mar 20, 2012 7:41 am

Yep, looks like it's receive buffer overflow. Issue 661 covers this:
http://code.google.com/p/arduino/issues/detail?id=661

I wonder if by using SerialEvent it would be possible to get around this.
User avatar
wbp
 
Posts: 149
Joined: Mon Mar 07, 2011 12:18 pm

Re: Standalone Programmer on Arduino UNO?

Postby wbp » Thu Mar 22, 2012 12:05 am

It took me the better part of two days, but I did finally get this working on IDE 1.0. Because the serial receive buffer is now 64 bytes, the data has to be collected pretty quickly to avoid overflowing the buffer even at 19200 bps. The way ArduinoISP was written it just wasn't going to be fast enough - when it was written the internal receive buffer was 128 bytes and the longest request block is 133, so it was able to be a bit "casual" about retrieving the data. I re-wrote the serial data portion to collect all the bytes into a new buffer until it sees the CRC_EOP character, then process the request as before.

I've sent the updated version to Adafruit. If anyone needs a copy just ask.

William
User avatar
wbp
 
Posts: 149
Joined: Mon Mar 07, 2011 12:18 pm

Re: Standalone Programmer on Arduino UNO?

Postby DrSproc » Sat Apr 21, 2012 8:05 am

Problems with the Standalone AVR ISP Programmer Shield Kit on Uno R2/R3 ?!?!?!?!

If you get this...

avrdude: stk500_paged_write(): (a) protocol error, expect=0x14, resp=0x64
avrdude: stk500_cmd(): programmer is out of sync

...are you using Arduino Sketch Programmer Version 1.0? (I was)

I did this...

Downgraded to the Arduino 0023 programmer instead...
http://arduino.cc/en/Main/Software

Downloaded the sketch again from...
https://github.com/adafruit/Standalone- ... ogrammer...

Made sure my board was set to UNO.

Compiled and uploaded the sketch again using Arduin0 023 and... It worked...

I finally have a AVR ISP Programmer, that works standalone. Yay!!!!!
(BTW I now have Arduino 1.0 and Arduino 023 on the same comp... be careful with the location of your preferences as you switch versions)
Last edited by DrSproc on Tue May 08, 2012 6:54 am, edited 1 time in total.
User avatar
DrSproc
 
Posts: 3
Joined: Sat Apr 14, 2012 10:06 am

Re: Standalone Programmer on Arduino UNO?

Postby mahdi » Sun Apr 22, 2012 8:48 am

before uploading any script to arduino just remove any wire attached to arduino or shields axcept the usb cable. plane arduino then upload after that re-attach the shield or the wires again. it work with me.

fresh start always good :)

if you add a capacitor between the RESET Pin and the GRN Pin the it will give you errors while uploading to arduino you should remove it first.
mahdi
 
Posts: 4
Joined: Sat Nov 19, 2011 9:01 pm


Return to Arduino

Who is online

Users browsing this forum: Exabot [Bot], guccyi, MSN [Bot] and 9 guests

Stuff to buy from the Adafruit store and links to product documentation!


New Products [102]

Raspberry Pi[80]
 
FLORA[23]
 
Bunnie Studios[9]
 
FPGA[1]
 
mbed[11]
Arduino[60]
 
NETduino[14]
 
BeagleBone[24]
 
Android[6]
 
XBee[10]
More Dev Boards[30]


 
BoArduino[8]
 
SpokePOV[4]
 
TV-B-Gone[4]
 
MiniPOV[3]
 
SIM reader[3]
 
Microtouch[5]
 
Clocks & Watches[18]
 
Drawdio[4]
 
Brain Machine[1]
 
Game of Life[2]
 
MintyBoost[2]
More DIY Kits[16]


 
MaKey MaKey[3]
 
Tweet-a-Watt[5]
 
Young Engineers[33]
 
Discover Electronics[2]
 
Snap Circuits[4]
 
littleBits[3]
 
Project packs[8]


 
Breakout Boards[33]
LCDs & Displays[48]
Components & Parts[69]
Batteries & Power[49]
EL Wire/Tape/Panel[52]
LEDs[108]
 
Wireless[14]
Cables[60]
 
Lasers[6]
Sensors/Parts[145]
 
Enclosures/Cases[11]
 
Solar[11]
 
RFID / NFC[13]
Prototyping[69]
 
iDevices[13]
Tools[71]
 
Wearables[39]
 
CNC[37]
 
Robotics[29]
 
3D printing[1]
 
Materials[24]


 
Stickers[41]
 
Skill badges[55]
 
Books[25]
 
Circuit Playground[7]
 
Gift Certificates[4]