Arduino Due programming

Hi,

The AT91SAM3X8E micro-controller on the Due board has a USB interface. And my question is why Atmega16U2 is used for AT91SAM3X8E programming. Why it is not done like in the Leonardo board?

Thanks.

The SAM chip has a totally different bootloader setup. Erasing the chip via the erase button will erase everything, including any code you were using to run the USB connection. Most of the time it is possible to program through the "native" USB but sometimes it isn't.

A Teensy is often considered to be the "right way" to build an advanced Arduino. The limitations of the Due board cripple many of the good features of that chip.

In this case why the native port is necessary? I'm designing my own due but want to keep it simple. So if I can do without I don't want to implement it.

Can I use the programming port to transfer data via USB? Or at least I want to have ability to use the UART terminal on my PC.

t_bostanjyan: In this case why the native port is necessary? I'm designing my own due but want to keep it simple. So if I can do without I don't want to implement it.

Can I use the programming port to transfer data via USB? Or at least I want to have ability to use the UART terminal on my PC.

The programming port is connected to the 16u2. That port functions identically to any USB port on any other Arduino board. Serial.print, etc etc works.

The Native port is a native USB port and bypasses the 16u2. Use the SerialUSB class to communicate via this port.

I would encourage you to read the product page for the Due closer, as these answers are spelled out: https://www.arduino.cc/en/Main/ArduinoBoardDue

The Programming port is connected to an ATmega16U2, which provides a virtual COM port to software on a connected computer (To recognize the device, Windows machines will need a .inf file, but OSX and Linux machines will recognize the board as a COM port automatically). The 16U2 is also connected to the SAM3X hardware UART. Serial on pins RX0 and TX0 provides Serial-to-USB communication for programming the board through the ATmega16U2 microcontroller. The Arduino software includes a serial monitor which allows simple textual data to be sent to and from the board. The RX and TX LEDs on the board will flash when data is being transmitted via the ATmega16U2 chip and USB connection to the computer (but not for serial communication on pins 0 and 1).

The Native USB port is connected to the SAM3X. It allows for serial (CDC) communication over USB. This provides a serial connection to the Serial Monitor or other applications on your computer. It also enables the Due to emulate a USB mouse or keyboard to an attached computer. To use these features, see the Mouse and Keyboard library reference pages.

Either of the USB ports can be used for programming the board, though it is recommended to use the Programming port due to the way the erasing of the chip is handled :

Programming port: To use this port, select "Arduino Due (Programming Port)" as your board in the Arduino IDE. Connect the Due's programming port (the one closest to the DC power jack) to your computer. The programming port uses the 16U2 as a USB-to-serial chip connected to the first UART of the SAM3X (RX0 and TX0). The 16U2 has two pins connected to the Reset and Erase pins of the SAM3X. Opening and closing the Programming port connected at 1200bps triggers a “hard erase” procedure of the SAM3X chip, activating the Erase and Reset pins on the SAM3X before communicating with the UART. This is the recommended port for programming the Due. It is more reliable than the "soft erase" that occurs on the Native port, and it should work even if the main MCU has crashed.

Native port: To use this port, select "Arduino Due (Native USB Port)" as your board in the Arduino IDE. The Native USB port is connected directly to the SAM3X. Connect the Due's Native USB port (the one closest to the reset button) to your computer. Opening and closing the Native port at 1200bps triggers a 'soft erase' procedure: the flash memory is erased and the board is restarted with the bootloader. If the MCU crashed for some reason it is likely that the soft erase procedure won't work as this procedure happens entirely in software on the SAM3X. Opening and closing the native port at a different baudrate will not reset the SAM3X.

https://www.arduino.cc/en/Reference/Serial

The Arduino Due has three additional 3.3V TTL serial ports: Serial1 on pins 19 (RX) and 18 (TX); Serial2 on pins 17 (RX) and 16 (TX), Serial3 on pins 15 (RX) and 14 (TX). Pins 0 and 1 are also connected to the corresponding pins of the ATmega16U2 USB-to-TTL Serial chip, which is connected to the USB debug port. Additionally, there is a native USB-serial port on the SAM3X chip, SerialUSB'.