boards: arm: atsamr34: Add SAMR34 Xplained board

Implement support for SAMR34 Xplained Pro dev board.

Signed-off-by: Attie Grande <attie.grande@argentum-systems.co.uk>
This commit is contained in:
Attie Grande 2022-01-05 15:33:12 +00:00 committed by Fabio Baltieri
parent a10b8cb1c0
commit adeb181a72
15 changed files with 553 additions and 1 deletions

View File

@ -0,0 +1,8 @@
# SAM R34 Xplained Pro board configuration
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
config BOARD_ATSAMR34_XPRO
bool "SAM R34 Xplained Pro"
depends on SOC_PART_NUMBER_SAMR34J18B

View File

@ -0,0 +1,8 @@
# SAM R34 Xplained Pro board configuration
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
config BOARD
default "atsamr34_xpro"
depends on BOARD_ATSAMR34_XPRO

View File

@ -0,0 +1,46 @@
/*
* Copyright (c) 2021 Argentum Systems Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
#include <dt-bindings/pinctrl/samr34j-pinctrl.h>
&pinctrl {
tcc0_default: tcc0_default {
group1 {
pinmux = <PA19F_TCC0_WO3>;
};
};
sercom0_default: sercom0_default {
group1 {
pinmux = <PA4D_SERCOM0_PAD0>,
<PA5D_SERCOM0_PAD1>;
};
};
sercom1_default: sercom1_default {
group1 {
pinmux = <PA16C_SERCOM1_PAD0>,
<PA17C_SERCOM1_PAD1>;
};
};
sercom4_default: sercom4_default {
group1 {
pinmux = <PB30F_SERCOM4_PAD2>,
<PB31F_SERCOM4_PAD1>,
<PC18F_SERCOM4_PAD3>,
<PC19F_SERCOM4_PAD0>;
};
};
sercom5_default: sercom5_default {
group1 {
pinmux = <PB2D_SERCOM5_PAD0>,
<PB22D_SERCOM5_PAD2>,
<PB23D_SERCOM5_PAD3>;
};
};
};

View File

@ -0,0 +1,122 @@
/*
* Copyright (c) 2021 Argentum Systems Ltd.
*
* SPDX-License-Identifier: Apache-2.0
*/
/dts-v1/;
#include <atmel/samr34.dtsi>
#include "atsamr34_xpro-pinctrl.dtsi"
/ {
model = "SAM R34 Xplained Pro";
compatible = "atsamr34,xpro", "atmel,samr34j18b", "atmel,samr34";
chosen {
zephyr,console = &sercom0;
zephyr,shell-uart = &sercom0;
zephyr,sram = &sram0;
zephyr,flash = &flash0;
};
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
pwm-led0 = &pwm_led0;
sw0 = &user_button;
};
leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&porta 19 GPIO_ACTIVE_LOW>;
label = "Yellow LED";
};
};
pwmleds {
compatible = "pwm-leds";
pwm_led0: pwm_led_0 {
pwms = <&tcc0 3 PWM_MSEC(20)>;
};
};
buttons {
compatible = "gpio-keys";
user_button: button_0 {
gpios = <&porta 28 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "SW0";
};
};
};
&cpu0 {
clock-frequency = <48000000>;
};
&adc {
status = "okay";
};
&tcc0 {
status = "okay";
compatible = "atmel,sam0-tcc-pwm";
/* Gives a maximum period of 1.4s */
prescaler = <4>;
#pwm-cells = <2>;
pinctrl-0 = <&tcc0_default>;
pinctrl-names = "default";
};
&sercom0 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
rxpo = <1>;
txpo = <0>;
pinctrl-0 = <&sercom0_default>;
pinctrl-names = "default";
};
&sercom1 {
status = "okay";
compatible = "atmel,sam0-i2c";
clock-frequency = <I2C_BITRATE_FAST>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&sercom1_default>;
pinctrl-names = "default";
};
/* SERCOM4 is used for the internal LoRa radio */
&sercom4 {
status = "okay";
pinctrl-0 = <&sercom4_default>;
pinctrl-names = "default";
};
&lora {
tcxo-power-gpios = <&porta 9 GPIO_ACTIVE_HIGH>; /* TCXO_PWR */
tcxo-power-startup-delay-ms = <5>;
rfi-enable-gpios = <&porta 13 GPIO_ACTIVE_HIGH>; /* BAND_SEL */
rfo-enable-gpios = <&porta 13 GPIO_ACTIVE_HIGH>; /* BAND_SEL */
};
&sercom5 {
status = "okay";
compatible = "atmel,sam0-spi";
dipo = <0>;
dopo = <1>;
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&sercom5_default>;
pinctrl-names = "default";
};
zephyr_udc0: &usb0 {
status = "okay";
};

View File

@ -0,0 +1,23 @@
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
identifier: atsamr34_xpro
name: SAM R34 Xplained Pro
type: mcu
arch: arm
ram: 32
flash: 256
toolchain:
- zephyr
- gnuarmemb
- xtools
supported:
- adc
- counter
- dma
- gpio
- i2c
- pwm
- spi
- usb_cdc
- usb_device
- watchdog

View File

@ -0,0 +1,16 @@
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
CONFIG_SOC_SERIES_SAMR34=y
CONFIG_SOC_PART_NUMBER_SAMR34J18B=y
CONFIG_BOARD_ATSAMR34_XPRO=y
CONFIG_BUILD_OUTPUT_HEX=y
CONFIG_CORTEX_M_SYSTICK=y
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_SERIAL=y
CONFIG_UART_SAM0=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_GPIO=y
CONFIG_GPIO_SAM0=y
CONFIG_SOC_ATMEL_SAML_XOSC32K=y
CONFIG_SOC_ATMEL_SAML_XOSC32K_AS_MAIN=y

View File

@ -0,0 +1,4 @@
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
include(${ZEPHYR_BASE}/boards/common/openocd.board.cmake)

Binary file not shown.

After

Width:  |  Height:  |  Size: 398 KiB

Binary file not shown.

After

Width:  |  Height:  |  Size: 290 KiB

View File

@ -0,0 +1,220 @@
.. _atsamr34_xpro:
SAM R34 Xplained Pro Evaluation Kit
###################################
Overview
********
The SAM R34 Xplained Pro evaluation kit is ideal for evaluation and
prototyping with the SAM R34 Cortex®-M0+ processor-based
microcontrollers. The kit includes Atmels Embedded Debugger (EDBG),
which provides a full debug interface without the need for additional
hardware.
The SAMR34 and SAMR35 parts are produced as a System-in-Package (SiP),
including both a SAML21 die, and a Semtech SX1276 LoRa radio die.
This board is also referred to as DM320111.
.. image:: img/atsamr34-xpro.png
:width: 500px
:align: center
:alt: ATSAMR34-XPRO
Hardware
********
- ATSAMR34J18 ARM Cortex-M0+ processor at 48 MHz
- 32.768 kHz crystal oscillator
- 256 KiB flash memory, 32 KiB of SRAM, 8KB Low Power SRAM
- One yellow user LED
- One mechanical user push button
- One reset button
- On-board USB based EDBG unit with serial console
Supported Features
==================
The atsamr34_xpro board configuration supports the following hardware
features:
.. list-table::
:header-rows: 1
* - Interface
- Controller
- Driver / Component
* - NVIC
- on-chip
- nested vector interrupt controller
* - Flash
- on-chip
- Can be used with LittleFS to store files
* - SYSTICK
- on-chip
- systick
* - WDT
- on-chip
- Watchdog
* - GPIO
- on-chip
- I/O ports
* - PWM
- on-chip
- Pulse Width Modulation
* - USART
- on-chip
- Serial ports
* - I2C
- on-chip
- I2C ports
* - SPI
- on-chip
- Serial Peripheral Interface ports
* - TRNG
- on-chip
- True Random Number Generator
The following hardware features are supported by Zephyr, but not yet fully
supported by the SOC:
.. list-table::
:header-rows: 1
* - Interface
- Controller
- Driver / Component
* - LoRa Radio
- on-chip
- Internal SX1276 LoRa Radio
Other hardware features are not currently supported by Zephyr.
The default configuration can be found in the Kconfig
``boards/arm/atsamr34_xpro/atsamr34_xpro_defconfig``.
Pin Mapping
===========
The SAM R34 Xplained Pro evaluation kit has 3 GPIO controllers. These
controllers are responsible for pin muxing, input/output, pull-up, etc.
For mode details please refer to `SAM R34 Family Datasheet`_ and the `SAM R34
Xplained Pro Schematic`_.
.. image:: img/atsamr34-xpro-pinout.png
:width: 500px
:align: center
:alt: ATSAMR34-XPRO-pinout
Default Zephyr Peripheral Mapping:
----------------------------------
- SERCOM0 UART TX : PA04
- SERCOM0 UART RX : PA05
- SERCOM1 I2C SDA : PA16
- SERCOM1 I2C SCL : PA17
- SERCOM4 SPI MISO : PC19
- SERCOM4 SPI MOSI : PB30
- SERCOM4 SPI SCK : PC18
- SERCOM4 GPIO CS : PB31
- SERCOM5 SPI MISO : PB02
- SERCOM5 SPI MOSI : PB22
- SERCOM5 SPI SCK : PB23
- SERCOM5 GPIO CS0 : PA23
- SERCOM5 GPIO CS1 : PA14
- USB DP : PA25
- USB DM : PA24
- GPIO/PWM LED0 : PA19
System Clock
============
The SAMR34 MCU is configured to use the 32.768 kHz external oscillator
with the on-chip PLL generating the 48 MHz system clock.
Serial Port
===========
The SAMR34 MCU has six SERCOM based USARTs with one configured as USART in
this BSP. SERCOM0 is the default Zephyr console.
- SERCOM0 115200 8n1 - connected to the onboard Atmel Embedded Debugger (EDBG)
PWM
===
The SAMR34 MCU has 3 TCC based PWM units with up to 4 outputs each and a period
of 24 bits or 16 bits. If :code:`CONFIG_PWM_SAM0_TCC` is enabled then LED0 is
driven by TCC0 instead of by GPIO.
SPI Port
========
The SAMR34 MCU has 6 SERCOM based SPIs, with two configured as SPI in this BSP.
- SERCOM4 - connected to the internal LoRa radio
- SERCOM5 - connected to EXT1 and EXT3
Programming and Debugging
*************************
The SAM R34 Xplained Pro comes with a Atmel Embedded Debugger (EDBG). This
provides a debug interface to the SAMR34 chip and is supported by
OpenOCD.
Flashing
========
#. Build the Zephyr kernel and the ``hello_world`` sample application:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: atsamr34_xpro
:goals: build
:compact:
#. Connect the SAM R34 Xplained Pro to your host computer using the USB debug
port.
#. Run your favorite terminal program to listen for output. Under Linux the
terminal should be :code:`/dev/ttyACM0`. For example:
.. code-block:: console
$ picocom -b 115200 /dev/ttyACM0
- Speed: 115200
- Data: 8 bits
- Parity: None
- Stop bits: 1
#. To flash an image:
.. zephyr-app-commands::
:zephyr-app: samples/hello_world
:board: atsamr34_xpro
:goals: flash
:compact:
You should see "Hello World! atsamr34_xpro" in your terminal.
References
**********
.. target-notes::
.. _Microchip website:
https://www.microchip.com/en-us/development-tool/dm320111
.. _SAM L21 Family Datasheet:
https://ww1.microchip.com/downloads/en/DeviceDoc/SAM_L21_Family_DataSheet_DS60001477C.pdf
.. _SAM R34 Family Datasheet:
https://ww1.microchip.com/downloads/en/DeviceDoc/SAM-R34-R35-Low-Power-LoRa-Sub-GHz-SiP-Data-Sheet-DS70005356C.pdf
.. _SAM R34 Xplained Pro Schematic:
https://ww1.microchip.com/downloads/Secure/en/DeviceDoc/SAMR34_SiP_Reference_Design_Package_V3.0.exe
.. _Semtech SX1276:
https://www.semtech.com/products/wireless-rf/lora-transceivers/sx1276

View File

@ -0,0 +1,24 @@
# Copyright (c) 2021 Argentum Systems Ltd.
# SPDX-License-Identifier: Apache-2.0
source [find interface/cmsis-dap.cfg]
transport select swd
# chip name
set CHIPNAME at91samr34j18
set ENDIAN little
set CPUTAPID 0x0bc11477
source [find target/at91samdXX.cfg]
reset_config trst_and_srst separate
$_TARGETNAME configure -event gdb-attach {
echo "Debugger attaching: halting execution"
reset halt
gdb_breakpoint_override hard
}
$_TARGETNAME configure -event gdb-detach {
echo "Debugger detaching: resuming execution"
resume
}

View File

@ -0,0 +1,39 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2021 Argentum Systems Ltd.
*/
#include <zephyr/dt-bindings/adc/adc.h>
/ {
zephyr,user {
/* EXT-1, pin 3 ADC(+) */
io-channels = <&adc 6>;
};
};
&pinctrl {
adc_default: adc_default {
group1 {
pinmux = <PA6B_ADC_AIN6>;
};
};
};
&adc {
#address-cells = <1>;
#size-cells = <0>;
pinctrl-0 = <&adc_default>;
pinctrl-names = "default";
channel@6 {
reg = <6>;
zephyr,gain = "ADC_GAIN_1";
zephyr,reference = "ADC_REF_INTERNAL";
zephyr,acquisition-time = <ADC_ACQ_TIME_DEFAULT>;
zephyr,resolution = <12>;
zephyr,input-positive = <6>;
};
};

View File

@ -0,0 +1,40 @@
/*
* SPDX-License-Identifier: Apache-2.0
*
* Copyright (c) 2021 Argentum Systems Ltd.
*/
&dmac {
status = "okay";
};
&sercom0 {
/* configure DMA channels for async operation */
dmas = <&dmac 0 0x01>, <&dmac 1 0x02>;
dma-names = "rx", "tx";
};
&pinctrl {
sercom2_default: sercom2_default {
group1 {
pinmux = <PA8D_SERCOM2_PAD0>;
};
};
};
&sercom2 {
status = "okay";
compatible = "atmel,sam0-uart";
current-speed = <115200>;
/* internally loop-back Tx and Rx on PAD0 */
rxpo = <0>;
txpo = <0>;
/* configure DMA channels for async operation */
dmas = <&dmac 0 0x05>, <&dmac 1 0x06>;
dma-names = "rx", "tx";
/* PAD0 must be configured to allow working loop-back */
pinctrl-0 = <&sercom2_default>;
pinctrl-names = "default";
};

View File

@ -34,6 +34,8 @@
#define UART_DEVICE_DEV DT_NODELABEL(sercom3)
#elif defined(CONFIG_BOARD_ATSAML21_XPRO)
#define UART_DEVICE_NAME DT_NODELABEL(sercom1)
#elif defined(CONFIG_BOARD_ATSAMR34_XPRO)
#define UART_DEVICE_NAME DT_NODELABEL(sercom2)
#elif defined(CONFIG_BOARD_ATSAME54_XPRO)
#define UART_DEVICE_DEV DT_NODELABEL(sercom1)
#elif defined(CONFIG_BOARD_NUCLEO_F103RB) || \

View File

@ -2,7 +2,7 @@ common:
platform_exclude: seeeduino_xiao serpente arduino_nano_33_iot atsamr21_xpro
adafruit_itsybitsy_m4_express atsame54_xpro atsamd21_xpro adafruit_trinket_m0
arduino_nano_33_iot arduino_zero atsamd21_xpro adafruit_feather_m0_basic_proto
arduino_mkrzero atsaml21_xpro
arduino_mkrzero atsaml21_xpro atsamr34_xpro
tests:
drivers.uart.async_api: