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

boards/atmega256rfr2-xpro: initial support

This commit is contained in:
Alexandre Abadie 2019-11-04 14:00:56 +01:00
parent c210658255
commit 4751892ce9
No known key found for this signature in database
GPG Key ID: 1C919A403CAE1405
9 changed files with 271 additions and 0 deletions

View File

@ -0,0 +1,5 @@
MODULE = board
DIRS = $(RIOTBOARD)/common/atmega
include $(RIOTBASE)/Makefile.base

View File

@ -0,0 +1,7 @@
USEMODULE += boards_common_atmega
ifneq (,$(filter saul_default,$(USEMODULE)))
# I2C sensor available at address 0x4B
USEMODULE += at30tse75x
USEMODULE += saul_gpio
endif

View File

@ -0,0 +1,7 @@
CPU = atmega256rfr2
FEATURES_PROVIDED += periph_adc
FEATURES_PROVIDED += periph_i2c
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += periph_uart

View File

@ -0,0 +1,14 @@
# configure the terminal program
PORT_LINUX ?= /dev/ttyACM0
PORT_DARWIN ?= $(firstword $(sort $(wildcard /dev/tty.usbmodem*)))
BAUD ?= 9600
include $(RIOTMAKE)/tools/serial.inc.mk
# Use EDBG (xplainedpro) programmer with avrdude
PROGRAMMER ?= xplainedpro
# This board can be reset via avrdude
RESET ?= avrdude -c $(PROGRAMMER) -p m256rfr2
include $(RIOTMAKE)/tools/avrdude.inc.mk
include $(RIOTBOARD)/common/atmega/Makefile.include

View File

@ -0,0 +1,29 @@
/**
@defgroup boards_atmega256rfr2-xpro Atmega256RFR2 Xplained Pro
@ingroup boards
@brief Support for the Atmega256RFR2 Xplained Pro board
### General information
The [Atmega256RFR2 Xplained Pro](https://www.microchip.com/DevelopmentTools/ProductDetails/ATMEGA256RFR2-XPRO)
is an evaluation kit by Microchip for their ATmega256RFR2 microcontroller.
### Flash the board
You can flash the board using the on-board EDBG programmer via JTAG. Avrdude has
support for programming an AVR via EDBG with its xplainedpro programmer:
```
make BOARD=atmega256rfr2-xpro -C examples/hello-world flash
```
### Accessing STDIO via UART
STDIO can be accessed through the USB connector. The on-board UART-USB
adapter is not affected by flashing. It shows up as /dev/ttyACM0 on Linux.
It will be used automatically with `make term`:
```
make BOARD=atmega256rfr2-xpro -C examples/hello-world term
```
*/

View File

@ -0,0 +1,87 @@
/*
* Copyright (C) 2019 Inria
*
* 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Board specific definitions for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef BOARD_H
#define BOARD_H
#include "cpu.h"
#include "periph/gpio.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name STDIO configuration
*
* As the CPU is too slow to handle 115200 baud, we set the default
* baudrate to 9600 for this board
* @{
*/
#define STDIO_UART_BAUDRATE (9600U)
/** @} */
/**
* @brief Use the UART 1 for STDIO on this board
*/
#define STDIO_UART_DEV (UART_DEV(1))
/**
* @name xtimer configuration values
*
* Xtimer runs at 8MHz / 64 = 125kHz
* @{
*/
#define XTIMER_DEV (0)
#define XTIMER_CHAN (0)
#define XTIMER_WIDTH (16)
#define XTIMER_HZ (125000UL)
#define XTIMER_BACKOFF (40)
/** @} */
/**
* @name Macros for controlling the on-board LED
* @{
*/
#define LED0_PIN GPIO_PIN(PORT_B, 4)
#define LED0_MODE GPIO_OUT
#define LED0_ENABLE_PORT DDRB |= LED0_PIN
#define LED0_ON PORTB |= LED0_PIN
#define LED0_OFF PORTB &= ~LED0_PIN
#define LED0_TOGGLE PORTB ^= LED0_PIN
/** @} */
/**
* @name Button pin configuration
* @{
*/
#define BTN0_PIN GPIO_PIN(PORT_E, 4)
#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 */
/** @} */

View File

@ -0,0 +1,53 @@
/*
* Copyright (C) 2019 Inria
*
* 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Configuration of SAUL mapped GPIO pins
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef GPIO_PARAMS_H
#define GPIO_PARAMS_H
#include "board.h"
#include "saul/periph.h"
#ifdef __cplusplus
extern "C" {
#endif
/**
* @brief GPIO configuration
*/
static const saul_gpio_params_t saul_gpio_params[] =
{
{
.name = "BTN0 (SW0)",
.pin = BTN0_PIN,
.mode = BTN0_MODE,
.flags = SAUL_GPIO_INVERTED,
},
{
.name = "LED0 (Yellow)",
.pin = LED0_PIN,
.mode = LED0_MODE,
.flags = (SAUL_GPIO_INVERTED | SAUL_GPIO_INIT_CLEAR),
},
};
#ifdef __cplusplus
}
#endif
#endif /* GPIO_PARAMS_H */
/** @} */

View File

@ -0,0 +1,42 @@
/*
* Copyright (C) 2019 Inria
*
* 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Peripheral MCU configuration for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*/
#ifndef PERIPH_CONF_H
#define PERIPH_CONF_H
#ifdef __cplusplus
extern "C" {
#endif
/**
* @name Clock configuration
* @{
*/
#ifndef CLOCK_CORECLOCK
/* Using 8MHz internal oscillator as default clock source */
#define CLOCK_CORECLOCK (8000000UL)
#endif
/** @} */
#ifdef __cplusplus
}
#endif
#include "periph_conf_atmega_common.h"
#endif /* PERIPH_CONF_H */

View File

@ -0,0 +1,27 @@
/*
* Copyright (C) 2019 Inria
*
* 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_atmega256rfr2-xpro
* @{
*
* @file
* @brief Board specific implementation for the Atmega256RFR2 Xplained Pro
*
* @author Alexandre Abadie <alexandre.abadie@inria.fr>
*
* @}
*/
#include "board.h"
void led_init(void)
{
LED0_ENABLE_PORT;
LED0_OFF;
}