Skip to content
Snippets Groups Projects
Unverified Commit 7e3c3825 authored by Alexandre Abadie's avatar Alexandre Abadie Committed by GitHub
Browse files

Merge pull request #10653 from dylad/pr/saml1x_support

cpu/saml1x: add support for SAML10 and SAML11 MCUs (Cortex-M23)
parents 0edf76d3 7afacf97
No related branches found
No related tags found
No related merge requests found
Showing
with 537 additions and 2 deletions
MODULE = boards_common_saml1x
include $(RIOTBASE)/Makefile.base
ifneq (,$(filter saul_default,$(USEMODULE)))
USEMODULE += saul_gpio
endif
# Put defined MCU peripherals here (in alphabetical order)
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_rtt
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart
# The board MPU family (used for grouping by the CI system)
FEATURES_MCU_GROUP = cortex_m23
include $(RIOTCPU)/saml1x/Makefile.features
# define the cpu used by the saml11 board
export CPU = saml1x
# set edbg device type
EDBG_DEVICE_TYPE = mchp_cm23
USEMODULE += boards_common_saml1x
include $(RIOTMAKE)/boards/sam0.inc.mk
# add the common header files to the include path
INCLUDES += -I$(RIOTBOARD)/common/saml1x/include
/*
* Copyright (C) 2019 Mesotic SAS
*
* 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_common_saml1x
* @{
*
* @file board.c
* @brief Board specific implementations for the Microchip
* SAML10 and SAML11 Xplained Pro board
*
* @author Dylan Laduranty <dylan.laduranty@mesotic.com>
*
* @}
*/
#include "cpu.h"
#include "board.h"
#include "periph/gpio.h"
void led_init(void);
void board_init(void)
{
/* initialize the boards LEDs */
led_init();
/* initialize the CPU */
cpu_init();
}
/**
* @brief Initialize the boards on-board LED
*/
void led_init(void)
{
gpio_init(GPIO_PIN(PA, 7), GPIO_OUT);
}
/*
* Copyright (C) 2019 Mesotic SAS
*
* 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.
*/
/**
* @defgroup boards_common_saml1x Microchip SAML1X
* @ingroup boards
* @brief Support for SAML10 and SAML11 boards
* @{
*
* @file
* @brief Board specific definitions for the Microchip
* SAML10 & SAML11 Xplained Pro board.
*
* @author Dylan Laduranty <dylan.laduranty@mesotic.com>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name PORT selection macros
* @{
*/
#ifdef CPU_FAM_SAML11
#define _PORT PORT_SEC
#else
#define _PORT PORT
#endif
/** @} */
/**
* @name LED pin definitions and handlers
* @{
*/
#define LED0_PIN GPIO_PIN(PA, 7)
#define LED_PORT _PORT->Group[PA]
#define LED0_MASK (1 << 7)
#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[PA]
#define BTN0_PIN GPIO_PIN(PA, 27)
#define BTN0_MODE GPIO_IN_PU
/** @} */
/**
* @brief Initialize board specific hardware, including clock, LEDs and std-IO
*/
void board_init(void);
#ifdef __cplusplus
}
#endif
#endif /* BOARD_H */
/** @} */
/*
* Copyright (C) 2019 Mesotic SAS
*
* 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_common_saml1x
* @{
*
* @file
* @brief Board specific configuration of direct mapped GPIOs
*
* @author Dylan Laduranty <dylan.laduranty@mesotic.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 | SAUL_GPIO_INIT_CLEAR)
},
{
.name = "Button(SW0)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */
/*
* Copyright (C) 2019 Mesotic SAS
*
* 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_common_saml1x
* @{
*
* @file
* @brief Peripheral MCU configuration for the Microchip
* SAML10 & SAML11 Xplained Pro board
*
* @author Dylan Laduranty <dylan.laduranty@mesotic.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 (16000000U)
/**
* @name Timer peripheral configuration
* @{
*/
#define TIMER_NUMOF (1U)
#define TIMER_0_EN 1
/* Timer 0 configuration */
#define TIMER_0_DEV TC0->COUNT32
#define TIMER_0_CHANNELS 1
#define TIMER_0_MAX_VALUE (0xffffffff)
#define TIMER_0_ISR isr_tc0
/** @} */
/**
* @name UART configuration
* @{
*/
static const uart_conf_t uart_config[] = {
{ /* Virtual COM Port */
.dev = &SERCOM2->USART,
.rx_pin = GPIO_PIN(PA,25),
.tx_pin = GPIO_PIN(PA,24),
.mux = GPIO_MUX_D,
.rx_pad = UART_PAD_RX_3,
.tx_pad = UART_PAD_TX_2,
.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 = &(SERCOM0->SPI),
.miso_pin = GPIO_PIN(PA, 4),
.mosi_pin = GPIO_PIN(PA, 14),
.clk_pin = GPIO_PIN(PA, 15),
.miso_mux = GPIO_MUX_D,
.mosi_mux = GPIO_MUX_D,
.clk_mux = GPIO_MUX_D,
.miso_pad = SPI_PAD_MISO_0,
.mosi_pad = SPI_PAD_MOSI_2_SCK_3
}
};
#define SPI_NUMOF (sizeof(spi_config) / sizeof(spi_config[0]))
/** @} */
/**
* @name I2C configuration
* @{
*/
static const i2c_conf_t i2c_config[] = {
{
.dev = &(SERCOM1->I2CM),
.speed = I2C_SPEED_NORMAL,
.scl_pin = GPIO_PIN(PA, 17),
.sda_pin = GPIO_PIN(PA, 16),
.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 ADC Configuration
* @{
*/
#define ADC_NUMOF (1U)
/* ADC 0 Default values */
#define ADC_0_CLK_SOURCE 0 /* GCLK_GENERATOR_0 */
#define ADC_0_PRESCALER ADC_CTRLB_PRESCALER_DIV256
static const adc_conf_chan_t adc_channels[] = {
/* port, pin, muxpos */
{GPIO_PIN(PA, 10), ADC_INPUTCTRL_MUXPOS(ADC_INPUTCTRL_MUXPOS_AIN8)},
};
#define ADC_0_NEG_INPUT ADC_INPUTCTRL_MUXNEG(0x18u)
#define ADC_0_REF_DEFAULT ADC_REFCTRL_REFSEL_INTVCC2
/** @} */
#ifdef __cplusplus
}
#endif
#endif /* PERIPH_CONF_H */
/** @} */
MODULE = board
DIRS = $(RIOTBOARD)/common/saml1x
include $(RIOTBASE)/Makefile.base
include $(RIOTBOARD)/common/saml1x/Makefile.dep
include $(RIOTBOARD)/common/saml1x/Makefile.features
export CPU_FAM = saml10
export CPU_MODEL = saml10e16a
export CFLAGS += -D__SAML10E16A__
include $(RIOTBOARD)/common/saml1x/Makefile.include
/**
@defgroup boards_saml10-xpro Microchip SAML10 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAML10 Xplained Pro board.
## Overview
The `SAML10 Xplained Pro` is an ultra-low power evaluation board by Microchip
featuring a ATSAML10E16A SoC. The SoC includes a SAML10 ARM Cortex-M23 micro-
controller. For programming the MCU comes with 16KB of RAM and 64KB of flash
memory.
## Hardware
![saml10-xpro image](https://www.microchip.com/_ImagedCopy/SAML10%20Xpro%20Front%20Title.jpg)
### MCU
| MCU | ATSAML10E16A |
|:------------- |:--------------------- |
| Family | ARM Cortex-M23 |
| Vendor | Microchip |
| RAM | 16KB |
| Flash | 64KB |
| Frequency | up to 32MHz |
| FPU | no |
| Timers | 3 (16-bit) |
| ADCs | 1x 12-bit (10 channels) |
| UARTs | max 3 (shared with SPI and I2C) |
| SPIs | max 3 (see UART) |
| I2Cs | max 3 (see UART) |
| Vcc | 1.6V - 3.6V |
| Datasheet | [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-L10L11%20Family-DataSheet%20-%20DS60001513B.pdf) |
| Board Manual | [Board Manual](http://ww1.microchip.com/downloads/en/DeviceDoc/70005359B.pdf)|
### User Interface
1 User button and 1 LED:
| Device | PIN |
|:------ |:--- |
| LED0 | PA07 |
| SW0 (button) | PA27 |
## Implementation Status
| Device | ID | Supported | Comments |
|:------------- |:------------- |:------------- |:------------- |
| MCU | saml10 | partly | PLL clock not implemented |
| Low-level driver | GPIO | yes | |
| | PWM | no | |
| | UART | yes | |
| | I2C | no | |
| | SPI | no | |
| | USB | no | |
| | RTT | no | |
| | RTC | no | |
| | RNG | no | |
| | Timer | yes | |
| | ADC | no | |
## Flashing the device
Connect the device to your Micro-USB cable.
The standard method for flashing RIOT to the saml10-xpro is using EDBG.
## Supported Toolchains
For using the saml10-xpro board we strongly recommend the usage of the
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded)
toolchain.
*/
MODULE = board
DIRS = $(RIOTBOARD)/common/saml1x
include $(RIOTBASE)/Makefile.base
include $(RIOTBOARD)/common/saml1x/Makefile.dep
include $(RIOTBOARD)/common/saml1x/Makefile.features
export CPU_FAM = saml11
export CPU_MODEL = saml11e16a
export CFLAGS += -D__SAML11E16A__
include $(RIOTBOARD)/common/saml1x/Makefile.include
/**
@defgroup boards_saml11-xpro Microchip SAML11 Xplained Pro
@ingroup boards
@brief Support for the Microchip SAML11 Xplained Pro board.
## Overview
The `SAML11 Xplained Pro` is an ultra-low power evaluation board by Microchip
featuring a ATSAML11E16A SoC. The SoC includes a SAML11 ARM Cortex-M23 micro-
controller. For programming the MCU comes with 16KB of RAM and 64KB of flash
memory. In addition, this SoC features the ARM TrustZone technology.
## Hardware
![saml11-xpro image](https://www.microchip.com/_ImagedCopy/SAML11%20Xpro%20Front%20Title.jpg)
### MCU
| MCU | ATSAML11E14A |
|:------------- |:--------------------- |
| Family | ARM Cortex-M23 |
| Vendor | Microchip |
| RAM | 16KB |
| Flash | 64KB |
| Frequency | up to 32MHz |
| FPU | no |
| Timers | 3 (16-bit) |
| ADCs | 1x 12-bit (10 channels) |
| UARTs | max 3 (shared with SPI and I2C) |
| SPIs | max 3 (see UART) |
| I2Cs | max 3 (see UART) |
| Vcc | 1.6V - 3.6V |
| Datasheet | [Datasheet](http://ww1.microchip.com/downloads/en/DeviceDoc/SAM-L10L11%20Family-DataSheet%20-%20DS60001513B.pdf) |
| Board Manual | [Board Manual](http://ww1.microchip.com/downloads/en/DeviceDoc/70005359B.pdf)|
### User Interface
1 User button and 1 LED:
| Device | PIN |
|:------ |:--- |
| LED0 | PA07 |
| SW0 (button) | PA27 |
## Implementation Status
| Device | ID | Supported | Comments |
|:------------- |:------------- |:------------- |:------------- |
| MCU | saml11 | partly | PLL clock not implemented |
| Low-level driver | GPIO | yes | |
| | PWM | no | |
| | UART | yes | |
| | I2C | no | |
| | SPI | no | |
| | USB | no | |
| | RTT | no | |
| | RTC | no | |
| | RNG | no | |
| | Timer | yes | |
| | ADC | no | |
## Flashing the device
Connect the device to your Micro-USB cable.
The standard method for flashing RIOT to the saml11-xpro is using EDBG.
## Supported Toolchains
For using the saml11-xpro board we strongly recommend the usage of the
[GNU Tools for ARM Embedded Processors](https://launchpad.net/gcc-arm-embedded)
toolchain.
*/
......@@ -65,7 +65,8 @@ void cortexm_init(void)
/* configure the vector table location to internal flash */
#if defined(CPU_ARCH_CORTEX_M3) || defined(CPU_ARCH_CORTEX_M4) || \
defined(CPU_ARCH_CORTEX_M4F) || defined(CPU_ARCH_CORTEX_M7) || \
(defined(CPU_ARCH_CORTEX_M0PLUS) && (__VTOR_PRESENT == 1))
(defined(CPU_ARCH_CORTEX_M0PLUS) || defined(CPU_ARCH_CORTEX_M23) \
&& (__VTOR_PRESENT == 1))
SCB->VTOR = (uint32_t)&_isr_vectors;
#endif
......
......@@ -59,7 +59,8 @@ bool mpu_enabled(void) {
}
int mpu_configure(uint_fast8_t region, uintptr_t base, uint_fast32_t attr) {
#if __MPU_PRESENT
/* Todo enable MPU support for Cortex-M23/M33 */
#if __MPU_PRESENT && !defined(CPU_ARCH_CORTEX_M23)
assert(region < MPU_NUM_REGIONS);
MPU->RNR = region;
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment