Getting started with the Arduino M0 ProTo connect the Arduino M0 Pro to your computer, you'll need a Micro-B USB cable. The USB cable will provide power and allow you to program the board.
Attach the USB micro side of the USB cable to the M0 Pro's Programming port . This is the port closer to the DC power connector. To upload a sketch, choose Arduino M0 Pro (Programming port) from the Tools > Board menu in the Arduino IDE, and select the correct serial port from the Tools > Serial Port menu.
You must use Arduino IDE 1.7.5 or later to program the M0 Pro.
You can also checkout the new Arduino Studio!
Differences from ATMEGA based boardsThe Arduino M0 Pro has the same footprint as the Arduino Uno, and in general, you can program and use the M0 Pro as you would do with other Arduino boards. There are, however, a few important differences and functional extensions, listed below.
VoltageThe microcontroller on the Arduino M0 Pro runs at 3.3V, which means that you must never apply more than 3.3V to its inputs or outputs. When you connect sensors and actuators to the Arduino M0 Pro always take care that the maximum voltage limits are not exceeded on the pins. Connecting higher voltages, like the 5V commonly used with the other Arduino boards, will damage the M0 Pro.
The board can take power from the USB connectors or from the DC plug (6-20V).
The Arduino M0 Pro has an efficient switching voltage regulator, compliant with the USB host specification. Using the Native port as USB host implies that the board has to provide power to the device, for example a mouse or a keyboard.
Serial ports on the M0 Pro
The Arduino M0 Pro has two USB ports available. The Native USB port (which supports CDC serial communication using the SerialUSB object) is connected directly to the SAMD21 MCU. The other USB port is the Programming port. It is connected to the ATMEL embedded debugger (EDBG), the onboard programmer and debugger which can also acts as a USB-to-Serial converter. This Programming port is the default for uploading sketches and communicating with the Arduino.
The USB-to-serial converter of the Programming port is connected to the first UART of the SAMD21. It's possible to communicate over this port using the "Serial" object in the Arduino programming language.
The USB connector of the Native port is directly connected to the USB host pins of the SAMD21. Using the Native port enables you to use the M0 Pro 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 M0 Pro (like a mouse, keyboard, or an Android phone). This port can also be used as a virtual serial port using the "SerialUSB" object in the Arduino programming language.
Native portOpening and closing the Native port at the baud rate of 1200bps triggers a “soft erase” procedure: the flash memory is erased and the board is restarted with the bootloader. This procedure is managed by the MCU, so if the MCU is interrupted for any reason, it is likely that the soft erase procedure would fail.
Opening and closing the Native port at a baudrate other than 1200bps will not reset the SAMD21. To use the serial monitor, and see what your sketch does from the beginning, you'll need to add few lines of code inside the setup(). This will ensure the SAMD21 will wait for the SerialUSB port to open before executing the sketch:
Pressing the Reset button on the M0 Pro causes the SAMD21 to reset as well as resetting the USB communication. This interruption means that if the serial monitor is open, it's necessary to close and reopen it to restart the communication.
Programming portThe USB Programming port is connected to the Atmel EDBG, which is an integrated programmer and debugger. Through the Programming port you have the complete control of the SAMD21, for example you can use the EDBG to burn the bootloader or to access to the entire flash content. Beside these advanced features it also behave as an USB-to-serial converter connected to the first serial interface of the SAMD21. Uploading using the Programming port is the safest way to program the SAMD21. For example it works even if the sketch running on the main MCU is not responding.
To communicate serially with the Programming port, use the "Serial" object in the IDE. All existing sketches that use serial communication based on the Uno board should work similarly. On contrary of what happen on the Arduino UNO, opening the Serial Monitor (or any other serial communication) on the M0 Pro doesn't cause the main MCU reset. Pressing the Reset button while communicating over the Programming port doesn't close a USB connection with the computer because only the SAMD21 is reset.
ADC and PWM resolutionsThe M0 Pro has the ability to change its analog read and write resolutions (defaults to 10-bits and 8-bits, respectively). It can support up to 12-bit ADC and PWM resolutions. See the analog write resolution and analog read resolution pages for information.
Installing Drivers for the M0 Pro
OSXNo driver installation is necessary on OSX. Depending on the version of the OS you're running, you may get a dialog box asking you if you wish to open the “Network Preferences”. Click the "Network Preferences..." button, then click "Apply". The M0 Pro will show up as “Not Configured”, but it is still working. You can quit the System Preferences.
WindowsIf you previously installed Arduino IDE, you already have drivers installed.
If you downloaded the .zip version of the IDE, unzip the downloaded file. Make sure to preserve the folder structure.
You can find the "drivers" folder inside the unzipped file, for manual installation.
LinuxThere is no need to install drivers for Ubuntu 10.0.4
In some computers, you need to setup user permissions and some udev rules.
You can find detailed informations on how to achieve this at this page.
Uploading Code to the M0 ProThe uploading process on the Arduino M0 Pro works the same as other boards from a user's standpoint. It is recommended to use the Programming port for uploading sketches, though you can upload sketches on either of the USB ports.
Uploading with the Programming port requires the following steps:
- Connect your board to the computer by attaching the USB cable to the M0 Pro's Programming port (this is the port closer to the DC power connector).
- Open the Arduino IDE.
- In the "Tools" menu choose "Serial Port" and select the serial port of the M0 Pro
- Under the "Tools > Boards" menu select "Arduino M0 Pro (Programming port)"
- You are now ready to upload sketches to your Arduino M0 Pro.
For more details on the Arduino M0 Pro, see the hardware page