|
Mesh4all
May the mesh be with you
|
Peripheral MCU configuration for m4a_mb board. More...
#include <stdint.h>#include "cpu.h"#include "periph_cpu.h"
Include dependency graph for periph_conf.h:
This graph shows which files directly or indirectly include this file:Go to the source code of this file.
Variables | |
| static const tc32_conf_t | timer_config [] |
| Timer peripheral configuration. More... | |
| static const uart_conf_t | uart_config [] |
| Settings for UART. More... | |
| static const pwm_conf_chan_t | pwm_chan0_config [] |
| By default only channel 0 is enabled, PWM 1 and 2 can be enabled by setting PWM_1_EN and/or PWM_2_EN to 1. More... | |
| static const pwm_conf_t | pwm_config [] |
| Settings for PWM peripheral. More... | |
| static const spi_conf_t | spi_config [] |
| SPI configuration. More... | |
| static const i2c_conf_t | i2c_config [] |
| I2C configuration. More... | |
| static const adc_conf_chan_t | adc_channels [] |
| ADC channels. More... | |
| static const sam0_common_usb_config_t | sam_usbdev_config [] |
| USB peripheral settings. More... | |
Clock settings | |
There are three choices for selection of CORECLOCK:
The PLL option allows for the usage of a wider frequency range and a more stable clock with less jitter. This is why this option is default. The target frequency is computed from the PLL multiplier and the PLL divisor. Use the following formula to compute your values: CORECLOCK = ((PLL_MUL + 1) * 1MHz) / PLL_DIV
The internal Oscillator used directly can lead to a slightly better power efficiency to the cost of a less stable clock. Use this option when you know what you are doing! The actual core frequency is adjusted as follows: CORECLOCK = 8MHz / DIV
Default parameters are the following:
| |
| #define | CLOCK_USE_PLL (1) |
| Use Phase-Locked Loop [PLL] as reference clock: True. | |
| #define | CLOCK_USE_XOSC32_DFLL (0) |
| Use External OScillator [XOSC32] as reference clock: False. | |
| #define | GEN2_ULP32K (0) |
| OSCULP32K is factory calibrated to be around 32.768kHz but this values can be of by a couple off % points, so prefer XOSC32K as default configuration. More... | |
| #define | CLOCK_PLL_MUL (47U) |
| Set [MUL] to 47U if we are using [PLL]. More... | |
| #define | CLOCK_PLL_DIV (1U) |
| Clock [DIV] 1U if we are using [PLL] This don't need to be changed by now, but it can be adjusted for our requirements. | |
| #define | CLOCK_CORECLOCK (((CLOCK_PLL_MUL + 1) * 1000000U) / CLOCK_PLL_DIV) |
| Definition for core clock if we are using [PLL] as reference. More... | |
Timers | |
| #define | TIMER_0_MAX_VALUE 0xffff |
| #define | TIMER_0_ISR isr_tc3 |
| #define | TIMER_1_ISR isr_tc4 |
| #define | TIMER_NUMOF ARRAY_SIZE(timer_config) |
UART configuration | |
| #define | UART_0_ISR isr_sercom3 |
| #define | UART_1_ISR isr_sercom4 |
| #define | UART_2_ISR isr_sercom5 |
| #define | UART_NUMOF ARRAY_SIZE(uart_config) |
Enabled or Disabled PWM channels | |
| #define | PWM_0_EN 1 |
| #define | PWM_1_EN 0 |
| #define | PWM_2_EN 0 |
PWM config | |
| #define | PWM_NUMOF ARRAY_SIZE(pwm_config) |
Number of SPI | |
| #define | SPI_NUMOF ARRAY_SIZE(spi_config) |
Number of I2C | |
| #define | I2C_NUMOF ARRAY_SIZE(i2c_config) |
RTT configuration | |
| #define | RTT_FREQUENCY (32768U) |
ADC Configuration | |
| #define | ADC_PRESCALER ADC_CTRLB_PRESCALER_DIV512 |
| #define | ADC_NEG_INPUT ADC_INPUTCTRL_MUXNEG_GND |
| #define | ADC_GAIN_FACTOR_DEFAULT ADC_INPUTCTRL_GAIN_1X |
| #define | ADC_REF_DEFAULT ADC_REFCTRL_REFSEL_INT1V |
Number of ADC channels | |
| #define | ADC_NUMOF ARRAY_SIZE(adc_channels) |
DAC Settings | |
| #define | DAC_CLOCK SAM0_GCLK_1MHZ |
| #define | DAC_VREF DAC_CTRLB_REFSEL_AVCC |
Peripheral MCU configuration for m4a_mb board.
Definition in file periph_conf.h.
| #define ADC_GAIN_FACTOR_DEFAULT ADC_INPUTCTRL_GAIN_1X |
Gain Factor: 1x
Definition at line 432 of file periph_conf.h.
| #define ADC_NEG_INPUT ADC_INPUTCTRL_MUXNEG_GND |
Neg. Input: GND
Definition at line 431 of file periph_conf.h.
| #define ADC_NUMOF ARRAY_SIZE(adc_channels) |
Number of ADC channels is 6
Definition at line 465 of file periph_conf.h.
| #define ADC_PRESCALER ADC_CTRLB_PRESCALER_DIV512 |
Prescaler: DIV 512
Definition at line 430 of file periph_conf.h.
| #define ADC_REF_DEFAULT ADC_REFCTRL_REFSEL_INT1V |
Reference: Internal 1.0 Volt
Definition at line 433 of file periph_conf.h.
| #define CLOCK_CORECLOCK (((CLOCK_PLL_MUL + 1) * 1000000U) / CLOCK_PLL_DIV) |
Definition for core clock if we are using [PLL] as reference.
Definition at line 101 of file periph_conf.h.
| #define CLOCK_PLL_MUL (47U) |
Set [MUL] to 47U if we are using [PLL].
Definition at line 91 of file periph_conf.h.
| #define DAC_CLOCK SAM0_GCLK_1MHZ |
Uses 1 MHz clock
Definition at line 472 of file periph_conf.h.
| #define DAC_VREF DAC_CTRLB_REFSEL_AVCC |
Select VCC as reference
Definition at line 473 of file periph_conf.h.
| #define GEN2_ULP32K (0) |
OSCULP32K is factory calibrated to be around 32.768kHz but this values can be of by a couple off % points, so prefer XOSC32K as default configuration.
0: use XOSC32K (always 32.768kHz) to clock GCLK2 1: use OSCULP32K factory calibrated (~32.768kHz) to clock GCLK2
Definition at line 84 of file periph_conf.h.
| #define I2C_NUMOF ARRAY_SIZE(i2c_config) |
Number of I2C available
Definition at line 414 of file periph_conf.h.
| #define PWM_0_EN 1 |
PWM 0 is enabled
Definition at line 243 of file periph_conf.h.
| #define PWM_1_EN 0 |
PWM 1 is disabled
Definition at line 244 of file periph_conf.h.
| #define PWM_2_EN 0 |
PWM 2 is disabled
Definition at line 245 of file periph_conf.h.
| #define PWM_NUMOF ARRAY_SIZE(pwm_config) |
Number of PWM channels, default: only chan0
Definition at line 310 of file periph_conf.h.
| #define RTT_FREQUENCY (32768U) |
RTT is set to 32768
Definition at line 422 of file periph_conf.h.
| #define SPI_NUMOF ARRAY_SIZE(spi_config) |
3 SPI are available
Definition at line 385 of file periph_conf.h.
| #define TIMER_0_ISR isr_tc3 |
Timer 0 ISR uses tc3
Definition at line 159 of file periph_conf.h.
| #define TIMER_0_MAX_VALUE 0xffff |
Max. Value
Definition at line 158 of file periph_conf.h.
| #define TIMER_1_ISR isr_tc4 |
Timer 1 ISR uses tc4
Definition at line 160 of file periph_conf.h.
| #define TIMER_NUMOF ARRAY_SIZE(timer_config) |
Number of timers available, default: 2
Definition at line 161 of file periph_conf.h.
| #define UART_0_ISR isr_sercom3 |
UART 0 uses isr_sercom3
Definition at line 233 of file periph_conf.h.
| #define UART_1_ISR isr_sercom4 |
UART 1 uses isr_sercom4
Definition at line 234 of file periph_conf.h.
| #define UART_2_ISR isr_sercom5 |
UART 1 uses isr_sercom5
Definition at line 235 of file periph_conf.h.
| #define UART_NUMOF ARRAY_SIZE(uart_config) |
Number of available UART ports
Definition at line 236 of file periph_conf.h.
|
static |
ADC channels.
| Channel | GPIO pin |
|---|---|
| 0 | PB0 |
| 1 | PB1 |
| 2 | PA10 |
| 3 | PA11 |
| 4 | PA2 |
| 5 | PA3 |
Definition at line 452 of file periph_conf.h.
|
static |
I2C configuration.
| device | name | pin |
|---|---|---|
| I2C_0 | SCL | PA9 |
| I2C_0 | SDA | PA8 |
Definition at line 398 of file periph_conf.h.
|
static |
By default only channel 0 is enabled, PWM 1 and 2 can be enabled by setting PWM_1_EN and/or PWM_2_EN to 1.
| channel | GPIO pin | TCC | Default stat. |
|---|---|---|---|
| 0 | PA12 | 0 | Enabled |
| PA13 | 1 | Enabled | |
| 1 | PB12 | 0 | Disabled |
| PB13 | 1 | Disabled | |
| 2 | PB02 | 0 | Disabled |
| PB03 | 1 | Disabled |
Settings for PWM channel 1 if it's enabled
Definition at line 267 of file periph_conf.h.
|
static |
Settings for PWM peripheral.
Definition at line 294 of file periph_conf.h.
|
static |
USB peripheral settings.
| function | pin |
|---|---|
| D- | PA24 |
| D+ | PA25 |
Definition at line 486 of file periph_conf.h.
|
static |
SPI configuration.
| SPI | name | pin |
|---|---|---|
| 0 | miso | PA4 |
| mosi | PA6 | |
| clk | PA7 | |
| 1 | miso | PA16 |
| mosi | PA18 | |
| clk | PA19 | |
| 2 | miso | PB16 |
| mosi | PB22 | |
| clk | PB23 |
Definition at line 330 of file periph_conf.h.
|
static |
Timer peripheral configuration.
Definition at line 127 of file periph_conf.h.
|
static |
Settings for UART.
| UART | Function | GPIO pin |
|---|---|---|
| 0 | RX | PA23 |
| TX | PA22 | |
| RTS | Undefined | |
| CTS | Undefined | |
| 1 | RX | PA9 |
| TX | PA8 | |
| RTS | Undefined | |
| CTS | Undefined | |
| 2 | RX | PA11 |
| TX | PA10 | |
| RTS | Undefined | |
| CTS | Undefined |
Definition at line 184 of file periph_conf.h.