1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2024-12-29 04:50:03 +01:00

boards/same54-xpro: add support for SAME54-XPRO board

This adds support for the Atmel SAM E54 Xplained Pro Evaluation Kit.

Only basic functionality has been enabled.
This commit is contained in:
Benjamin Valentin 2019-03-12 14:01:06 +01:00
parent f375b00ff3
commit ddbeccb195
10 changed files with 451 additions and 0 deletions

View File

@ -0,0 +1,3 @@
MODULE = board
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,3 @@
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,13 @@
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_usbdev
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m4f
include $(RIOTCPU)/samd5x/Makefile.features

View File

@ -0,0 +1,8 @@
# define the cpu used by SAME54 Xplained Pro board
export CPU = samd5x
export CPU_MODEL = same54p20a
# set edbg device type
EDBG_DEVICE_TYPE = atmel_cm4v2
include $(RIOTMAKE)/boards/sam0.inc.mk

View File

@ -0,0 +1,34 @@
/*
* Copyright (C) 2019 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_same54-xpro
* @{
*
* @file
* @brief Board specific implementations for the Microchip SAM E54 Xplained
* Pro board
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
* @}
*/
#include "board.h"
#include "periph/gpio.h"
void board_init(void)
{
/* initialize the on-board LED */
gpio_init(LED0_PIN, GPIO_OUT);
/* initialize the on-board button */
gpio_init(BTN0_PIN, BTN0_MODE);
/* initialize the CPU */
cpu_init();
}

2
boards/same54-xpro/dist/openocd.cfg vendored Normal file
View File

@ -0,0 +1,2 @@
source [find target/atsame5x.cfg]
$_TARGETNAME configure -rtos auto

View File

@ -0,0 +1,91 @@
/**
@defgroup boards_same54-xpro Microchip SAM E54 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAM E54 Xplained Pro board.
## Overview
The `SAME54 Xplained Pro` is an evaluation board by Microchip featuring an
ATSAME54P20A SoC. The SoC includes a SAME54 ARM Cortex-M4F microcontroller.
For programming the MCU comes with 256Kb of RAM and 1024Kb of flash memory.
The same54-xpro is available from various hardware vendors for ~70USD (as of
2019 March).
## Hardware
![same54-xpro image](http://www.microchip.com/_ImagedCopy/ATSAME54-XPRO_angle.jpg)
### MCU
| MCU | ATSAME54P20A |
|:------------- |:--------------------- |
| Family | ARM Cortex-M4F |
| Vendor | Microchip |
| RAM | 256Kb |
| Flash | 1024Kb |
| Frequency | up to 120MHz |
| FPU | yes |
| Timers | 8 (16-bit) |
| ADCs | 2x 12-bit (20 channels) |
| UARTs | max 8 (shared with SPI and I2C) |
| SPIs | max 8 (see UART) |
| I2Cs | max 8 (see UART) |
| Vcc | 1.62V - 3.63V |
| Datasheet | [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/60001507C.pdf) |
| Board Manual | [Board Manual](http://ww1.microchip.com/downloads/en/DeviceDoc/70005321A.pdf)|
### User Interface
1 User button and 1 LED:
| Device | PIN |
|:------ |:--- |
| LED0 | PC18 |
| SW0 (button) | PB31 |
## Implementation Status
| Device | ID | Supported | Comments |
|:------------- |:------------- |:------------- |:------------- |
| MCU | same54 | partly | |
| Low-level driver | GPIO | yes | |
| | ADC | no | |
| | PWM | no | |
| | UART | yes | |
| | I2C | yes | |
| | SPI | yes | |
| | USB | no | |
| | RTT | yes | |
| | RTC | yes | |
| | RNG | yes | |
| | Timer | yes | |
| | Ethernet | no | |
## Flashing the device
Connect the device to your Micro-USB cable using the port labeled as *DEBUG
USB*.
The standard method for flashing RIOT to the same54-xpro is using EDBG.
On Linux you will have to add a **udev** rule for hidraw, like
```
bash
echo 'KERNEL=="hidraw*", SUBSYSTEM=="hidraw", MODE="0664", GROUP="plugdev"' \
| sudo tee -a /etc/udev/rules.d/99-usb.rules
sudo service udev restart
```
## Supported Toolchains
For using the same54-xpro board we strongly recommend the usage of the
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded)
toolchain.
## Known Issues / Problems
*/

View File

@ -0,0 +1,70 @@
/*
* Copyright (C) 2019 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_same54-xpro
* @{
*
* @file
* @brief Board specific definitions for the Microchip SAM E54 Xplained Pro
* board
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PC, 18)
#define LED_PORT PORT->Group[PC]
#define LED0_MASK (1 << 18)
#define LED0_ON (LED_PORT.OUTCLR.reg = LED0_MASK)
#define LED0_OFF (LED_PORT.OUTSET.reg = LED0_MASK)
#define LED0_TOGGLE (LED_PORT.OUTTGL.reg = LED0_MASK)
/** @} */
/**
* @name SW0 (Button) pin definitions
* @{
*/
#define BTN0_PORT PORT->Group[PB]
#define BTN0_PIN GPIO_PIN(PB, 31)
#define BTN0_MODE GPIO_IN_PU
/** @} */
/**
* @name Xtimer configuration
* @{
*/
#define XTIMER_WIDTH (32)
#define XTIMER_HZ (1000000ul)
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2019 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_same54-xpro
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO pin configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "LED(orange)",
.pin = LED0_PIN,
.mode = GPIO_OUT,
.flags = SAUL_GPIO_INVERTED
},
{
.name = "Button(SW0)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,174 @@
/*
* Copyright (C) 2019 ML!PA Consulting GmbH
*
* This file is subject to the terms and conditions of the GNU Lesser
* General Public License v2.1. See the file LICENSE in the top level
* directory for more details.
*/
/**
* @ingroup boards_same54-xpro
* @{
*
* @file
* @brief Configuration of CPU peripherals for the Microchip SAM E54 Xplained
* Pro board
*
* @author Benjamin Valentin <benjamin.valentin@ml-pa.com>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#include "periph_cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GCLK reference speed
*/
#define CLOCK_CORECLOCK (120000000U)
/**
* @name Timer peripheral configuration
* @{
*/
static const tc32_conf_t timer_config[] = {
{ /* Timer 0 - System Clock */
.dev = TC0,
.irq = TC0_IRQn,
.mclk = &MCLK->APBAMASK.reg,
.mclk_mask = MCLK_APBAMASK_TC0 | MCLK_APBAMASK_TC1,
.gclk_id = TC0_GCLK_ID,
.gclk_src = GCLK_PCHCTRL_GEN(5),
.prescaler = TC_CTRLA_PRESCALER_DIV8,
.flags = TC_CTRLA_MODE_COUNT32,
},
{ /* Timer 1 */
.dev = TC2,
.irq = TC2_IRQn,
.mclk = &MCLK->APBBMASK.reg,
.mclk_mask = MCLK_APBBMASK_TC2 | MCLK_APBBMASK_TC3,
.gclk_id = TC2_GCLK_ID,
.gclk_src = GCLK_PCHCTRL_GEN(5),
.prescaler = TC_CTRLA_PRESCALER_DIV8,
.flags = TC_CTRLA_MODE_COUNT32,
}
};
/* Timer 0 configuration */
#define TIMER_0_CHANNELS 2
#define TIMER_0_ISR isr_tc0
/* Timer 1 configuration */
#define TIMER_1_CHANNELS 2
#define TIMER_1_ISR isr_tc2
#define TIMER_NUMOF (sizeof(timer_config)/sizeof(timer_config[0]))
/** @} */
/**
* @name UART configuration
* @{
*/
static const uart_conf_t uart_config[] = {
{ /* Virtual COM Port */
.dev = &SERCOM2->USART,
.rx_pin = GPIO_PIN(PB,24),
.tx_pin = GPIO_PIN(PB,25),
.mux = GPIO_MUX_D,
.rx_pad = UART_PAD_RX_1,
.tx_pad = UART_PAD_TX_0,
.flags = UART_FLAG_NONE,
.gclk_src = GCLK_PCHCTRL_GEN_GCLK0
}
};
/* interrupt function name mapping */
#define UART_0_ISR isr_sercom2_2
#define UART_NUMOF (sizeof(uart_config) / sizeof(uart_config[0]))
/** @} */
/**
* @name SPI configuration
* @{
*/
static const spi_conf_t spi_config[] = {
{
.dev = &(SERCOM6->SPI),
.miso_pin = GPIO_PIN(PC, 7),
.mosi_pin = GPIO_PIN(PC, 4),
.clk_pin = GPIO_PIN(PC, 5),
.miso_mux = GPIO_MUX_C,
.mosi_mux = GPIO_MUX_C,
.clk_mux = GPIO_MUX_C,
.miso_pad = SPI_PAD_MISO_3,
.mosi_pad = SPI_PAD_MOSI_0_SCK_1
}
};
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
/** @} */
/**
* @name I2C configuration
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = &(SERCOM7->I2CM),
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PD, 9),
.sda_pin = GPIO_PIN(PD, 8),
.mux = GPIO_MUX_C,
.gclk_src = GCLK_PCHCTRL_GEN_GCLK0,
.flags = I2C_FLAG_NONE
}
};
#define I2C_NUMOF (sizeof(i2c_config) / sizeof(i2c_config[0]))
/** @} */
/**
* @name RTC configuration
* @{
*/
#define RTC_NUMOF (1)
#define EXTERNAL_OSC32_SOURCE 1
#define INTERNAL_OSC32_SOURCE 0
#define ULTRA_LOW_POWER_INTERNAL_OSC_SOURCE 0
/** @} */
/**
* @name RTT configuration
* @{
*/
#define RTT_FREQUENCY (32768U)
#define RTT_MAX_VALUE (0xffffffffU)
#define RTT_NUMOF (1)
/** @} */
/**
* @name USB peripheral configuration
* @{
*/
static const sam0_common_usb_config_t sam_usbdev_config[] = {
{
.dm = GPIO_PIN(PA, 24),
.dp = GPIO_PIN(PA, 25),
.d_mux = GPIO_MUX_H,
.device = &USB->DEVICE,
}
};
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */