I would like to write code in Arduino language, compile it in the Arduino IDE, grab the resulting binary code, and flash it to the Due via the TX/RX UART pins, bypassing both the USB Programming Port and Atmel16U2 chip. Before the UART flash, I am manually toggling the Erase and Reset pins on the Due to initiate a hard reset of the SAM3X chip, and SAM-BA now waits for the code. I would like to know: can I directly grab the binary code compiled by the Arduino IDE and give it to SAM3X via UART or is there extra code baked into that binary by the Arduino compiler that would cause this method to fail?

  • The compiled code never cares how you upload it. Dec 4, 2015 at 0:18
  • My thoughts were that there could be additional code intended for the Atmel16U2 and Programming Port flash method which would have to be removed in this situation.
    – fillybrese
    Dec 4, 2015 at 0:24
  • Nope, just use avrdude to upload it and you are done ;)
    – frarugi87
    Dec 4, 2015 at 11:13
  • But you can also upload it from the IDE with a serial interface of your own; you are not forced to use the 16u2
    – frarugi87
    Dec 4, 2015 at 11:14

1 Answer 1


It depends

This may not have been the answer the question was originally asked, but now it appears to be: it depends on which revision of the Due you have.

The V03 schematics on the website show a 74LVC1G125DCK part designated IC10 that is being used to translate the 5V TXD signal from the ATMega16u2 (being used as a serial transceiver) to the 3.3V logic needed for the ATSAM3X8. As drawn the TXD line is connected to the buffer/level converter input but it is also connected to its active-low output-enable line. In effect, they're not just using it to convert logic levels, they are also converting the signal to a kind of open collector signal. Looking at the ATSAM3X8 datasheet shows that, yes, there is an internal pullup in the pin receiving the signal.

If your Due is of this design, then yes, you can program the chip by attaching a USB->logic-level-serial adapter to D0 and D1 (USART) pins and program using the SAM-BA protocol. You need to make sure you are not sending over the on-board serial transceiver while this is happening so as to not have it wired-ORing its data with your adapter. The ATMega16U2 has code in it that controls the ATSAM3X8's erase pin, as well as reset pin, by request of the PC via serial-over-USB's DTR and RTS. Since the erase signal is not routed to outside of the Due (on its headers), you would need to use the erase button, barring some modification to the board.

However, not all Due are of this design. Some DUE boards have the output-enable of 74LVC1G125DCK hard-wired active rather than connected to the transceiver TXD; so on these designs it does not behave as open-collector, and the ATMega16u2 serial transceiver is actively driving the line when idle. This destroys the ability to program the board over UART via pins D0 and D1. It does however make cleaner rising edges. Without modifying the board, no, you can't do it with this design.


So far as I can tell, whether or not your ATMega16U2->ATSAM3X8 connection is open collector/UART-programming-friendly follows the location of the buffer part. The chip is an SC70 package, a small 5-pin thing that looks a bit like SOT23-5. If it is located off the ATMega16U2 itself it seems you have a open-collector configuration, again so far as I've been able to tell. If it is located next to D0, between D0 and the "COMMUNICATION" header, then you have one that drives-high.

If you have a scope, you can put it on D0 and watch the edges generated when you send traffic from the PC over the ATMega16U2 at higher baud rates. You will either see characteristic open-collector rising edges or you won't and that will answer the question.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.