.. _samd_quickref: Quick reference for the SAMD21/SAMD51 family ============================================ .. image:: img/itsybitsy_m4_express.jpg :alt: Adafruit ItsyBitsy M4 Express board :width: 640px The Adafruit ItsyBitsy M4 Express board. Below is a quick reference for SAMD21/SAMD51-based boards. If it is your first time working with this board it may be useful to get an overview of the microcontroller: .. toctree:: :maxdepth: 1 general.rst tutorial/intro.rst pinout.rst Installing MicroPython ---------------------- See the corresponding section of tutorial: :ref:`samd_intro`. It also includes a troubleshooting subsection. General board control --------------------- The MicroPython REPL is on the USB port, configured in VCP mode. Tab-completion is useful to find out what methods an object has. Paste mode (Ctrl-E) is useful to paste a large slab of Python code into the REPL. The :mod:`machine` module:: import machine machine.freq() # get the current frequency of the CPU machine.freq(96_000_000) # set the CPU frequency to 96 MHz The range accepted by the function call is 1_000_000 to 200_000_000 (1 MHz to 200 MHz) for SAMD51 and 1_000_000 to 48_000_000 (1 MHz to 48 MHz) for SAMD21. The safe range for SAMD51 according to the data sheet is 96 MHz to 120 MHz. At frequencies below 8 MHz USB will be disabled. Changing the frequency below 48 MHz impacts the baud rates of UART, I2C and SPI. These have to be set again after changing the CPU frequency. The ms and µs timers are not affected by the frequency change. Delay and timing ---------------- Use the :mod:`time