Question: How does the Arduino IDE erase and reset the SAM on DUE automatically?

Hi @ all!

I'm working on an integration of the Arduino DUE to the Atmel Studio 6.
It's for an university lab and programming for the other students have to be as easy as possible. We don't want to use the Arduino IDE, sorry :wink:

Out of the Box the Atmel Studio support the SAM Chips with the Atmel ASF, but there is no way to program the DUE.

So I integrated the BOSSA.exe as "external tool" in the Atmel Studio. Now programming is one click and works on both USB ports (programming and native), with one exception. The SAM have to be erased and reseted with the two buttons on board before the next programming can be made.
For one single programming action this is ok, but i would be much better when it works completely automatic, like in the Arduino IDE.

Can you please tell me, how the Arduino IDE resets and maybe erases the SAM before reprogramming?
So I can add this procedure to the Atmel Studio, too.

I googled for hours but nothing found :frowning:

Greetings from Germany!

The 16u2 processor effectively presses the Erase button for you by activating a FET across the button.

I’ve never used a Due but if you are using the programming port that should still work I would think, but not on the native port.


That the 16u2 do this is clear... But how the Arduino IDE triggers the 16u2 to do this? There is a way on the native port too, because on the arduino IDE it is possible to reprogram without erasing manual over the native port.

I read that i have to open close the port with 1200 baud, but it is not exactly discribed how often and wether i schould sending somewhat or not.

Any information?

But how the Arduino IDE triggers the 16u2 to do this?

I'm not sure, there must be some code in the 16u2 that handles commands from the IDE or maybe AVRDUDE.