Programming sequence DUE


I am constructing a custom board where we need to program/degub the DUE wirelessly over a serial to RF link. I know that the DUE uses the 16U2 processor to achieve an erase cycle of about 250ms after follows a wait for about 10ms and after that two 200ms resets followed after one and other with a 10ms space between. After this procedure 600ms later the programming is taking place. Fine so. But, since the 16U2 must get some kind of command from the Arduino environment to start the erase/reset circus and I wonder if it is possible to see somewhere which is the initial serial command sent out by the Arduino IDE to make this happen? As far as I understand the 16U2 is just a USB-serial device, using some more logic to erase/reset before programming code is transferred. But still it has to receive all the commands serially, is that correct understood?

I can construct my own ic to deal with the same reset serially, but i dont know which commands is sent to the 16U2 since this happens internally in the USB-environment.

I wonder which serial commands are sent to the 16U2 that initiate the erase/reset thing? I need to mimic this, since I really want to use Arduino IDE to program my device.

Any help here would be very appreciated!



Programming of the Due is handled by bossac.exe, which is an Atmel utility. The protocol is documented somewhere on the Atmel website.

Regards, Ray L.

Aha, well, reading on while you replied, especially looking through the source code for the 16U2 processor on the DUE I just see that these delays and erase/reset is handeled after changing the baudrate to 1200. If a change is detected in baudrate, the 16U2 checks if it is changed into 1200bps, and if it is, it initiates the erase/reset cycle. The rest of the transfer is just serial data, that I don't need to know anything about, just pass on, as far as i am concerned. I can't see really why 1200 Baud is used for programming the DUE though? Is this not very slow? Any way to increase speed here without rewriting the IDE? My RF-link can't deal with that slow connections..

Seems like a hopeless alternative to make something new/different about the programming of the DUE in any OEM setup via the IDE. It seems impossible to get information about the port speed in Native programming mode, but I would guess it's also 1200bps, which is extremely slow. The reason for chosing this baudrate falls outside of my understanding. Would it not be much cooler to have a certain command serially that initiates the erase/reset? It could be a 128bit key or something like that. If that were the case anyone could make their custom devices even based on DUE.

If anyone have any information about the data transferred using Native port and the port-speed used with this in Arduino IDE, I would very much appreciate this information.

Opening the port at 1200 just triggers the reset-erase sequence, it is not used for the actual data transfer. The IDE reconnects at a higher baud rate to do the programming - 115200 I think.