mirror of
https://github.com/RIOT-OS/RIOT.git
synced 2024-12-29 04:50:03 +01:00
boards: stk3200: add support
This commit is contained in:
parent
03b9f45583
commit
7db3e567ab
24
boards/stk3200/Kconfig
Normal file
24
boards/stk3200/Kconfig
Normal file
@ -0,0 +1,24 @@
|
||||
# Copyright (c) 2020 HAW Hamburg
|
||||
#
|
||||
# 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.
|
||||
|
||||
config BOARD
|
||||
default "stk3200" if BOARD_STK3200
|
||||
|
||||
config BOARD_STK3200
|
||||
bool
|
||||
default y
|
||||
select BOARD_COMMON_SILABS
|
||||
select CPU_MODEL_EFM32ZG222F32
|
||||
select HAS_PERIPH_ADC
|
||||
select HAS_PERIPH_I2C
|
||||
select HAS_PERIPH_RTC
|
||||
select HAS_PERIPH_RTT
|
||||
select HAS_PERIPH_SPI
|
||||
select HAS_PERIPH_TIMER
|
||||
select HAS_PERIPH_UART
|
||||
select HAS_PERIPH_UART_MODECFG
|
||||
|
||||
source "$(RIOTBOARD)/common/silabs/Kconfig"
|
5
boards/stk3200/Makefile
Normal file
5
boards/stk3200/Makefile
Normal file
@ -0,0 +1,5 @@
|
||||
MODULE = board
|
||||
|
||||
DIRS = $(RIOTBOARD)/common/silabs
|
||||
|
||||
include $(RIOTBASE)/Makefile.base
|
13
boards/stk3200/Makefile.dep
Normal file
13
boards/stk3200/Makefile.dep
Normal file
@ -0,0 +1,13 @@
|
||||
ifneq (,$(filter saul_default,$(USEMODULE)))
|
||||
USEMODULE += saul_gpio
|
||||
endif
|
||||
|
||||
# limit the stack size so most tests and examples compile
|
||||
CFLAGS += -DTHREAD_STACKSIZE_DEFAULT=512
|
||||
|
||||
# add board common drivers
|
||||
USEMODULE += boards_common_silabs
|
||||
USEMODULE += silabs_bc
|
||||
|
||||
# include board common dependencies
|
||||
include $(RIOTBOARD)/common/silabs/Makefile.dep
|
14
boards/stk3200/Makefile.features
Normal file
14
boards/stk3200/Makefile.features
Normal file
@ -0,0 +1,14 @@
|
||||
CPU = efm32
|
||||
CPU_FAM = efm32zg
|
||||
CPU_MODEL = efm32zg222f32
|
||||
|
||||
# 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 periph_uart_modecfg
|
||||
|
||||
include $(RIOTBOARD)/common/silabs/Makefile.features
|
9
boards/stk3200/Makefile.include
Normal file
9
boards/stk3200/Makefile.include
Normal file
@ -0,0 +1,9 @@
|
||||
# set default port depending on operating system
|
||||
PORT_LINUX ?= /dev/ttyACM0
|
||||
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
|
||||
|
||||
# setup serial terminal
|
||||
include $(RIOTMAKE)/tools/serial.inc.mk
|
||||
|
||||
# include board common
|
||||
include $(RIOTBOARD)/common/silabs/Makefile.include
|
34
boards/stk3200/board.c
Normal file
34
boards/stk3200/board.c
Normal file
@ -0,0 +1,34 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2018 Freie Universität Berlin
|
||||
*
|
||||
* 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_stk3200
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific implementations STK3200 board
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Bas Stottelaar <basstottelaar@gmail.com>
|
||||
*
|
||||
* @}
|
||||
*/
|
||||
|
||||
#include "board.h"
|
||||
#include "board_common.h"
|
||||
|
||||
void board_init(void)
|
||||
{
|
||||
/* initialize the CPU */
|
||||
cpu_init();
|
||||
|
||||
#ifndef RIOTBOOT
|
||||
/* perform common board initialization */
|
||||
board_common_init();
|
||||
#endif
|
||||
}
|
196
boards/stk3200/doc.txt
Normal file
196
boards/stk3200/doc.txt
Normal file
@ -0,0 +1,196 @@
|
||||
/**
|
||||
@defgroup boards_stk3200 Silicon Labs STK3200 starter kit
|
||||
@ingroup boards
|
||||
@brief Support for Silicon Labs STK3200 starter kit
|
||||
|
||||
## Overview
|
||||
Silicon Labs EFM32 Zero Gecko Starter Kit is equipped with the EFM32 microcontroller. It is specifically designed for low-power applications, having energy-saving peripherals, different energy modes and short wake-up times.
|
||||
|
||||
The starter kit is equipped with an Advanced Energy Monitor. This allows you to actively measure the power consumption of your hardware and code, in real-time.
|
||||
|
||||
## Hardware
|
||||
|
||||
### MCU
|
||||
| MCU | EFM32ZG222F32 |
|
||||
|-----------------|------------------------------------------------------|
|
||||
| Family | ARM Cortex-M0PLUS |
|
||||
| Vendor | Silicon Labs |
|
||||
| Vendor Family | EFM32 Zero Gecko |
|
||||
| RAM | 4.0KB |
|
||||
| Flash | 32.0KB |
|
||||
| EEPROM | no |
|
||||
| Frequency | up to 24 MHz |
|
||||
| FPU | no |
|
||||
| MPU | no |
|
||||
| DMA | 12 channels |
|
||||
| Timers | 2x 16-bit + 1x 16-bit (low power) |
|
||||
| ADCs | 12-bit ADC |
|
||||
| UARTs | 2x USART, 1x LEUART |
|
||||
| SPIs | 2x SPI |
|
||||
| I2Cs | 1x |
|
||||
| Vcc | 1.98V - 3.8V |
|
||||
| Datasheet | [Datasheet](https://www.silabs.com/Support%20Documents/TechnicalDocs/EFM32ZG222.pdf) |
|
||||
| Manual | [Manual](https://www.silabs.com/Support%20Documents/TechnicalDocs/EFM32ZG-RM.pdf) |
|
||||
| Board Manual | [Board Manual](https://www.silabs.com/Support%20Documents/TechnicalDocs/efm32zg-stk3200-ug.pdf) |
|
||||
| Board Schematic | [Board Schematic](https://www.silabs.com/Support%20Documents/TechnicalDocs/BRD2010A_B01.pdf) |
|
||||
|
||||
### Pinout
|
||||
This is the pinout of the expansion header on the right side of the board. PIN 1 is the bottom-left contact when the header faces you horizontally.
|
||||
|
||||
| | PIN | PIN | |
|
||||
|------|-----|-----|------|
|
||||
| 3V3 | 20 | 19 | RES |
|
||||
| 5V | 18 | 17 | RES |
|
||||
| PE12 | 16 | 15 | PE13 |
|
||||
| PD5 | 14 | 13 | PA1 |
|
||||
| PD4 | 12 | 11 | PB11 |
|
||||
| PC14 | 10 | 9 | PA0 |
|
||||
| PC15 | 8 | 7 | PC2 |
|
||||
| PD6 | 6 | 5 | PC1 |
|
||||
| PD7 | 4 | 3 | PC0 |
|
||||
| VMCU | 2 | 1 | GND |
|
||||
|
||||
**Note**: not all starter kits by Silicon Labs share the same pinout!
|
||||
|
||||
**Note:** some pins are connected to the board controller, when enabled!
|
||||
|
||||
### Peripheral mapping
|
||||
| Peripheral | Number | Hardware | Pins | Comments |
|
||||
|------------|---------|-----------------|---------------------------------|-----------------------------------------------------------|
|
||||
| ADC | 0 | ADC0 | CHAN0: internal temperature | Ports are fixed, 14/16-bit resolution not supported |
|
||||
| I2C | 0 | I2C0 | SDA: PE12, SCL: PE13 | `I2C_SPEED_LOW` and `I2C_SPEED_HIGH` clock speed deviate |
|
||||
| HWCRYPTO | — | — | | AES128/AES256 only |
|
||||
| RTT | — | RTC | | Either RTT or RTC (see below) |
|
||||
| RTC | — | RTC | | Either RTC or RTT (see below) |
|
||||
| SPI | 0 | USART1 | MOSI: PD7, MISO: PD6, CLK: PC15 | |
|
||||
| Timer | 0 | TIMER0 + TIMER1 | | TIMER0 is used as prescaler (must be adjecent) |
|
||||
| UART | 0 | LEUART0 | RX: PD5, TX: PD4 | STDIO Output, Baud rate limited (see below) |
|
||||
| | 1 | USART1 | RX: PD6, TX: PD7 | |
|
||||
|
||||
### User interface
|
||||
| Peripheral | Mapped to | Pin | Comments |
|
||||
|------------|-----------|------|------------|
|
||||
| Button | PB0 | PC8 | |
|
||||
| | PB1 | PC9 | |
|
||||
| LED | LED0 | PC10 | Yellow LED |
|
||||
| | LED1 | PC11 | Yellow LED |
|
||||
|
||||
## Implementation Status
|
||||
| Device | ID | Supported | Comments |
|
||||
|-------------------------------|-------------------------------------|-----------|----------------------------------------------------------------|
|
||||
| MCU | EFM32ZG | yes | Power modes supported |
|
||||
| Low-level driver | ADC | yes | |
|
||||
| | Flash | yes | |
|
||||
| | GPIO | yes | Interrupts are shared across pins (see reference manual) |
|
||||
| | HW Crypto | yes | |
|
||||
| | I2C | yes | |
|
||||
| | PWM | yes | |
|
||||
| | RTC | yes | As RTT or RTC |
|
||||
| | SPI | partially | Only master mode |
|
||||
| | Timer | yes | |
|
||||
| | UART | yes | USART is shared with SPI. LEUART baud rate limited (see below) |
|
||||
| | USB | no | |
|
||||
| LCD driver | LS013B7DH03 | yes | Sharp Low Power Memory LCD |
|
||||
|
||||
|
||||
|
||||
## Board configuration
|
||||
|
||||
### Board controller
|
||||
The starter kit is equipped with a Board Controller. This controller provides a virtual serial port. The board controller is enabled via a GPIO pin.
|
||||
|
||||
By default, this pin is enabled. You can disable the board controller module by passing `DISABLE_MODULE=silabs_bc` to the `make` command.
|
||||
|
||||
**Note:** to use the virtual serial port, ensure you have the latest board controller firmware installed.
|
||||
|
||||
**Note:** the board controller *always* configures the virtual serial port at 115200 baud with 8 bits, no parity and one stop bit. This also means that it expects data from the MCU with the same settings.
|
||||
|
||||
The low power LCD is also used by the board controller when the `DISP_SELECTED` pin is low. This pin is not initialized by the board, so you have to ensure this pin is initialized by your application if you want to control the low power LCD.
|
||||
|
||||
### Clock selection
|
||||
There are several clock sources that are available for the different peripherals. You are advised to read [AN0004](https://www.silabs.com/Support%20Documents/TechnicalDocs/AN0004.pdf) to get familiar with the different clocks.
|
||||
|
||||
| Source | Internal | Speed | Comments |
|
||||
|---------|----------|----------------------------------|------------------------------------|
|
||||
| HFRCO | Yes | 14 MHz | Enabled during startup, changeable |
|
||||
| HFXO | No | 24 MHz | |
|
||||
| LFRCO | Yes | 32.768 kHz | |
|
||||
| LFXO | No | 32.768 kHz | |
|
||||
| ULFRCO | No | 1.000 kHz | Not very reliable as a time source |
|
||||
|
||||
The sources can be used to clock following branches:
|
||||
|
||||
| Branch | Sources | Comments |
|
||||
|--------|-------------------------|------------------------------|
|
||||
| HF | HFRCO, HFXO | Core, peripherals |
|
||||
| LFA | LFRCO, LFXO | Low-power timers |
|
||||
| LFB | LFRCO, LFXO, CORELEDIV2 | Low-power UART |
|
||||
|
||||
CORELEDIV2 is a source that depends on the clock source that powers the core. It is divided by 2 or 4 to not exceed maximum clock frequencies (emlib takes care of this).
|
||||
|
||||
The frequencies mentioned in the tables above are specific for this starter kit.
|
||||
|
||||
It is important that the clock speeds are known to the code, for proper calculations of speeds and baud rates. If the HFXO or LFXO are different from the speeds above, ensure to pass `EFM32_HFXO_FREQ=freq_in_hz` and `EFM32_LFXO_FREQ=freq_in_hz` to your compiler.
|
||||
|
||||
You can override the branch's clock source by adding `CLOCK_LFA=source` to your compiler defines, e.g. `CLOCK_LFA=cmuSelect_LFRCO`.
|
||||
|
||||
### Low-power peripherals
|
||||
The low-power UART is capable of providing an UART peripheral using a low-speed clock. When the LFB clock source is the LFRCO or LFXO, it can still be used in EM2. However, this limits the baud rate to 9600 baud. If a higher baud rate is desired, set the clock source to CORELEDIV2.
|
||||
|
||||
**Note:** peripheral mappings in your board definitions will not be affected by this setting. Ensure you do not refer to any low-power peripherals.
|
||||
|
||||
### RTC or RTT
|
||||
RIOT-OS has support for *Real-Time Tickers* and *Real-Time Clocks*.
|
||||
|
||||
However, this board MCU family has support for a 24-bit *Real-Time Counter* only, which is a ticker only. A compatibility layer for ticker-to-calendar is available, but this includes extra code size to convert from timestamps to time structures and visa versa.
|
||||
|
||||
Configured at 1 Hz interval, the RTC will overflow each 194 days. When using the ticker-to-calendar mode, this interval is extended artificially.
|
||||
|
||||
### Hardware crypto
|
||||
This MCUs has support for hardware accelerated AES128.
|
||||
|
||||
A peripheral driver interface for RIOT-OS is proposed, but not yet implemented.
|
||||
|
||||
### Usage of emlib
|
||||
This port makes uses of emlib by Silicon Labs to abstract peripheral registers. While some overhead is to be expected, it ensures proper setup of devices, provides chip errata and simplifies development. The exact overhead depends on the application and peripheral usage, but the largest overhead is expected during peripheral setup. A lot of read/write/get/set methods are implemented as inline methods or macros (which have no overhead).
|
||||
|
||||
Another advantage of emlib are the included assertions. These assertions ensure that peripherals are used properly. To enable this, pass `DEBUG_EFM` to your compiler.
|
||||
|
||||
### Pin locations
|
||||
The EFM32 platform supports peripherals to be mapped to different pins (predefined locations). The definitions in `periph_conf.h` mostly consist of a location number and the actual pins. The actual pins are required to configure the pins via GPIO driver, while the location is used to map the peripheral to these pins.
|
||||
|
||||
In other words, these definitions must match. Refer to the data sheet for more information.
|
||||
|
||||
## Flashing the device
|
||||
To flash, [SEGGER JLink](https://www.segger.com/jlink-software.html) is required.
|
||||
|
||||
Flashing is supported by RIOT-OS using the command below:
|
||||
|
||||
```
|
||||
make flash
|
||||
```
|
||||
|
||||
To run the GDB debugger, use the command:
|
||||
|
||||
```
|
||||
make debug
|
||||
```
|
||||
|
||||
Or, to connect with your own debugger:
|
||||
|
||||
```
|
||||
make debug-server
|
||||
```
|
||||
|
||||
Some boards have (limited) support for emulation, which can be started with:
|
||||
|
||||
```
|
||||
make emulate
|
||||
```
|
||||
|
||||
## Supported Toolchains
|
||||
For using the Silicon Labs STK3200 starter kit we strongly recommend the usage of the [GNU Tools for ARM Embedded Processors](https://developer.arm.com/open-source/gnu-toolchain/gnu-rm) toolchain.
|
||||
|
||||
## License information
|
||||
* Silicon Labs' emlib: zlib-style license (permits distribution of source).
|
||||
*/
|
103
boards/stk3200/include/board.h
Normal file
103
boards/stk3200/include/board.h
Normal file
@ -0,0 +1,103 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2018 Freie Universität Berlin
|
||||
*
|
||||
* 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_stk3200
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific definitions for the STK3200 starter kit
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Bas Stottelaar <basstottelaar@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef BOARD_H
|
||||
#define BOARD_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph_conf.h"
|
||||
#include "periph/gpio.h"
|
||||
#include "periph/spi.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Xtimer configuration
|
||||
*
|
||||
* The timer runs at 250 KHz to increase accuracy.
|
||||
* @{
|
||||
*/
|
||||
#define XTIMER_HZ (250000UL)
|
||||
#define XTIMER_WIDTH (16)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Board controller configuration
|
||||
*
|
||||
* Define the GPIO pin to enable the BC, to allow serial communication
|
||||
* via the USB port.
|
||||
* @{
|
||||
*/
|
||||
#define BC_PIN GPIO_PIN(PA, 9)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Push button pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define PB0_PIN GPIO_PIN(PC, 8)
|
||||
#define PB1_PIN GPIO_PIN(PC, 9)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name LED pin definitions
|
||||
* @{
|
||||
*/
|
||||
#define LED0_PIN GPIO_PIN(PC, 10)
|
||||
#define LED1_PIN GPIO_PIN(PC, 11)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Macros for controlling the on-board LEDs
|
||||
* @{
|
||||
*/
|
||||
#define LED0_ON gpio_set(LED0_PIN)
|
||||
#define LED0_OFF gpio_clear(LED0_PIN)
|
||||
#define LED0_TOGGLE gpio_toggle(LED0_PIN)
|
||||
#define LED1_ON gpio_set(LED1_PIN)
|
||||
#define LED1_OFF gpio_clear(LED1_PIN)
|
||||
#define LED1_TOGGLE gpio_toggle(LED1_PIN)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Display configuration
|
||||
*
|
||||
* Connection to the on-board Sharp Memory LCD (LS013B7DH03).
|
||||
* @{
|
||||
*/
|
||||
#define DISP_SPI SPI_DEV(0)
|
||||
#define DISP_COM_PIN GPIO_PIN(PE, 10)
|
||||
#define DISP_CS_PIN GPIO_PIN(PE, 11)
|
||||
#define DISP_SELECT_PIN GPIO_PIN(PA, 8)
|
||||
#define DISP_POWER_PIN GPIO_PIN(PA, 10)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief Initialize the board (GPIO, sensors, clocks).
|
||||
*/
|
||||
void board_init(void);
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* BOARD_H */
|
||||
/** @} */
|
63
boards/stk3200/include/gpio_params.h
Normal file
63
boards/stk3200/include/gpio_params.h
Normal file
@ -0,0 +1,63 @@
|
||||
/*
|
||||
* Copyright (C) 2016-2017 Bas Stottelaar <basstottelaar@gmail.com>
|
||||
*
|
||||
* 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_stk3200
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Board specific configuration of direct mapped GPIOs
|
||||
*
|
||||
* @author Bas Stottelaar <basstottelaar@gmail.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 0",
|
||||
.pin = LED0_PIN,
|
||||
.mode = GPIO_OUT
|
||||
},
|
||||
{
|
||||
.name = "LED 1",
|
||||
.pin = LED1_PIN,
|
||||
.mode = GPIO_OUT
|
||||
},
|
||||
{
|
||||
.name = "Button 1",
|
||||
.pin = PB0_PIN,
|
||||
.mode = GPIO_IN_PU,
|
||||
.flags = SAUL_GPIO_INVERTED
|
||||
},
|
||||
{
|
||||
.name = "Button 2",
|
||||
.pin = PB1_PIN,
|
||||
.mode = GPIO_IN_PU,
|
||||
.flags = SAUL_GPIO_INVERTED
|
||||
}
|
||||
};
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* GPIO_PARAMS_H */
|
||||
/** @} */
|
182
boards/stk3200/include/periph_conf.h
Normal file
182
boards/stk3200/include/periph_conf.h
Normal file
@ -0,0 +1,182 @@
|
||||
/*
|
||||
* Copyright (C) 2015-2018 Freie Universität Berlin
|
||||
*
|
||||
* 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_stk3200
|
||||
* @{
|
||||
*
|
||||
* @file
|
||||
* @brief Configuration of CPU peripherals for the STK3200 starter kit
|
||||
*
|
||||
* @author Hauke Petersen <hauke.petersen@fu-berlin.de>
|
||||
* @author Bas Stottelaar <basstottelaar@gmail.com>
|
||||
*/
|
||||
|
||||
#ifndef PERIPH_CONF_H
|
||||
#define PERIPH_CONF_H
|
||||
|
||||
#include "cpu.h"
|
||||
#include "periph_cpu.h"
|
||||
#include "em_cmu.h"
|
||||
|
||||
#ifdef __cplusplus
|
||||
extern "C" {
|
||||
#endif
|
||||
|
||||
/**
|
||||
* @name Clock configuration
|
||||
* @{
|
||||
*/
|
||||
#ifndef CLOCK_HF
|
||||
#define CLOCK_HF cmuSelect_HFXO
|
||||
#endif
|
||||
#ifndef CLOCK_CORE_DIV
|
||||
#define CLOCK_CORE_DIV cmuClkDiv_1
|
||||
#endif
|
||||
#ifndef CLOCK_LFA
|
||||
#define CLOCK_LFA cmuSelect_LFXO
|
||||
#endif
|
||||
#ifndef CLOCK_LFB
|
||||
#define CLOCK_LFB cmuSelect_CORELEDIV2
|
||||
#endif
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name ADC configuration
|
||||
* @{
|
||||
*/
|
||||
static const adc_conf_t adc_config[] = {
|
||||
{
|
||||
.dev = ADC0,
|
||||
.cmu = cmuClock_ADC0,
|
||||
}
|
||||
};
|
||||
|
||||
static const adc_chan_conf_t adc_channel_config[] = {
|
||||
{
|
||||
.dev = 0,
|
||||
.input = adcSingleInputTemp,
|
||||
.reference = adcRef1V25,
|
||||
.acq_time = adcAcqTime8
|
||||
},
|
||||
{
|
||||
.dev = 0,
|
||||
.input = adcSingleInputVDDDiv3,
|
||||
.reference = adcRef1V25,
|
||||
.acq_time = adcAcqTime8
|
||||
}
|
||||
};
|
||||
|
||||
#define ADC_DEV_NUMOF ARRAY_SIZE(adc_config)
|
||||
#define ADC_NUMOF ARRAY_SIZE(adc_channel_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name I2C configuration
|
||||
* @{
|
||||
*/
|
||||
static const i2c_conf_t i2c_config[] = {
|
||||
{
|
||||
.dev = I2C0,
|
||||
.sda_pin = GPIO_PIN(PE, 12),
|
||||
.scl_pin = GPIO_PIN(PE, 13),
|
||||
.loc = I2C_ROUTE_LOCATION_LOC6,
|
||||
.cmu = cmuClock_I2C0,
|
||||
.irq = I2C0_IRQn,
|
||||
.speed = I2C_SPEED_NORMAL
|
||||
}
|
||||
};
|
||||
|
||||
#define I2C_NUMOF ARRAY_SIZE(i2c_config)
|
||||
#define I2C_0_ISR isr_i2c0
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @brief RTC configuration
|
||||
*/
|
||||
#define RTC_NUMOF (1U)
|
||||
|
||||
/**
|
||||
* @name RTT configuration
|
||||
* @{
|
||||
*/
|
||||
#define RTT_NUMOF (1U)
|
||||
|
||||
#define RTT_MAX_VALUE (0xFFFFFF)
|
||||
#define RTT_FREQUENCY (1U)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name SPI configuration
|
||||
* @{
|
||||
*/
|
||||
static const spi_dev_t spi_config[] = {
|
||||
{
|
||||
.dev = USART1,
|
||||
.mosi_pin = GPIO_PIN(PD, 7),
|
||||
.miso_pin = GPIO_PIN(PD, 6),
|
||||
.clk_pin = GPIO_PIN(PC, 15),
|
||||
.loc = USART_ROUTE_LOCATION_LOC1,
|
||||
.cmu = cmuClock_USART1,
|
||||
.irq = USART1_RX_IRQn
|
||||
}
|
||||
};
|
||||
|
||||
#define SPI_NUMOF ARRAY_SIZE(spi_config)
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name Timer configuration
|
||||
*
|
||||
* The implementation uses two timers in cascade mode.
|
||||
* @{
|
||||
*/
|
||||
static const timer_conf_t timer_config[] = {
|
||||
{
|
||||
.prescaler = {
|
||||
.dev = TIMER0,
|
||||
.cmu = cmuClock_TIMER0
|
||||
},
|
||||
.timer = {
|
||||
.dev = TIMER1,
|
||||
.cmu = cmuClock_TIMER1
|
||||
},
|
||||
.irq = TIMER1_IRQn,
|
||||
.channel_numof = 3,
|
||||
}
|
||||
};
|
||||
|
||||
#define TIMER_NUMOF ARRAY_SIZE(timer_config)
|
||||
#define TIMER_0_ISR isr_timer1
|
||||
/** @} */
|
||||
|
||||
/**
|
||||
* @name UART configuration
|
||||
* @{
|
||||
*/
|
||||
static const uart_conf_t uart_config[] = {
|
||||
{
|
||||
.dev = LEUART0,
|
||||
.rx_pin = GPIO_PIN(PD, 5),
|
||||
.tx_pin = GPIO_PIN(PD, 4),
|
||||
.loc = LEUART_ROUTE_LOCATION_LOC0,
|
||||
.cmu = cmuClock_LEUART0,
|
||||
.irq = LEUART0_IRQn
|
||||
}
|
||||
};
|
||||
|
||||
#define UART_NUMOF ARRAY_SIZE(uart_config)
|
||||
#define UART_0_ISR_RX isr_leuart0
|
||||
/** @} */
|
||||
|
||||
#ifdef __cplusplus
|
||||
}
|
||||
#endif
|
||||
|
||||
#endif /* PERIPH_CONF_H */
|
||||
/** @} */
|
Loading…
Reference in New Issue
Block a user