As many readers here may already know, there are actually 3 serial port options on the board pictured, the Arduino M0 Pro, as well as the Arduino Zero. The last one won’t be discussed much here, as it’s yet another hardware UART interface, and doesn’t actually break out to a USB connector for uploading code via the Arduino IDE.
- The ‘Serial’ object
- The ‘SerialUSB’ object
- The ‘Serial1’ object
The Programming USB Connector:
The ‘Programming’ USB connector connects to the Atmel EDBG chip directly. The ‘Serial’ C++ object is used to communicate through this interface and it is considered a hardware serial port since it communicates to the Atmel EDBG chip using the Atmel SAMD21 hardware UART. This interface offers the simplest and most reliable method for uploading code to the Arduino via the Arduino IDE.
The Native USB Connector:
The ‘Native’ USB connector connects to the Atmel SAMD21 chip directly. The ‘SerialUSB’ C++ object is used to communicate through this interface and it is considered a virtual serial port since it is an emulated serial interface running over the USB physical interface on the actual Atmel SAMD21. This interface offers an alternative method for uploading code to the Arduino via the Arduino IDE, and does some fancy detection of the baud rate to determine if a reset of the Arduino should be performed to launch into bootloader mode. However, I have found that this reset functionality is intermittent at best.
Pro Tip for Native USB Connector:
A reliable means of uploading code via the Native USB interface is to double-click the reset button of the Arduino. The bootloader firmware was written to specifically force the SAMD21 to stay in bootloader mode indefinitely when a double-click of the reset button is detected until either:
- A code upload and reset occurs, or
- The SAMD21 is reset again
I have found that by doing this just prior to clicking the upload button in the Arduino IDE, the bootloader launch and code upload process works seamlessly every time.
I hope this has helped someone, and appreciate the visit! Until next time, happy coding!