tunataskintuna35 / mega-isp

Automatically exported from code.google.com/p/mega-isp
0 stars 0 forks source link

mega 2560 does not work as an ISP #30

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
I started a thread 
http://forum.arduino.cc/index.php?topic=174857.msg1297970#msg1297970 to see if 
others have the same problem.
Steps to reproduce the problem
1. build latest avrdude http://www.nongnu.org/avrdude/
2. install mega-isp onto a SainSmart MEGA 2560 board
3. test connection using Serial Monitor ("1 ") produces the expected result
4. attempt to sync with avrdude - avrdude -b 9600 -c arduino -p m644p -t -vvvv 
-P /dev/ttyACM0

Expected output?
I expect to see avrdude: ser_recv() with some content indicating that the 
sketch has responded to the "0 " message.

Actual output?
         Using Port                    : /dev/ttyACM0
         Using Programmer              : arduino
         Overriding Baud Rate          : 9600
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: Send: 0 [30]   [20] 
avrdude: ser_recv(): programmer is not responding
avrdude: stk500_recv(): programmer is not responding

avrdude done.  Thank you.

avrdude Version 5.11svn-20111019
Running on Ubuntu 13.04
ArduinoISP-master downloaded from https://github.com/rsbohn/arduinoisp

Original issue reported on code.google.com by pete...@gmail.com on 30 Jun 2013 at 8:40

GoogleCodeExporter commented 9 years ago
[deleted comment]
GoogleCodeExporter commented 9 years ago
I have now fixed this problem with a change to avrdude and a change to mega-isp 
- the correct patch is detailed below.  The idea is to flush the receive queue 
in ArduinoISP so that case '0' - signon does not respond to multiple signon 
attempts from avrdude it only responds to one signon attempt.  Without this fix 
ArduinoISP is not in sync with avrdude because it sends multiple signon 
responses and the second and third signon response are incorrectly interpreted 
as responses to subsequent avrdude messages.  The fix in avrdude is included 
fyi so that you can test this change.

avrdude-5.11svn-20111019/arduino.c
99c99,101
<   usleep(50*1000);
---
> 
>   /* Sleep to allow the Arduino board to reset */
>   usleep(1000*1000);

ArduinoISP/ArduinoISP.ino
452c452,460
<     empty_reply();
---
>     if (getch() == CRC_EOP) {
>        // empty the input stream
>        while (0<Serial.available()) getch();
>        Serial.print((char)STK_INSYNC);
>        Serial.print((char)STK_OK);
>      } else {
>          error++;
>          Serial.print((char)STK_NOSYNC);
>      }

Original comment by pete...@gmail.com on 1 Jul 2013 at 8:50

GoogleCodeExporter commented 9 years ago
Note I have also created a bug in the avrdude project for this issue see 
https://savannah.nongnu.org/bugs/index.php?39526
Patch files for the fix are attached

Original comment by pete...@gmail.com on 19 Jul 2013 at 1:42

Attachments: