Getting started with the Arduino M0
To connect the Arduino M0 to your computer, you'll need a Micro-B USB cable. The USB cable will provide power and allow you to program the board.
Attack the USB micro side of the USB cable to the M0 USB port. To upload a sketch, choose Arduino M0 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.
You can also checkout the new Arduino Studio!
Differences from ATMEGA based boards
The Arduino M0 has the same footprint as the Arduino Uno, and in general, you can program and use the M0 as you would do with other Arduino boards. There are, however, a few important differences and functional extensions, listed below.
The microcontroller on the Arduino M0 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 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.
The board can take power from the USB connectors or from the DC plug (6-20V).
The Arduino M0 has an efficient switching voltage regulator, compliant with the USB host specification. Using the USB port as USB host implies that the board has to provide power to the device, for example a mouse or a keyboard.
Serial port on the M0
The Arduino M0 has one USB port available, called Native USB.
The Native USB port (which supports CDC serial communication using the SerialUSB object) is connected directly to the SAMD21 MCU.
The USB connector of the Native port is directly connected to the USB host pins of the SAMD21. Then you can use the M0 as a client USB peripheral (acting as a mouse or a keyboard connected to the computer) or as an USB host device so that devices can be connected to the M0 (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.
Opening and closing the USB 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 USB port at a baud-rate 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 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.
ADC and PWM resolutions
The M0 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
No 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 will show up as “Not Configured”, but it is still working. You can quit the System Preferences.
If you previously installed Arduino IDE, you already have drivers installed.
If you haven't yet installed Arduino IDE, download the Windows version of the Arduino software from the official page here.
When the download finishes, launch the file to install the software and the drivers.
If you downloaded the .zip version of the IDE, unzip the downloaded file. Make sure to preserve the folder structure.
Now your drivers will be downloaded and installed from Internet, directly from Windows.
If you have issues, you can find the "drivers" folder inside the unzipped file, for manual installation.
There 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
The uploading process on the Arduino M0 works the same as other boards from a user's standpoint.
Uploading requires the following steps:
- Connect your board to the computer by attaching the USB cable to the M0's USB port.
- Open the Arduino IDE.
- In the "Tools" menu choose "Serial Port" and select the serial port of the M0
- Under the "Tools > Boards" menu select "Arduino M0"
- You are now ready to upload sketches to your Arduino M0.
For more details on the Arduino M0, see the hardware page.