-
-
Notifications
You must be signed in to change notification settings - Fork 7k
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
Improve ArduinoISP sketch #3500
Conversation
It doesn't merge. Can you please rebase the code on top of latest master? |
Thank you @PeterVH ! Unfortunately a recent change moved the sketch from Could you rebase upon the current |
…to the value used in the IDE. In fact, with this fix, baud rates of up to 115200 work also.
… allows the same "ArduinoISP shield" to be used on all of them. Such a shield has an ISP connector that: - wires MISO,MOSI, SCK, GND and 5V to the ISP connector of the programming Arduino - wires RESET to pin 10 of the programming Arduino.
…introducing the SPI library. Put it back in.
…y of the target reset signal.
@facchinm: Done. But this forced me to push -f again. |
@PeterVH no problem at all, thank you very much! I'm launching the PR builder to get a complete IDE image with your sketch so anyone interested can test it! |
…e, select hardware or software SPI based on SPI_CLOCK.
@PeterVH Maybe it's a sillyness, but do you know https://github.com/adafruit/ArduinoISP ?? For gathering some ideas... |
I am afraid I introduced some regression. Some tests, e.g. the at89s52 fail (burning works but verifying fails...) Will have to check this out. |
@PeterVH the mega and the uno have a 16u2 as USB-Serial bridge. I have two questions regarding this:
Also I do not really understand what you mean with
Does the ISP now work with the Micro/Leonardo? |
Yes. I just tried it out.
Well, avrdude sets the baudrate when it starts programming, this causes a baud rate change in the u2 and this causes the Uno or Mega receive a garbage byte.
Sure. Will first read about hood loader. I intend to use it as a more convenient way to disable autoreset (instead of the capa) on Mega and Uno. (Currently on the Mega and Due I use a modified u2 firmware that disables autoreset if a jumper is placed over a pair of the 4 broken out gpios)
Yes. See the test report I maintain at the top of this thread. (Be it that on windows you still have to do -carduino). |
@NicoHood: I can confirm that the problem of the garbage byte does not occur when using HoodLoader2 as bridge. B.t.w, it is a nice concept you worked out. I plan to keep it installed on my Uno. Though for my use case I'd like the inverse the logic: reset twice => sketch mode, press once or powerup => bootloader mode. That way I could leave ArduinoISP in the u2 and when I want to program something, I would activate the sketch by resetting twice. I'll have a look in the code whether that is easy to do... |
So its a problem of the firmware, good to know. This line fixes this (i think) I could invert the logic, but by default it doesnt make sense to me.
So maybe its time to update the firmware? The Leonardo bootloader also has some things that can be improved. The Arduino team should think about updating the unos firmware/bootloader and the leonardos bootloader as well. |
@facchinm: Hi Martino.I ran the bulk of the tests again, this time on Windows. Everything worked fine on this os as well, (see table at the top). Also in the forum, the sketch was able to solve various problems. (this one being the most enthousiastic one :-) ). So I am now confident this is ready to be merged. On windows I still need the fixes from #1182 for leonardo and due. I should make a separate pull resuest for that. @cmaglie: you reported success on the Zero. I bought an Arduino M0 (not Pro) to be able to run that kind of tests myself. (You know I don't have access to Zero from Europe). I run with the arduino.org bootloader and use of coarse the arduino.cc ide and core. I adapted the .cc linker script so that the FLASH addresses match what the bootloader expects. The sketch runs: heartbeat led fades in out. But the communication over SerialUSB does not work correctly (see here). I see no a-priory reason why the behavior of an M0 would be different than on a Zero (but I may overlook something essential, any ideas?). The symptoms look like problems in the USB driver. Are you sure the sketch (still) works correctly on the Zero? |
Hi Peter, I'm really happy to hear such good news! The Zero issue is probably related with SerialUSB code being quite problematic, but it was solved in arduino/ArduinoCore-samd#27 ; that PR will be merged soon but you can test it via Board Manager before release 😉 Anyway, I'm going to test the actual code (you to make sure, I'm totally convinced it works great) and merge it soon. |
You may want to try if this works for you: |
@fachinm: you were right about the usb problems, with the pr you mentioned I can now happily test ArduinoISP on my M0. Thanks! (This also proves ArduinoISP is a good test case for new cores. In the past it already brought problems in the Leonardo and Due cores to the surface) There is another detail I wanted to bring to your attention. Someone in the forum brought up that it is confusing having to upload a sketch called 'ArduinoISP' whilst having to specify 'Arduino as ISP' as a programmer. He suggested to rename the sketch to ArduinoAsISP. I don't know. It is true more and more people in the forum start to refer to this programming method as 'Arduino as ISP'. I'll leave this matter to the Arduino devs... BTW. the info about ArduinoISP on the new examples web site is inaccurate and adds more confusion (with a link to the ArduinoISP board). @NicoHood: that would work for me. Some comments:
|
It is not cleared on disconnect? Where do we have to handle this? (this is very important) In the lufa code are several parts where this variable is changed: |
I have found my way to your pr #3839, will comment over there |
Time for merge 😄 😄 Thanks a lot Peter! |
Thanks Martino! |
The leonardo windows bug is still not solved, correct? |
Why there is a "Programmer->ArduinoISP" menu option and a "Programmer->Arduino as ISP" whereas there is only one "Examples->ArduinoISP" example sketch?? Which programmer is the good one?? It's very confusing. |
"Arduino as ISP" |
Thanks. I've seen "ArduinoISP" programmer refers to https://www.arduino.cc/en/Guide/ArduinoISP . In this case, I think this should be marked in menu as "retired" or something similar, but I'm not sure. |
This is the pull request for issue 3321
More info on this change request is here.
I will update the progress of testing effort in the table below:
Test report for linux (Kubuntu 14.04 LTS):
(1) an at89s52 works out of spec at 3V3. Downloading hex files, signature etc works but flashing a new hex file requires at least 4V. With a shield containing a 5V buffer this could work...
Test report for windows:
(1) used pre compiled hex files, available in the ArduinoISP-test repo.
(2) an at89s52 works out of spec at 3V3. Downloading hex files, signature etc works but flashing a new hex file requires at least 4V. With a shield containing a 5V buffer this could work...
(3) requires the changes to CDC.cpp proposed in #1182.
(4) the error led flashes briefly because the 16u2 sends a bogus byte when changing the baud rate, this is harmless, stk500v1 recovers from it
(5) only big spenders have two mega's