Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
boards: Introduce atxmega-a1-xplained board
Add initial version. Signed-off-by: Gerson Fernando Budke <nandojve@gmail.com>
- Loading branch information
Showing
13 changed files
with
671 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
# Copyright (c) 2020 HAW Hamburg | ||
# Copyright (c) 2021 Gerson Fernando Budle | ||
# | ||
# 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 "atxmega-a1-xplained" if BOARD_ATXMEGA_A1_XPLAINED | ||
|
||
config BOARD_ATXMEGA_A1_XPLAINED | ||
bool | ||
default y | ||
select CPU_MODEL_XMEGA128A1 | ||
|
||
select HAS_PERIPH_I2C | ||
select HAS_PERIPH_SPI | ||
select HAS_PERIPH_UART | ||
|
||
select HAVE_SAUL_GPIO |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
MODULE = board | ||
|
||
DIRS = $(RIOTBOARD)/common/atxmega | ||
|
||
include $(RIOTBASE)/Makefile.base |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
USEMODULE += boards_common_atxmega | ||
|
||
ifneq (,$(filter saul_default,$(USEMODULE))) | ||
USEMODULE += saul_gpio | ||
endif |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
CPU_MODEL = atxmega128a1 | ||
|
||
FEATURES_PROVIDED += periph_i2c | ||
FEATURES_PROVIDED += periph_spi | ||
FEATURES_PROVIDED += periph_uart | ||
|
||
include $(RIOTBOARD)/common/atxmega/Makefile.features |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
override RAM_LEN = 65536 | ||
override EXP_RAM = 1 | ||
|
||
include $(RIOTBOARD)/common/atxmega/Makefile.include |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,52 @@ | ||
/** | ||
@defgroup boards_atxmega-a1-xplained ATxmega-A1 Xplained board | ||
@ingroup boards | ||
@brief Support for the ATxmega-A1 Xplained board | ||
|
||
## Overview | ||
|
||
The ATxmega-A1 Xplained is an old reference to develop with XMEGA's. | ||
|
||
### MCU | ||
| MCU | ATxmega128A1 | | ||
|:------------- |:--------------------------------------------- | | ||
| Family | AVR/ATxmega | | ||
| Vendor | Microchip (previously Atmel) | | ||
| Flash | 128KiB | | ||
| RAM | 8KiB | | ||
| EBI | 16MiB SRAM, 128MiB SDRAM | | ||
| EEPROM | 2KiB | | ||
| Frequency | up to 32MHz | | ||
| Timers | 8 16bit (32 bit combining 2 x 16 bit) | | ||
| ACs | 4 Analog Comparators | | ||
| ADCs | 2 - 16 channels - 12 bit - 2msps | | ||
| ADCs | 2 - 2 channels - 12 bit - 1msps | | ||
| UARTs | 8 (can be used in SPI mode) with 1 IrDA | | ||
| SPIs | 4 | | ||
| I2Cs | 4 (called TWI) | | ||
| DMA | 4 Channels | | ||
| Event System | 8 Channels | | ||
| Ext. INT | All GPIOs | | ||
| Crypto | AES/DES, CRC-16, CRC-32 | | ||
| Vcc | 2.7V - 5.5V (when clocked at 8MHz) | | ||
| Datasheet | [Datasheet](https://ww1.microchip.com/downloads/en/DeviceDoc/ATxmega128A1U-64A1U-Data-Sheet-DS40002058A.pdf) | | ||
| Xmega Manual | [Manual](https://ww1.microchip.com/downloads/en/DeviceDoc/Atmel-8331-8-and-16-bit-AVR-Microcontroller-XMEGA-AU_Manual.pdf) | | ||
| Guide | [AVR1924 PDF](http://ww1.microchip.com/downloads/en/AppNotes/doc8370.pdf) | | ||
| Schematic | [AVR1924 ZIP](https://ww1.microchip.com/downloads/en/AppNotes/AVR1924.zip) | | ||
|
||
## Flashing the Device | ||
|
||
The ATxmega-A1 Xplained needs an external programmer like atmelice. | ||
|
||
In order to flash the ATxmega128A1, simple run: | ||
|
||
make BOARD=atxmega-a1-xplained flash | ||
|
||
## Serial Terminal | ||
|
||
The CDC-ACM will enumerate a /dev/ttyACM device. The STDIO at CDC-ACM shares | ||
with J4 pins 2/3. | ||
|
||
make BOARD=atxmega-a1-xplained term | ||
|
||
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,186 @@ | ||
/* | ||
* Copyright (C) 2021 Gerson Fernando Budke | ||
* | ||
* 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_atxmega-a1-xplained | ||
* @{ | ||
* | ||
* @file | ||
* @brief Board specific definitions for the ATxmegaA1 Xplained board. | ||
* | ||
* @author Gerson Fernando Budke <nandojve@gmail.com> | ||
*/ | ||
|
||
#ifndef BOARD_H | ||
#define BOARD_H | ||
|
||
#include "cpu.h" | ||
#include "macros/units.h" | ||
|
||
#ifdef __cplusplus | ||
extern "C" { | ||
#endif | ||
|
||
/** | ||
* @brief Clock configuration | ||
*/ | ||
#define CLOCK_CORECLOCK MHZ(32) | ||
|
||
/** | ||
* @brief Use the UART-2 for STDIO on this board | ||
*/ | ||
#define STDIO_UART_DEV UART_DEV(2) | ||
|
||
/** | ||
* @name Baudrate for STDIO terminal | ||
* | ||
* The standard configuration for STDIO in cpu/atxmega/periph/uart.c | ||
* is to use double speed. | ||
* | ||
* For 32MHz F_CPU following Baudrate have good error rates | ||
* 115200 | ||
* | ||
* Matches this with BAUD in Board/Makefile.include | ||
* | ||
* @{ | ||
*/ | ||
#ifndef STDIO_UART_BAUDRATE | ||
#define STDIO_UART_BAUDRATE (115200U) | ||
#endif | ||
/** @} */ | ||
|
||
/** | ||
* @name LED pin definitions and handlers | ||
* @{ | ||
*/ | ||
#define LED_PORT PORTE | ||
|
||
#define LED0_PIN GPIO_PIN(PORT_E, 0) | ||
#define LED0_MODE GPIO_OUT | ||
#define LED0_MASK (PIN0_bm) | ||
#define LED0_ON (LED_PORT.OUTCLR = LED0_MASK) | ||
#define LED0_OFF (LED_PORT.OUTSET = LED0_MASK) | ||
#define LED0_TOGGLE (LED_PORT.OUTTGL = LED0_MASK) | ||
|
||
#define LED1_PIN GPIO_PIN(PORT_E, 1) | ||
#define LED1_MODE GPIO_OUT | ||
#define LED1_MASK (PIN1_bm) | ||
#define LED1_ON (LED_PORT.OUTCLR = LED1_MASK) | ||
#define LED1_OFF (LED_PORT.OUTSET = LED1_MASK) | ||
#define LED1_TOGGLE (LED_PORT.OUTTGL = LED1_MASK) | ||
|
||
#define LED2_PIN GPIO_PIN(PORT_E, 2) | ||
#define LED2_MODE GPIO_OUT | ||
#define LED2_MASK (PIN2_bm) | ||
#define LED2_ON (LED_PORT.OUTCLR = LED2_MASK) | ||
#define LED2_OFF (LED_PORT.OUTSET = LED2_MASK) | ||
#define LED2_TOGGLE (LED_PORT.OUTTGL = LED2_MASK) | ||
|
||
#define LED3_PIN GPIO_PIN(PORT_E, 3) | ||
#define LED3_MODE GPIO_OUT | ||
#define LED3_MASK (PIN3_bm) | ||
#define LED3_ON (LED_PORT.OUTCLR = LED3_MASK) | ||
#define LED3_OFF (LED_PORT.OUTSET = LED3_MASK) | ||
#define LED3_TOGGLE (LED_PORT.OUTTGL = LED3_MASK) | ||
|
||
#define LED4_PIN GPIO_PIN(PORT_E, 4) | ||
#define LED4_MODE GPIO_OUT | ||
#define LED4_MASK (PIN4_bm) | ||
#define LED4_ON (LED_PORT.OUTCLR = LED4_MASK) | ||
#define LED4_OFF (LED_PORT.OUTSET = LED4_MASK) | ||
#define LED4_TOGGLE (LED_PORT.OUTTGL = LED4_MASK) | ||
|
||
#define LED5_PIN GPIO_PIN(PORT_E, 5) | ||
#define LED5_MODE GPIO_OUT | ||
#define LED5_MASK (PIN5_bm) | ||
#define LED5_ON (LED_PORT.OUTCLR = LED5_MASK) | ||
#define LED5_OFF (LED_PORT.OUTSET = LED5_MASK) | ||
#define LED5_TOGGLE (LED_PORT.OUTTGL = LED5_MASK) | ||
|
||
#define LED6_PIN GPIO_PIN(PORT_E, 6) | ||
#define LED6_MODE GPIO_OUT | ||
#define LED6_MASK (PIN6_bm) | ||
#define LED6_ON (LED_PORT.OUTCLR = LED6_MASK) | ||
#define LED6_OFF (LED_PORT.OUTSET = LED6_MASK) | ||
#define LED6_TOGGLE (LED_PORT.OUTTGL = LED6_MASK) | ||
|
||
#define LED7_PIN GPIO_PIN(PORT_E, 7) | ||
#define LED7_MODE GPIO_OUT | ||
#define LED7_MASK (PIN7_bm) | ||
#define LED7_ON (LED_PORT.OUTCLR = LED7_MASK) | ||
#define LED7_OFF (LED_PORT.OUTSET = LED7_MASK) | ||
#define LED7_TOGGLE (LED_PORT.OUTTGL = LED7_MASK) | ||
|
||
#define LED_PORT_MASK (LED0_MASK | LED1_MASK | LED2_MASK | LED3_MASK | \ | ||
LED4_MASK | LED5_MASK | LED6_MASK | LED7_MASK) | ||
/** @} */ | ||
|
||
/** | ||
* @name Button pin configuration | ||
* @{ | ||
*/ | ||
#define BTN0_PIN GPIO_PIN(PORT_D, 0) | ||
#define BTN0_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN0_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN1_PIN GPIO_PIN(PORT_D, 1) | ||
#define BTN1_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN1_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN2_PIN GPIO_PIN(PORT_D, 2) | ||
#define BTN2_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN2_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN3_PIN GPIO_PIN(PORT_D, 3) | ||
#define BTN3_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN3_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN4_PIN GPIO_PIN(PORT_D, 4) | ||
#define BTN4_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN4_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN5_PIN GPIO_PIN(PORT_D, 5) | ||
#define BTN5_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN5_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN6_PIN GPIO_PIN(PORT_R, 0) | ||
#define BTN6_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN6_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
|
||
#define BTN7_PIN GPIO_PIN(PORT_R, 1) | ||
#define BTN7_MODE (GPIO_IN | GPIO_OPC_PU | GPIO_SLEW_RATE) | ||
#define BTN7_INT_FLANK (GPIO_ISC_FALLING | GPIO_LVL_LOW) | ||
/** @} */ | ||
|
||
/** | ||
* @name xtimer configuration values | ||
* if XTIMER_HZ > 1MHz then (XTIMER_HZ != (1000000ul << XTIMER_SHIFT)) | ||
* if XTIMER_HZ < 1MHz then ((XTIMER_HZ << XTIMER_SHIFT) != 1000000ul) | ||
* | ||
* 32MHz Core Clock | ||
* XTIMER_HZ 4000000 (clkdiv 8 ) XTIMER_SHIFT 2 | ||
* XTIMER_HZ 1000000 () XTIMER_SHIFT 0 | ||
* XTIMER_HZ 500000 (clkdiv 64) XTIMER_SHIFT 1 | ||
* XTIMER_HZ 250000 (clkdiv 128) XTIMER_SHIFT 2 | ||
* XTIMER_HZ 31250 (clkdiv 1024) XTIMER_SHIFT 5 | ||
* | ||
* @{ | ||
*/ | ||
#define XTIMER_DEV TIMER_DEV(0) | ||
#define XTIMER_CHAN (0) | ||
#define XTIMER_WIDTH (16) | ||
#define XTIMER_HZ KHZ(500) | ||
#define XTIMER_BACKOFF (150) | ||
/** @} */ | ||
|
||
#ifdef __cplusplus | ||
} | ||
#endif | ||
|
||
#endif /* BOARD_H */ | ||
/** @} */ |
Oops, something went wrong.