1.. zephyr:board:: samr21_xpro 2 3Overview 4******** 5 6The SAM R21 Xplained Pro is a compact evaluation board by Atmel featuring a 7SAMR21G18A SoC. The SoC includes a SAMR21 ARM Cortex-M0+ micro-controller 8bundled with Atmel's AT86RF233, a 2.4GHz IEEE802.15.4 compatible radio. 9The kit includes Atmel’s Embedded Debugger (EDBG), which provides a full 10debug interface without the need for additional hardware. 11 12Hardware 13******** 14 15- SAMR21G18A ARM Cortex-M0+ processor at 48 MHz 16- 32.768 kHz crystal oscillator 17- 256 KiB flash memory and 32 KiB of RAM 18- One yellow user LED 19- One mechanical user push button 20- One reset button 21- On-board USB based EDBG unit with serial console 22 23Supported Features 24================== 25 26.. zephyr:board-supported-hw:: 27 28Pin Mapping 29=========== 30 31The SAM R21 Xplained Pro evaluation kit has 3 GPIO controllers. These 32controllers are responsible for pin muxing, input/output, pull-up, etc. 33 34For more details please refer to `SAM R21 Family Datasheet`_ and the `SAM R21 35Xplained Pro Schematic`_. 36 37.. image:: img/ATSAMR21-XPRO-pinout.jpg 38 :align: center 39 :alt: SAMR21-XPRO-pinout 40 41Default Zephyr Peripheral Mapping: 42---------------------------------- 43- SERCOM0 USART TX : PA5 44- SERCOM0 USART RX : PA4 45- SERCOM1 I2C SDA : PA16 46- SERCOM1 I2C SCL : PA17 47- SERCOM5 SPI MISO : PB02 48- SERCOM5 SPI MOSI : PB22 49- SERCOM5 SPI SCK : PB23 50- GPIO SPI CS : PB03 51- GPIO/PWM LED0 : PA19 52 53System Clock 54============ 55 56The SAMR21 MCU is configured to use the 32.768 kHz external oscillator 57with the on-chip PLL generating the 48 MHz system clock. 58 59Serial Port 60=========== 61 62The SAMR21 MCU has six SERCOM based USARTs with two configured as USARTs in 63this BSP. SERCOM0 is the default Zephyr console. 64 65- SERCOM0 115200 8n1 connected to the onboard Atmel Embedded Debugger (EDBG) 66 67PWM 68=== 69 70The SAMR21 MCU has 3 TCC based PWM units with up to 4 outputs each and a 71period of 24 bits or 16 bits. If :code:`CONFIG_PWM_SAM0_TCC` is enabled then 72LED0 is driven by TCC0 instead of by GPIO. 73 74SPI Port 75======== 76 77The SAMR21 MCU has 6 SERCOM based SPIs. 78 79- SERCOM5 is exposed via Xplained Pro Standard Extension Header 80 81I2C Port 82======== 83 84When connecting an I2C device and a logic analyzer to an I2C port at the same 85time, the internal pull-up resistors are not sufficient for stable bus 86operation. You probably have to connect external pull-ups to both bus lines. 10K 87is a good value to start with. 88 89- SERCOM1 is exposed via Xplained Pro Standard Extension Header 90 91Radio 92===== 93 94The SAMR21 SoC includes an on-chip AT86RF233 radio. It is internally 95connected via SPI and some GPIO pins and behaves the same way as 96externally connected SPI devices. 97 98+-------------+------------------------------------------------------------------------------------------+ 99| Sensor | AT86RF233 | 100+=============+==========================================================================================+ 101| Type | 2.4GHz IEEE802.15.4 radio | 102+-------------+------------------------------------------------------------------------------------------+ 103| Vendor | Atmel | 104+-------------+------------------------------------------------------------------------------------------+ 105| Datasheet |`Datasheet <http://www.atmel.com/images/atmel-8351-mcu_wireless-at86rf233_datasheet.pdf>`_| 106+-------------+------------------------------------------------------------------------------------------+ 107| connected to| SPI_0 | 108+-------------+------------------------------------------------------------------------------------------+ 109| Pin Config: | 110+-------------+------------------------------------------------------------------------------------------+ 111| Device | SERCOM4 | 112+-------------+------------------------------------------------------------------------------------------+ 113| MOSI | PB30 (OUT, SPI MOSI) | 114+-------------+------------------------------------------------------------------------------------------+ 115| MISO | PC19 (IN, SPI MISO) | 116+-------------+------------------------------------------------------------------------------------------+ 117| SCLK | PC18 (OUT, SPI SCLK) | 118+-------------+------------------------------------------------------------------------------------------+ 119| CS | PB31 (OUT, GPIO output) | 120+-------------+------------------------------------------------------------------------------------------+ 121| IRQ | PB00 (IN, GPIO external interrupt) | 122+-------------+------------------------------------------------------------------------------------------+ 123| RSTN | PB15 (OUT, GPIO output) | 124+-------------+------------------------------------------------------------------------------------------+ 125| SLP_TR | PA20 (OUT, GPIO output) | 126+-------------+------------------------------------------------------------------------------------------+ 127 128Zephyr provide several samples that can use this technology. You can check 129:zephyr:code-sample:`wpan-serial` example as starting points. 130Another good test can be done with IPv6 by using the server/client 131echo demo. More information at :zephyr:code-sample:`sockets-echo-server` and 132:zephyr:code-sample:`sockets-echo-client`. 133 134Programming and Debugging 135************************* 136 137The SAM R21 Xplained Pro comes with a Atmel Embedded Debugger (EDBG). This 138provides a debug interface to the SAMR21 chip and is supported by 139OpenOCD. 140 141Flashing 142======== 143 144#. Build the Zephyr kernel and the :zephyr:code-sample:`hello_world` sample application: 145 146 .. zephyr-app-commands:: 147 :zephyr-app: samples/hello_world 148 :board: samr21_xpro 149 :goals: build 150 :compact: 151 152#. Connect the SAM R21 Xplained Pro to your host computer using the USB debug 153 port. 154 155#. Run your favorite terminal program to listen for output. Under Linux the 156 terminal should be :code:`/dev/ttyACM0`. For example: 157 158 .. code-block:: console 159 160 $ minicom -D /dev/ttyACM0 -o 161 162 The -o option tells minicom not to send the modem initialization 163 string. Connection should be configured as follows: 164 165 - Speed: 115200 166 - Data: 8 bits 167 - Parity: None 168 - Stop bits: 1 169 170#. To flash an image: 171 172 .. zephyr-app-commands:: 173 :zephyr-app: samples/hello_world 174 :board: samr21_xpro 175 :goals: flash 176 :compact: 177 178 You should see "Hello World! samr21_xpro" in your terminal. 179 180References 181********** 182 183.. target-notes:: 184 185.. _Microchip website: 186 http://www.microchip.com/DevelopmentTools/ProductDetails.aspx?PartNO=ATSAMR21-XPRO 187 188.. _SAM R21 Family Datasheet: 189 http://ww1.microchip.com/downloads/en/devicedoc/sam-r21_datasheet.pdf 190 191.. _SAM R21 Xplained Pro Schematic: 192 http://ww1.microchip.com/downloads/en/DeviceDoc/SAMR21-Xplained-Pro_Design-Documentation.zip 193