-
-
Notifications
You must be signed in to change notification settings - Fork 7k
Updated Arduino as ISP setting #3687
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
Are you sure? The "arduino" protocol in avrdude is also used for uploads to the Arduino Uno, so I doubt that leaves DTR untouched? It would be a good feature in avrdude, though, preventing problems with arduino-as-isp, but i'm not sure if not touching DTR is possible in a cross-platform way (I think some linux drivers have the DTR assertion on open hardcoded). |
That is what I always used before and was recommended in a lot of internet sites. Extract from avrdude config:
It uses the arduino.h/cpp files. I remember that this fix was needed to use a 32u4 as ISP. It seems that it now works without for some reason!? |
AFAICS the "arduino" uploader is the same as "stk500", but with DTR/RTS toggle to allow Arduino Board's reset. quoting: you can clearly see a 250ms pulse on DTR and RTS. static int arduino_open(PROGRAMMER * pgm, char * port)
{
union pinfo pinfo;
strcpy(pgm->port, port);
pinfo.baud = pgm->baudrate? pgm->baudrate: 115200;
if (serial_open(port, pinfo, &pgm->fd)==-1) {
return -1;
}
/* Clear DTR and RTS to unload the RESET capacitor
* (for example in Arduino) */
serial_set_dtr_rts(&pgm->fd, 0);
usleep(250*1000);
/* Set DTR and RTS back to high */
serial_set_dtr_rts(&pgm->fd, 1);
usleep(50*1000);
/*
* drain any extraneous input
*/
stk500_drain(pgm, 0);
if (stk500_getsync(pgm) < 0)
return -1;
return 0;
} at this point I think that the ArduinoISP programmer should use "stk500v1" as programmer type to not reset the Arduino Board that is acting as ISP programmer. |
Note that I am not sure this will work on Linux, where I think DTR is automatically asserted by the kernel driver. Looking through the kernel sources, I believed that this bit of code is responsible for that but it might seem that during serial port open, So I guess this just needs a bit of testing, then? |
No its a windows only problem. And thatswhy its gone for me (dont use it anymore, but used to). |
Right, that report explains the problem better. The thing is that changing to use the I'll close this as a duplicate of #1182 and continue discussion there. |
Meh. The 328 needs a capacitor anyways so it wont reset. So the DTR is not problem here, but for the leonardo it is. And why shouldnt the ISP sketch be used with a leonardo? there are PRs were people want to add due, zero etc support and you cancel this PR because its not made for 32u4 boards? I see two options here: Changing the 32u4 code (refering to your edit) could also help. Also it would make sense, because some serial port monitors dont set DTR by default and you wonder why you dont receive anything. Not sure how this affects the IDE. Its also no duplicate, its a PR for an issue, a solution, not a duplicate. |
Oh, didn't realize that this was as PR, sorry.
Ok, so that means that using the |
Exactly. And thatswhy you can use the arduino protocol for all MCUs. |
I just tried with an Uno board under linux. The arduino protocol does not work and the stk500 protocol did. The arduino setting might fix the 32u4 boards, but we really should solve the cdc write bug there. With a capacitor both protocols work though. RTFM and you can use both protocols. Its easier to not use a cap though if you dont have one laying around and want to fix another arduino. |
@NicoHood I tried to program an UNO using a Leonardo as ISP with these combinations: Ubuntu 14.04arduino with cap works; Windows 10arduino with cap works; El Capitanarduino with cap works; |
Thx for the tests! So to conclude: However I am wondering why windows 10 did not work with a cap. I tested so many combinations, i might be wrong, but this should work? Also we have a broken 32u4 as ISP still with this patch, because the write() code of the serial was not patched yet. |
@agdl I found similar results using a Micro as an ISP to program another Micro. I was only interested in getting Windows to work so I didn't do the whole matrix of testing. Ubuntu 14.04stk500v1 without cap works; Windows 10arduino without cap works; I spent a while struggling to understand why reprogramming wasn't working (not sure if it was a wiring issue, Micro is unsupported as an ISP, etc.) before discovering that it worked fine in Linux. It would be nice to get this change incorporated, or maybe something like the change below that I am using (as suggested here):
|
Since this was already merged in arduino/ArduinoCore-avr@b084848, shouldn't this PR be closed along with #1182? |
With the new avrdude there is a special arduino option that does not trigger DTR and won't reset the Arduino.