Difference between Programming and Native Ports

Why do the Arduino Due and Zero have two USB Ports?

difference between programming and native ports due and zero

When you hear the name “Arduino,” does a picture of the Uno come to mind? While the most popular, this 8-bit based board isn’t the only Arduino available today. There are some other boards available like the Due and recently introduced Zero, which are far more advanced than the humble Uno.

These are 32-bit microcontroller boards that have a very different architecture compared to the relatively straightforward Uno. In fact, one of the most striking differences is that the Due and Zero have two USB ports.

What is the difference between the Programming and Native ports on these more powerful Arduino boards?

Released several years ago, the Due was the Arduino team’s first 32-bit Arduino. It was also the first with a switching power supply on-board as well as I/O that was 3.3V volt-only. Pretty exciting stuff at the time.

By the way, “Due” is not short for Duemilanove. The Duemilanove was the predecessor to the Uno. Like the Uno, it used the same 8-bit AVR chip.

When released, I wrote about my first impressions of the Due and even a short tutorial on creating a triangle or sawtooth waveform with its true analog-outputs.

Two USB Ports

One misconception you might have about the 32-bit boards is that two ports mean one is for the device, and one is for the host. That is not the case. Both ports are device-only.

One point of confusion is that either port can be used to program the board. So, then, what is the difference between the programming and native ports? And which port should you be using?

Difference between Programming and Native Ports

Programming Port

The Due uses an ATmega16u2 on its Programming Port, similar to how the other Arduino boards work. The 16u2 acts as a serial to USB adapter and programs the 32-bit chip.

Simplified Arduino Zero

The Zero is very different. Its Programming port connects to a chip acting as an “EDBG interface.” EDBG is the Atmel® Embedded Debugger protocol, running on a separate microcontroller, the AT32UC3A. Atmel created this protocol to allow programming and debugging of their microcontrollers.

Note: Instead of using avrdude to program the microcontroller, the Zero is programmed with a utility called openOCD.

Native Port

On both the Due and Zero, the Native port is connected directly to the microcontroller. Why include this port? The direct, or native port, is useful to use the Microcontroller to emulate different USB devices.

One benefit is that you can emulate a USB device on Native while reprogramming the Arduino with the Programming port.

Which port do you use to program?

Either port can be used to program the Due or Zero. However, it is recommended to use the dedicated Programming Port.

The Leonardo is a case where the “Programming Port” is connected directly to the Microcontroller. Some users have had trouble with re-programming the Leonardo because of the complicated “reset” scheme.

Programming with a dedicated chip and a dedicated port will give you more reliable operation.

What is special about the Zero’s Programming Port?

Working with Atmel, the Arduino Zero is the first Arduino board to support Atmel Studio directly. The Zero uses Atmel’s EDBG protocol, allowing for the full debugging capabilities of the 32-bit microcontroller.

When you compare this to the Uno, most debugging is done with Serial prints. This method is a crude way to find bugs. Many times, it introduces bugs, like running out of RAM. A full-fledged debugger allows you to pause the microcontroller and inspect contents of memory, directly!

For complex projects this debug capability is critical. To make use of the debug capabilities, you need to move outside of the Arduino IDE and into Atmel Studio.

Conclusion

If in doubt about the difference between programming and native ports, use the programming port. Keep in mind if you are used to the Uno or other 8-bit Arduino boards, the 32-bit Due and Zero are completely different.

 

 

Your questions, comments, and even corrections are encouraged and very much appreciated! However. I have zero-tolerance for inappropriate or harassing comments. I try to reply to everyone... -James

Leave a comment

2 thoughts on “Difference between Programming and Native Ports

  1. Hello. You say both ports are “device-only”, but in Due’s product page is said: “The Native USB port can also act as a USB host for connected peripherals such as mice, keyboards, and smartphones. To use these features, see the USBHost reference pages.” And in official Zero’s getting started guide is said: “Using the Native port enables you to use the Zero as a client USB peripheral (acting as a mouse or a keyboard connected to the computer) or as a USB host device so that devices can be connected to the Zero (like a mouse, keyboard, or an Android phone)”. I can’t say who is right because I haven’t any board to test it, but I only wanted to share this inconsistency. Thanks.