boards: Add support for Adafruit Feather M0 with LoRa radio
Add support for the Feather M0 LoRa board, including support of its Semtech Lora radio. Tested the radio using a pair of boards. Signed-off-by: Miguel Dardenne <miguel.dardenne@gmail.com>
This commit is contained in:
parent
39bb5cd06a
commit
cf175b3f6f
12 changed files with 394 additions and 1 deletions
8
boards/arm/adafruit_feather_m0_lora/Kconfig.board
Normal file
8
boards/arm/adafruit_feather_m0_lora/Kconfig.board
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Adafruit Feather M0 LoRa board configuration
|
||||||
|
|
||||||
|
# Copyright (c) 2022 Miguel Dardenne <miguel.dardenne@gmail.com>
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD_ADAFRUIT_FEATHER_M0_LORA
|
||||||
|
bool "Adafruit Feather M0 LoRa"
|
||||||
|
depends on SOC_PART_NUMBER_SAMD21G18A
|
8
boards/arm/adafruit_feather_m0_lora/Kconfig.defconfig
Normal file
8
boards/arm/adafruit_feather_m0_lora/Kconfig.defconfig
Normal file
|
@ -0,0 +1,8 @@
|
||||||
|
# Adafruit Feather M0 LoRa board configuration
|
||||||
|
|
||||||
|
# Copyright (c) 2022 Miguel Dardenne <miguel.dardenne@gmail.com>
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
config BOARD
|
||||||
|
default "adafruit_feather_m0_lora"
|
||||||
|
depends on BOARD_ADAFRUIT_FEATHER_M0_LORA
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2022, Gerson Fernando Budke <nandojve@gmail.com>
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
#include <dt-bindings/pinctrl/samd21-da1gXabcd-pinctrl.h>
|
||||||
|
|
||||||
|
&pinctrl {
|
||||||
|
sercom3_i2c_default: sercom3_i2c_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PA22C_SERCOM3_PAD0>,
|
||||||
|
<PA23C_SERCOM3_PAD1>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sercom4_spi_default: sercom4_spi_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PA12D_SERCOM4_PAD0>,
|
||||||
|
<PB10D_SERCOM4_PAD2>,
|
||||||
|
<PB11D_SERCOM4_PAD3>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
sercom0_uart_default: sercom0_uart_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PA11C_SERCOM0_PAD3>,
|
||||||
|
<PA10C_SERCOM0_PAD2>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
usb_dc_default: usb_dc_default {
|
||||||
|
group1 {
|
||||||
|
pinmux = <PA25G_USB_DP>,
|
||||||
|
<PA24G_USB_DM>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
122
boards/arm/adafruit_feather_m0_lora/adafruit_feather_m0_lora.dts
Normal file
122
boards/arm/adafruit_feather_m0_lora/adafruit_feather_m0_lora.dts
Normal file
|
@ -0,0 +1,122 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2018 Henrik Brix Andersen <henrik@brixandersen.dk>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
/dts-v1/;
|
||||||
|
#include <atmel/samd21.dtsi>
|
||||||
|
#include "adafruit_feather_m0_lora-pinctrl.dtsi"
|
||||||
|
#include "feather_connector.dtsi"
|
||||||
|
|
||||||
|
/ {
|
||||||
|
model = "Adafruit Feather M0 LoRa";
|
||||||
|
compatible = "adafruit,feather-m0-lora", "atmel,samd21g18a",
|
||||||
|
"atmel,samd21";
|
||||||
|
|
||||||
|
chosen {
|
||||||
|
zephyr,console = &sercom0;
|
||||||
|
zephyr,shell-uart = &sercom0;
|
||||||
|
zephyr,sram = &sram0;
|
||||||
|
zephyr,flash = &flash0;
|
||||||
|
zephyr,code-partition = &code_partition;
|
||||||
|
};
|
||||||
|
|
||||||
|
/* These aliases are provided for compatibility with samples */
|
||||||
|
aliases {
|
||||||
|
led0 = &led0;
|
||||||
|
};
|
||||||
|
|
||||||
|
leds {
|
||||||
|
compatible = "gpio-leds";
|
||||||
|
led0: led_0 {
|
||||||
|
gpios = <&porta 17 0>;
|
||||||
|
label = "LED";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&cpu0 {
|
||||||
|
clock-frequency = <48000000>;
|
||||||
|
};
|
||||||
|
|
||||||
|
&sercom0 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "atmel,sam0-uart";
|
||||||
|
current-speed = <115200>;
|
||||||
|
rxpo = <3>;
|
||||||
|
txpo = <1>;
|
||||||
|
|
||||||
|
pinctrl-0 = <&sercom0_uart_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
};
|
||||||
|
|
||||||
|
&sercom3 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "atmel,sam0-i2c";
|
||||||
|
clock-frequency = <I2C_BITRATE_FAST>;
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
|
||||||
|
pinctrl-0 = <&sercom3_i2c_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
};
|
||||||
|
|
||||||
|
&sercom4 {
|
||||||
|
status = "okay";
|
||||||
|
compatible = "atmel,sam0-spi";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <0>;
|
||||||
|
dipo = <0>;
|
||||||
|
dopo = <1>;
|
||||||
|
|
||||||
|
pinctrl-0 = <&sercom4_spi_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
|
||||||
|
cs-gpios = <&porta 6 GPIO_ACTIVE_LOW>;
|
||||||
|
lora: radio@0 {
|
||||||
|
reg = <0>;
|
||||||
|
compatible = "semtech,sx1276";
|
||||||
|
reset-gpios = <&porta 8 GPIO_ACTIVE_LOW>;
|
||||||
|
dio-gpios = <&porta 9 (GPIO_PULL_DOWN | GPIO_ACTIVE_HIGH)>;
|
||||||
|
spi-max-frequency = <10000000>;
|
||||||
|
power-amplifier-output = "pa-boost";
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&flash0 {
|
||||||
|
partitions {
|
||||||
|
compatible = "fixed-partitions";
|
||||||
|
#address-cells = <1>;
|
||||||
|
#size-cells = <1>;
|
||||||
|
|
||||||
|
boot_partition: partition@0 {
|
||||||
|
label = "sam-ba";
|
||||||
|
reg = <0x00000000 DT_SIZE_K(8)>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
code_partition: partition@2000 {
|
||||||
|
label = "code";
|
||||||
|
reg = <0x2000 DT_SIZE_K(232)>;
|
||||||
|
read-only;
|
||||||
|
};
|
||||||
|
|
||||||
|
/*
|
||||||
|
* The final 16 KiB is reserved for the application.
|
||||||
|
* Storage partition will be used by FCB/LittleFS/NVS
|
||||||
|
* if enabled.
|
||||||
|
*/
|
||||||
|
storage_partition: partition@3c000 {
|
||||||
|
label = "storage";
|
||||||
|
reg = <0x0003c000 DT_SIZE_K(16)>;
|
||||||
|
};
|
||||||
|
};
|
||||||
|
};
|
||||||
|
|
||||||
|
&usb0 {
|
||||||
|
status = "okay";
|
||||||
|
|
||||||
|
pinctrl-0 = <&usb_dc_default>;
|
||||||
|
pinctrl-names = "default";
|
||||||
|
};
|
|
@ -0,0 +1,10 @@
|
||||||
|
identifier: adafruit_feather_m0_lora
|
||||||
|
name: Adafruit Feather M0 LoRa
|
||||||
|
type: mcu
|
||||||
|
arch: arm
|
||||||
|
ram: 32
|
||||||
|
flash: 232
|
||||||
|
toolchain:
|
||||||
|
- zephyr
|
||||||
|
- gnuarmemb
|
||||||
|
- xtools
|
|
@ -0,0 +1,12 @@
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
CONFIG_SOC_SERIES_SAMD21=y
|
||||||
|
CONFIG_SOC_PART_NUMBER_SAMD21G18A=y
|
||||||
|
CONFIG_BOARD_ADAFRUIT_FEATHER_M0_LORA=y
|
||||||
|
CONFIG_CONSOLE=y
|
||||||
|
CONFIG_UART_CONSOLE=y
|
||||||
|
CONFIG_SERIAL=y
|
||||||
|
CONFIG_UART_INTERRUPT_DRIVEN=y
|
||||||
|
CONFIG_SOC_ATMEL_SAMD_XOSC32K=y
|
||||||
|
CONFIG_SOC_ATMEL_SAMD_XOSC32K_AS_MAIN=y
|
||||||
|
CONFIG_USE_DT_CODE_PARTITION=y
|
5
boards/arm/adafruit_feather_m0_lora/board.cmake
Normal file
5
boards/arm/adafruit_feather_m0_lora/board.cmake
Normal file
|
@ -0,0 +1,5 @@
|
||||||
|
# Copyright (c) 2018 Henrik Brix Andersen <henrik@brixandersen.dk>
|
||||||
|
#
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
include(${ZEPHYR_BASE}/boards/common/bossac.board.cmake)
|
Binary file not shown.
After Width: | Height: | Size: 92 KiB |
176
boards/arm/adafruit_feather_m0_lora/doc/index.rst
Normal file
176
boards/arm/adafruit_feather_m0_lora/doc/index.rst
Normal file
|
@ -0,0 +1,176 @@
|
||||||
|
.. _adafruit_feather_m0_lora:
|
||||||
|
|
||||||
|
Adafruit Feather M0 LoRa
|
||||||
|
########################
|
||||||
|
|
||||||
|
Overview
|
||||||
|
********
|
||||||
|
|
||||||
|
The Adafruit Feather M0 Lora is a thin, light ARM development
|
||||||
|
boards with an onboard battery connector and charger for 3.7 V lithium
|
||||||
|
polymer batteries, charging status indicator and user LEDs, native USB
|
||||||
|
connector, 20 I/O pins, and a LoRa radio module from Semtech.
|
||||||
|
|
||||||
|
.. image:: img/adafruit_feather_m0_lora.jpg
|
||||||
|
:align: center
|
||||||
|
:alt: Adafruit Feather M0 LoRa
|
||||||
|
|
||||||
|
Hardware
|
||||||
|
********
|
||||||
|
|
||||||
|
- ATSAMD21G18A ARM Cortex-M0+ processor at 48 MHz
|
||||||
|
- 32.768 kHz crystal oscillator
|
||||||
|
- 256 KiB flash memory and 32 KiB of RAM
|
||||||
|
- Battery connector and charger for 3.7 V lithium polymer batteries
|
||||||
|
- Charging indicator LED
|
||||||
|
- User LED
|
||||||
|
- Reset button
|
||||||
|
- Native USB port
|
||||||
|
- SX127x LoRa radio
|
||||||
|
|
||||||
|
Supported Features
|
||||||
|
==================
|
||||||
|
|
||||||
|
The adafruit_feather_m0_lora board configuration supports the
|
||||||
|
following hardware features:
|
||||||
|
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| 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 |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| USART | on-chip | Serial port |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| I2C | on-chip | Inter-Integrated Circuit |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| SPI | on-chip | Serial Peripheral Interface port |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| USB | on-chip | USB device |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
| RADIO | SPI | LoRa radio |
|
||||||
|
+-----------+------------+------------------------------------------+
|
||||||
|
|
||||||
|
Other hardware features are not currently supported by Zephyr.
|
||||||
|
|
||||||
|
The default configuration can be found in the Kconfig file
|
||||||
|
:zephyr_file:`boards/arm/adafruit_feather_m0_lora/adafruit_feather_m0_lora_defconfig`.
|
||||||
|
|
||||||
|
Connections and IOs
|
||||||
|
===================
|
||||||
|
|
||||||
|
The `Adafruit Feather M0 with LoRa radio module Learn site`_ has detailed
|
||||||
|
information about the board including `pinouts`_ and the `schematic`_.
|
||||||
|
|
||||||
|
System Clock
|
||||||
|
============
|
||||||
|
|
||||||
|
The SAMD21 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 SAMD21 MCU has 6 SERCOM based USARTs. On the Adafruit Feather M0
|
||||||
|
with LoRa, SERCOM0 is the Zephyr console and is available on pins 0
|
||||||
|
(RX) and 1 (TX).
|
||||||
|
|
||||||
|
I2C Port
|
||||||
|
========
|
||||||
|
|
||||||
|
The SAMD21 MCU has 6 SERCOM based USARTs. On the Adafruit Feather M0
|
||||||
|
with LoRa, SERCOM3 is available on pin 20 (SDA) and pin 21 (SCL).
|
||||||
|
|
||||||
|
SPI Port
|
||||||
|
========
|
||||||
|
|
||||||
|
The SAMD21 MCU has 6 SERCOM based SPIs. On the Adafruit Feather M0
|
||||||
|
with LoRa, SERCOM4 is available on pin 22 (MISO), pin 23 (MOSI), and
|
||||||
|
pin 24 (SCK).
|
||||||
|
|
||||||
|
USB Device Port
|
||||||
|
===============
|
||||||
|
|
||||||
|
The SAMD21 MCU has a USB device port that can be used to communicate
|
||||||
|
with a host PC. See the :ref:`usb-samples` sample applications for
|
||||||
|
more, such as the :ref:`usb_cdc-acm` sample which sets up a virtual
|
||||||
|
serial port that echos characters back to the host PC.
|
||||||
|
|
||||||
|
LoRa Radio
|
||||||
|
==========
|
||||||
|
The Semtech SX127x radio chip on the Adafruit Feather M0 with LoRa
|
||||||
|
is attached to the SPI port (SERCOM4). Depending on the hardware
|
||||||
|
version, 433MHz or 900MHz is supported.
|
||||||
|
|
||||||
|
Programming and Debugging
|
||||||
|
*************************
|
||||||
|
|
||||||
|
The Adafruit Feather M0 with LoRa ships with a BOSSA compatible
|
||||||
|
SAM-BA bootloader. The bootloader can be entered by quickly tapping
|
||||||
|
the reset button twice.
|
||||||
|
|
||||||
|
Flashing
|
||||||
|
========
|
||||||
|
|
||||||
|
#. Build the Zephyr kernel and the :ref:`hello_world` sample application:
|
||||||
|
|
||||||
|
.. zephyr-app-commands::
|
||||||
|
:zephyr-app: samples/hello_world
|
||||||
|
:board: adafruit_feather_m0_lora
|
||||||
|
:goals: build
|
||||||
|
:compact:
|
||||||
|
|
||||||
|
#. Connect the Adafruit Feather M0 with LoRa to your host computer
|
||||||
|
using USB
|
||||||
|
|
||||||
|
#. Connect a 3.3 V USB to serial adapter to the board and to the
|
||||||
|
host. See the `Serial Port`_ section above for the board's pin
|
||||||
|
connections.
|
||||||
|
|
||||||
|
#. Run your favorite terminal program to listen for output. Under Linux the
|
||||||
|
terminal should be :code:`/dev/ttyACM0`. For example:
|
||||||
|
|
||||||
|
.. code-block:: console
|
||||||
|
|
||||||
|
$ minicom -D /dev/ttyACM0 -o
|
||||||
|
|
||||||
|
The -o option tells minicom not to send the modem initialization
|
||||||
|
string. Connection should be configured as follows:
|
||||||
|
|
||||||
|
- Speed: 115200
|
||||||
|
- Data: 8 bits
|
||||||
|
- Parity: None
|
||||||
|
- Stop bits: 1
|
||||||
|
|
||||||
|
#. Tap the reset button twice quickly to enter bootloader mode
|
||||||
|
|
||||||
|
#. Flash the image:
|
||||||
|
|
||||||
|
.. zephyr-app-commands::
|
||||||
|
:zephyr-app: samples/hello_world
|
||||||
|
:board: adafruit_feather_m0_lora
|
||||||
|
:goals: flash
|
||||||
|
:compact:
|
||||||
|
|
||||||
|
You should see "Hello World! adafruit_feather_m0_lora" in your terminal.
|
||||||
|
|
||||||
|
References
|
||||||
|
**********
|
||||||
|
|
||||||
|
.. target-notes::
|
||||||
|
|
||||||
|
.. _Adafruit Feather M0 with LoRa radio module Learn site:
|
||||||
|
https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module.
|
||||||
|
|
||||||
|
.. _pinouts:
|
||||||
|
https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/pinouts
|
||||||
|
|
||||||
|
.. _schematic:
|
||||||
|
https://learn.adafruit.com/adafruit-feather-m0-radio-with-lora-radio-module/downloads
|
|
@ -0,0 +1,8 @@
|
||||||
|
/*
|
||||||
|
* Copyright (c) 2020 Richard Osterloh <richard.osterloh@gmail.com>
|
||||||
|
* Copyright (c) 2020 Jacek Ozimek <jacek.ozmk@gmail.com>
|
||||||
|
*
|
||||||
|
* SPDX-License-Identifier: Apache-2.0
|
||||||
|
*/
|
||||||
|
|
||||||
|
feather_i2c: &sercom3 {};
|
7
boards/arm/adafruit_feather_m0_lora/pre_dt_board.cmake
Normal file
7
boards/arm/adafruit_feather_m0_lora/pre_dt_board.cmake
Normal file
|
@ -0,0 +1,7 @@
|
||||||
|
# Copyright (c) 2021 Linaro Limited
|
||||||
|
# SPDX-License-Identifier: Apache-2.0
|
||||||
|
|
||||||
|
# Suppress "unique_unit_address_if_enabled" to handle the following overlaps:
|
||||||
|
# - /soc/pinmux@41004400 & /soc/gpio@41004400
|
||||||
|
# - /soc/pinmux@41004480 & /soc/gpio@41004480
|
||||||
|
list(APPEND EXTRA_DTC_FLAGS "-Wno-unique_unit_address_if_enabled")
|
|
@ -2,7 +2,7 @@ common:
|
||||||
platform_exclude: seeeduino_xiao serpente arduino_nano_33_iot atsamr21_xpro
|
platform_exclude: seeeduino_xiao serpente arduino_nano_33_iot atsamr21_xpro
|
||||||
adafruit_itsybitsy_m4_express atsame54_xpro atsamd21_xpro adafruit_trinket_m0
|
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_nano_33_iot arduino_zero atsamd21_xpro adafruit_feather_m0_basic_proto
|
||||||
arduino_mkrzero atsaml21_xpro atsamr34_xpro
|
adafruit_feather_m0_lora arduino_mkrzero atsaml21_xpro atsamr34_xpro
|
||||||
|
|
||||||
tests:
|
tests:
|
||||||
drivers.uart.async_api:
|
drivers.uart.async_api:
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue