Why not use on-chip USB bootloader?

Hi,
I do understand that the ATMEGA16U2-MU on Due is used to provide USB-JTAG support for the ATSAM3X8EA but what if we do not need JTAG/Debug support? Instead, I would like to just flash the sketch to ATSAM. Can't we just use ATSAM's onchip USB bootloader? If yes, where do I start?

Thanks
uCFreak

I would start reading datasheet, whether such option is even available with the chip..

pito:
I would start reading datasheet, whether such option is even available with the chip..

Pito,
The ATSAM3S series datasheet states "16 Kbytes ROM with embedded bootloader routines (UART, USB) and IAP routines". The SAM3S series chipsets do support UART and USB bootloading, it's just a matter of supporting this bootloader in the Arduino IDE.

I have worked with uCs for quite a while but I am new to Arduino, can someone please point me in the right direction?

Thanks
uCFreak

The 16U2 has nothing to do with JTAG, it's simply a USB to Serial converter that connects to the inbuilt UART bootloader with the added function of "pressing" the Erase button for you.

You can still use the USB bootloader but you will have to manually press the erase button.

If you look in the Tools>Board menu you'll see options for both.

So, I haven't done it but AFAIK you press "Erase" then download from the IDE to the "Native USB port".


Rob

Graynomad:
You can still use the USB bootloader but you will have to manually press the erase button.


Rob

Hi Rob,
Thanks for the reply, it helped. I looked into the schematics and it looks like the ATMEGA16U2-MU is used to assert NRSTB which is the Asynchronous Microcontroller Reset (equivalent to power-on reset). The ATSAM3X8 USB/UART bootloader starts at 0x00 which means that the controller enters bootloader after power-up and switches either to SAM-BA monitor or user application depending on conditions described in "SAM3X/A Boot Program" section of the datasheet.

Thanks
uCFreak

AFAIK despite being connected to NRSTB it never actually controls that pin, I think someone removed the series resistor and it made no difference and in the 16U2 code there is a note to that effect as well.

It does however control the erase signal.

switches either to SAM-BA monitor or user application depending on conditions described in "SAM3X/A Boot Program" section of the datasheet.

The main condition is I think the presence or not of any user code, hence asserting the erase before loading a new program.


Rob